Archive for category PHP code
PayPal Subscriptions HTML Code
Posted by in PHP code on January 6th, 2010
Manipulating The HTML Code for Your Subscription Button
The following tables show the different parameters within the Subscriptions HTML code and the Subscriptions hyperlink.
The terms for the following subscription are:
-Free for the first week
-$5.00 USD for the next 2 months
-$50.00 USD per year thereafter. Recurs at regular rate for 5 payments
border=”0″ name=”submit”
alt=”Make payments with PayPal – it’s fast, free and secure!”>
|
Table 9.1
|
Source: https://www.paypal.com/en_US/ebook/subscriptions/html.html
Showing PHP error
Posted by in PHP code on November 28th, 2009
error_reporting(E_ALL);ini_set('display_errors', '1');
Get value of TinyMCE
Posted by in PHP code on November 9th, 2009
tinyMCE.getInstanceById(”eventdescription”).getBody().innerHTML;
Autoscroll with PHP
Posted by in PHP code on October 16th, 2009
Here’s the code for auto scroll with php:
.scrollbar {
height: 70px;
overflow: auto;
width:100px;
}
</style>
<div class=scrollbar>
money <br />
stock<br />
finance<br />
option<br />
forex<br />
currency<br />
loan<br />
Accessing other frame data
Posted by in PHP code on July 29th, 2009
In your main page you have an iframe. The iframe code is:
To access the data from that iframe the syntax will be :
Formname.document.getElementsByName.(’contaolname’)[0].value
So the code for the main file is:
function getvalue()
{
alert(frame1.document.getElementsByName(’myname’)[0].value);
}
</script>
<iframe src=”form.php” name=”frame1″></iframe>
<input type=”button” value=”Get value” onclick=”getvalue()”>
Prevent sql injection code
Posted by in PHP code on July 23rd, 2009
SQL Injection is a technique where an attacker creates or alters existing SQL commands to tamper data, override valuable ones, or even to execute dangerous system level commands on the database host. To avoid this, always check your input data using the function below:
{
$valid_string = “[\*\^\'\;]“;
if(ereg($valid_string,$str))
{
echo(”<script>alert(’Invalid characted’);</script>”);
die();
}
else
{
return $str;
}
}
Login form with PHP
Posted by in PHP code on July 23rd, 2009
- First you need to create table for your user with fields: username and password.
- Create basic HTML form that user will fill username and password. This should be easy.
- The action form should should then check whether username and password is valid or not from database. You can encrypt the password using md5 functions. When you check the password supplied by user you need to md5 it too with the value stored in database.
- If user successfully login, then register session and redirect them to other page, like the admin page. The code to register session and redirect them is:
session_register(”password”);
header(”location:admin.php”);
- When user logout you must delete the session:
session_destroy();
PHP Obfuscator
Posted by in PHP code on July 23rd, 2009
Obfuscation allows you to scramble your PHP code so it is hard to read by humans. One of the best Obfuscation for PHP I know is PHP Obfuscator.
Unlike some other solutions PHP Obfuscator does not require special server side libraries or server components to work properly. This allows you to target a broad range of servers that support PHP. This may be useful for commercial products looking to secure their source code.
Key Features
-
Encode and obfuscate PHP code, functions and variables
-
Exclude particular variables, functions or files from obfuscation and encoding
-
Process large projects with command line tools and project files
-
Open source and 100% free









