Rename wp content Folder Wordpress

Ever since WordPress version 2.6 you can actually move your wp-content directory to a different location. The wp-content directory will store all your theme files, plugin files and images.

Why Move The wp-content Folder

The best reason to move the wp-content is for security if you move this to an unexpected location any hackers looking to target this area won't be able to find it, or it will make it more difficult to find.
To change the location of the wp-content is quite simple as the location of this folder can be configured in your wp-config.php file.
All you have to do is add a new variable WP_CONTENT_DIR and change the location of your wp-content folder.
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content' );
To change the location of the wp-content URL there is another variable you can define in the wp-config.
define( 'WP_CONTENT_URL', 'http://www.paulund.co.uk/blog/content/wp-content' );


Moving Plugin Folder

If you don't want to change the location of the entire wp-content folder but just want to move the plugins folder then you can change this location the same as above.
For the plugin folder location we need to define the variable WP_PLUGIN_DIR.
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content/plugins' );
The same as the wp-content folder you can change the URL of the plugin folder for the variable WP_PLUGIN_URL.
define( 'WP_PLUGIN_URL', 'http://example/blog/content/wp-content/plugins');
The problem with doing this for plugins is that there is another variable which can be used by some plugin developers...PLUGINDIR. Therefore you need to make sure that you change this too.
define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content/plugins' );
Continue Reading

PHP Forgot Password Tutorial

Forgot Password
This tutorial is about building a forgot password system(Password Resetting System) with PHP when password is encrypted with MD5() ,SHA1() or any other encryption algorithm .
When you are storing the passwords of users in plain text then you can easily send their password to their email id.But in case of encrypted password  it is not possible to send the plain password to the users because you can not decrypt these passwords.
Basically there are two ways to reset the passwords.First one is assign a random password to the user and send to their email id,but this method can be misused by other users .For example any member can reset other member’s password if he knows email id.So i will not recommend two use this method.Second method is instead of changing the password , assign a random token for that user when he request for password reset.Store this token into your database and also send this token to user’s email id.The best way to send the token is in form of a link .See the link below…
<a href=âhttp://yourwebsite.com/reset.php?token=RANDOM_TOKENâ>Reset Password </a>
When user will click on this link you will can easily determine that which user wants to change the password after getting value of token by $_GET['token'] and compare this value to all available tokens.Now start a session and ask  for new password to your user and store the password in encrypted format in your database.After successful password reset either delete the token or mark that token as used .
If you understand the above method of resetting password then its time code the PHP script.Here is step by step guide to build your own Forgot Password PHP Script.
1).Build tables and database-At first you need to create a file which includes settings for your database to connect.The code is given below ,you just need to change values of all variables.Now open PHPMyAdmin and import the sql file available in attachment or manually create a table name “token” containing three fields email ,password and used.
<?php
//file name: settings.php
//Title:Build your own Forgot Password PHP Script
function connect()
{	
$host="localhost"; //host
$uname="root";  //username
$pass="";      //password
$db= 'test';  //database name

$con = mysql_connect($host,$uname,$pass);

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($db, $con);}
2).Password reset form-Build a simple form using HTML which ask for email id of user.You may use CAPTCHA for better security.I am doing this without CAPTCHA so here is the code .
<?php
//file name: forgotpassword.php 
//Title:Build your own Forgot Password PHP Script
echo'<form action="forgotpassword.php">
	Enter Your Email Id:
	<input type="text" name="email" />
	<input type="submit" value="Reset My Password" />
	</form>';
3).Assign a token and mail it-After getting email id of user first check that email id exist in your database or not.If email id exist then assign a random token ,store the token in a table say “token” with user’s email id and send a password reset link to the user.
<?php
//file name: forgotpassword.php
//Title:Build your own Forgot Password PHP Script
if(!isset($_GET['email'])){
	                  echo'<form action="forgotpassword.php">
	                      Enter Your Email Id:
	                         <input type="text" name="email" />
	                        <input type="submit" value="Reset My Password" />
	                         </form>'; exit();
				       }
$email=$_GET['email'];
include("settings.php");
connect();
$q="select email from users where email='".$email."'";
$r=mysql_query($q);
$n=mysql_num_rows($r);
if($n==0){echo "Email id is not registered";die();}
$token=getRandomString(10);
$q="insert into tokens (token,email) values ('".$token."','".$email."')";
mysql_query($q);
function getRandomString($length) 
	   {
    $validCharacters = "ABCDEFGHIJKLMNPQRSTUXYVWZ123456789";
    $validCharNumber = strlen($validCharacters);
    $result = "";

    for ($i = 0; $i < $length; $i++) {
        $index = mt_rand(0, $validCharNumber - 1);
        $result .= $validCharacters[$index];
    }
	return $result;}
 function mailresetlink($to,$token){
$subject = "Forgot Password on Megarush.net";
$uri = 'http://'. $_SERVER['HTTP_HOST'] ;
$message = '
<html>
<head>
<title>Forgot Password For Megarush.net</title>
</head>
<body>
<p>Click on the given link to reset your password <a href="'.$uri.'/reset.php?token='.$token.'">Reset Password</a></p>

</body>
</html>
';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: Admin<webmaster@example.com>' . "\r\n";
$headers .= 'Cc: Admin@example.com' . "\r\n";

if(mail($to,$subject,$message,$headers)){
	echo "We have sent the password reset link to your  email id <b>".$to."</b>"; 
}}

if(isset($_GET['email']))mailresetlink($email,$token);
4.)Change the password-When user clicks on password reset link ,first check if it is valid or not.If it is valid then start a session and ask for new password.
<?php
//file reset.php
//title:Build your own Forgot Password PHP Script
session_start();
$token=$_GET['token'];
include("settings.php");
connect();
if(!isset($_POST['password'])){
$q="select email from tokens where token='".$token."' and used=0";
$r=mysql_query($q);
while($row=mysql_fetch_array($r))
   {
$email=$row['email'];
   }
If ($email!=''){
          $_SESSION['email']=$email;
}
else die("Invalid link or Password already changed");}
$pass=$_POST['password'];
$email=$_SESSION['email'];
if(!isset($pass)){
echo '<form method="post">
enter your new password:<input type="password" name="password" />
<input type="submit" value="Change Password">
</form>
';}
if(isset($_POST['password'])&&isset($_SESSION['email']))
{
$q="update users set password='".md5($pass)."' where email='".$email."'";
$r=mysql_query($q);
if($r)mysql_query("update tokens set used=1 where token='".$token."'");echo "Your password is changed successfully";
if(!$r)echo "An error occurred";
	}
Continue Reading

Smarter Filtering Width And Height of Images

Whenever you upload an image using the WordPress media library and add this image to your post, WordPress will automatically add the image Width and Height attribute in the image element.
This is fine for most themes, but there are other times when you don't want WordPress to add these attributes. The benefit of not adding these attributes is that you can leave any sort of dimensions to the CSS.
If you want to remove these attributes from the image elements it can be done with a simple regular expression search and replace and attach this to two WordPress filters.
  • post_thumbnail_html - Filter any post thumbnails
  • image_send_to_editor - Filter the HTML when adding a image to the editor
Add the following code to remove the width and height attributes from the image elements.

add_filter( 'get_image_tag', 'remove_width_and_height_attribute', 10 );
add_filter( 'post_thumbnail_html', 'remove_width_and_height_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_and_height_attribute', 10 );
function remove_width_and_height_attribute( $html ) {
   return preg_replace( '/(height|width)="\d*"\s/', "", $html );
}
Continue Reading

PHP Script to Compress Folder

compress folder
Sometimes we need to compress entire folder including sub folders and files.To compress entire folder using ZipArchive() class you need to scan all folders and files.After assigning all files and folder in any variable you can easily add them to zip archive one by one.So here is the entire process to compress a folder containing sub-folders and files with PHP.
1.Choose path and output file name-Assign the relative path of folder which will be compressed in $folder variable and name of output folder in $zipvariable.
<?php
$folder="folder/";
$output="compressed.zip";
2.Create a ZipArchive object-Create an object say $zip of ZipArchive() class of PHP.
$zip = new ZipArchive();
3.Create a ZipArchive and open it-Create a new zip archive and open it.
if ($zip->open($output, ZIPARCHIVE::CREATE) !== TRUE) {
    die ("Unable to open Zip Archive ");
}
4.Read all files and folders-Read all files and folders of the directory and assign them into an array.
$all = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder));
5.Add files and folder to archive-Add each and every files and folders to archive.

foreach ($all as $f=>$value) {
	$zip->addFile(realpath($f), $f) or die ("ERROR: Unable to add file: $f");
}
6.Close archive-Close archive and free CPU resources.
$zip->close();
echo "Compressed Successfully";
?>
Here is the entire code to compress a folder containing sub-folders and files with PHP.
<?php
//file name:compress.php
//Title:How to compress a Folder containing Sub-Folders and Files with PHP
//Date:6-12-2012
$folder="path/";
$output="compressed.zip";
$zip = new ZipArchive();

if ($zip->open($output, ZIPARCHIVE::CREATE) !== TRUE) {
    die ("Unable to open Archirve");
}

$all= new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder));

foreach ($all as $f=>$value) {
	$zip->addFile(realpath($f), $f) or die ("ERROR: Unable to add file: $f");
}
$zip->close();
echo "Compressed Successfully";
?>
Continue Reading

Difference Between Include Once and Require Once in PHP

One of the most common questions I get asked by PHP beginners is, Why is there 4 ways to include a file on your page?
There is include(), include_once(), require() and require_once().
What do these do? What's the difference between them?
In this article we're going to look at all these different functions and will talk about an example of when you need to use each of them.

PHP include Function

The include function is used in PHP when you want to include a file within the current process. It takes one argument which will be a string to the file path you want to include.
include 'main_page.php';
The code inside the included file will then run when the include function is called.
This can be used in a php templating system where you have a header at the top of the page and the header is going to be the same on all pages. You will put this code inside it's own file and use the include function to add the file to the page.

include 'header.php';
<div id="content">
</div>
include 'footer.php';
If the file that you want to include is not found then this function to return a PHP warning, which is different to the require function which will return a fatal error.
The file path given to the function can be either absolute starting with a / or relative by placing a .. before the file.

PHP include_once Function

The include_once function is exactly the same as the include function except it will limit the file to be used once.
include_once 'main_page.php';
The include function will allow you to include the same file multiple times so you can use it within a loop.
foreach($products as $product)
{
    // will display all products.php
    include 'product.php';
}
This will include the product.php file as many times as it loops through the $products array, but if this was using a include_once function it will only display the product.php file once.
foreach($products as $product)
{
    // will only display one product
    include_once 'product.php';
}
A more practical use of this function is if you define any functions in the included file to avoid redefinition of a function you should include it with a include_once.

PHP require Function

The require function acts just like the include function except if the file can not be found it will throw a PHP error. As the name suggests this file is required for the application to work correctly.
This will be a fatal error E_COMPILE_ERROR which will stop the application continuing, where the include function will just return a warning but will continue with the application.
The require function is used exactly the same as the include function.
require 'main_page.php';

PHP require_once Function

The last of the four functions is the require_once, which is a combination of the require and include_once function. It will make sure that the file exists before adding it to the page if it's not there it will throw a fatal error. Plus it will make sure that the file can only be used once on the page.
This function is the most strict out of the four functions and is the function I use most when constructing the page. Going back to the example used in the include function the require_once function is what you should use when displaying things like the website header and footer. This is because you always want these files to be here if they are not here you want the site to error, and you only want these to appear once on the page.
require_once 'header.php';
<div id="content">
</div>
require_once 'footer.php';
Continue Reading

Sign up form Code in PHP, jQuery and CSS3

PHP sign up form code

CSS

<link rel="stylesheet" type="text/css" href="demo.css" />

JQUERY

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

Javascript


<script type="text/javascript" src="script.js"></script>
Birthday html
<div class="input-container">
    <select name="month"><option value="0">Month:</option><?=generate_options(1,12,'callback_month')?></select>
    <select name="day"><option value="0">Day:</option><?=generate_options(1,31)?></select>
    <select name="year"><option value="0">Year:</option><?=generate_options(date('Y'),1900)?></select>
    </div>
Birthday PHP function
function generate_options($from,$to,$callback=false)
{
    $reverse=false;
    
    if($from>$to)
    {
        $tmp=$from;
        $from=$to;
        $to=$tmp;
        
        $reverse=true;
    }
    
    $return_string=array();
    for($i=$from;$i<=$to;$i++)
    {
        $return_string[]='
        
        ';
    }
    
    if($reverse)
    {
        $return_string=array_reverse($return_string);
    }
    
    
    return join('',$return_string);
}
function callback_month($month)
{
    return date('M',mktime(0,0,0,$month,1));
}
join(value,array) join function is use for join all array value to one, and separated by “value”
array_reverse() — Return an array with elements in reverse order

The last two styles are #loading and #error, which select the respective elements by their ID’s and hide them with visibility:hidden by default. We will only show them with jQuery when it is appropriate.
#loading{
    left:10px;
    position:relative;
    top:3px;
    visibility:hidden;
}
#error{
    background-color:#ffebe8;
    border:1px solid #dd3c10;
    padding:7px 3px;
    text-align:center;
    margin-top:10px;
    visibility:hidden;
}
javascript function for loading and error
atc=1 means visible
atc=0 means hide
function hideshow(el,act)
{
    if(act) $('#'+el).css('visibility','visible');
    else $('#'+el).css('visibility','hidden');
}
function error(act,txt)
{
    hideshow('error',act);
    if(txt) $('#error').html(txt);
}
JQUERY
e.preventDefault() cancel the event.
when submit happened, Jquery will run function register();
$(document).ready(function(){
    
    $('#regForm').submit(function(e) {
        register();
        e.preventDefault();
        
    });
    
});
The first lines of code in $(document).ready get executed after the page has loaded and bind our register() function with the form’s onsubmit event utilizing the preventDefault() method in order to stop the form from being submitted.

AJAX

The .serialize() method creates a text string in standard URL-encoded notation. It operates on a jQuery object representing a set of form elements. The form elements can be of several types.
The .serialize() method can act on a jQuery object that has selected individual form elements, such as input, textarea, and select. However, it is typically easier to select the form tag itself for serialization.
json file format:
{
“one”: “Singular sensation”,
“two”: “Beady little eyes”,
“three”: “Little birds pitch by my doorstep”
}
function register()
{
    hideshow('loading',1);
    error(0);
    
    $.ajax({
        type: "POST",
        url: "submit.php",
        data: $('#regForm').serialize(),
        dataType: "json",
        success: function(msg){
            
            if(parseInt(msg.status)==1)
            {
                window.location=msg.txt;
            }
            else if(parseInt(msg.status)==0)
            {
                error(1,msg.txt);
            }
            
            hideshow('loading',0);
        }
    });
}
And here is the simplicity of the $.ajax method – in a few lines of code we send to submit.php by POST all of regForm‘s fields (regForm is the ID of our registration form). We receive a response in JSON format (for more on that later) which gets processed by the function given in success. In this example we process the returned object and decide whether to show an error, or redirect to a registered-user-only page.
Continue Reading

User Registration And Login System Using PHP and Mysql

In this Blog I am going to explain you a complete PHP Registration, validation, Login and User Interface Script. This script is Complete in the sense that this will let you register and save those inputs to database table “user_signup”. Empty field validations, compare field validation, and username uniqueness script is implemented. Other validations can also be implemented easily.
Below are the features you can see in this script.
           Javascript validations are also done.
     Email confirmation script to confirm the email after successful user registration.
    User activation through email confirmation ( For this I have used : user_activation_code, user_account_status  columns in database)
   User Login script.
    User Interface with session implementation.
)        User Logout script to let destroy User Session and take him back to the login page.

The PHP pages I have created to implement above functionality are:
)      Index.php   --   links to signup.php and login.php pages

)      signup.php -- User Registration Form and complete registration code with javascript validations and PHP code validations. It also sends an email to the user emal id upon successful user registration


)      signup_success.php – redirects the user to this page after successful user registration.

)      email_conf.php – user opens there email ID account and click the confirmation link which they have received from us. Email_conf.php performs all the logic to implement the email confirmation and activates the user account. Now the user can login to their user account
)      login.php – This is the user’s login section to enter their login area. Here we create the SESSION variable and use it in user area to maintain the users identity in their respective user section.
)      user_home.php – after successful login user comes to user_home.php page. Here we maintain the user session.
)      logout_user.php – logout_user.php script let user to logout there user area and destroy the current user section.

Mysql Database table script: 
Table Nameuser_signup
CREATE TABLE IF NOT EXISTS `user_signup` (
  `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_name` varchar(50) NOT NULL,
  `user_full_name` varchar(50) NOT NULL,
  `user_email` varchar(50) NOT NULL,
  `user_password` varchar(50) NOT NULL,
  `user_address` varchar(50) NOT NULL,
  `user_phone` varchar(50) NOT NULL,
  `user_city` varchar(50) NOT NULL,
  `user_state` varchar(50) NOT NULL,
  `user_account_status` tinyint(4) DEFAULT '0',
  `user_activation_code` varchar(50) NOT NULL,
  `user_news_letter_status` tinyint(4) DEFAULT '0',
  `signup_date` datetime NOT NULL,
  PRIMARY KEY (`user_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
Index.php Script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

<body>

<a href="signup.php">Sign Up</a><br />

<a href="login.php">LogIn Section</a>

</body>

</html>



signup.php Script:

<?php
$error_list = "";
    if(isset($_POST['submitted']))
    {
        $errors = array();
       
         if (empty($_POST['user_name']))
         {
         $errors[] = 'You forgot to enter user name.';
         }
         else
         {
       
                 $user  = $_POST['user_name'];
       
                 require_once('includes/mysqli_connect.php');
               
                 mysql_select_db(DB_NAME, $dbc1);
               
                 $query = 'select * from user_signup where user_name="'. mysql_real_escape_string($user,$dbc1) .'"';
               
                 $result = mysql_query($query, $dbc1) or die(mysql_error($dbc1));
       
                     $available = false;
                   
                     if(mysql_num_rows($result)>0)
                     {
                   
                     $available = false;
                   
                   
                     }
                     else
                     {
                   
                        $available = true;
                     }
       
                     mysql_free_result($result);
                      
                      
                       if($available == true)
                       {
                        $user_name = trim($_POST['user_name']);
                       }else
                       {
                       $errors[] = 'Your username is already taken choose a different username';
                       }
               
               
               
         }
       
                
         if (empty($_POST['full_name']))
         {
         $errors[] = 'You forgot to enter your complete name.';
         }
         else
         {
         $full_name = trim($_POST['full_name']);
         }
       
                
         if (empty($_POST['user_email']))
         {
         $errors[] = 'You forgot to enter your email.';
         }
         else
         {
         $user_email = trim($_POST['user_email']);
         }
       
        // Check for a password and match against the confirmed password:
         if (!empty($_POST['user_pwd1']))
          {
             if ($_POST['user_pwd1'] != $_POST['user_pwd'])
             {
           
             $errors[] = 'Your password did not match the confirmed password.';
           
             }
             else
             {
             $user_pwd = trim($_POST['user_pwd1']);
             }
        }else
        {
             $errors[] = 'You forgot to enter your password.';
        }
 
        if (empty($_POST['address']))
         {
          $errors[] = 'You Forget to enter your Address';
         }
         else
         {
         $address = trim($_POST['address']);
         }
         if (empty($_POST['phone_no']))
         {
          $errors[] = 'Please enter your Phone no';
         }
         else
         {
         $phone_no = trim($_POST['phone_no']);
         }
       
         if (empty($_POST['city']))
         {
          $errors[] = 'Please mention your city';
         }
         else
         {
         $city = trim($_POST['city']);
         }
       
         if (empty($_POST['state']))
         {
         $errors[] = 'Please select your state';
         }
         else
         {
         $state = trim($_POST['state']);
         }
       
         if (empty($_POST['ck_newsletter']))
         {
         $ck_newsletter = 0;
         }
         else
         {
         $ck_newsletter = 1;
         }
       
         if(empty($errors))
         {
            
           
           
            require_once('includes/mysqli_connect.php');
           
            $act_code = mt_rand(). mt_rand() . mt_rand();
           
                $query = "INSERT into user_signup(user_name, user_full_name, user_email, user_password, user_address, user_phone, user_city, user_state, user_account_status, user_activation_code, user_news_letter_status,signup_date)values('$user_name', '$full_name', '$user_email',     PASSWORD('$user_pwd'),'$address','$phone_no', '$city','$state',0, '$act_code', $ck_newsletter, NOW() )";
               
                $result = @mysqli_query($dbc, $query); //or die(@mysqli_error('problem in query'));
               
                if($result)
                {
               
                        $to  = $user_email;
                        $subject = 'Account activation mail';
                                               
                        $headers = "From: " . strip_tags('donotreply@mohitsharma.com') . "\r\n";
                        $headers .= "Reply-To: ". strip_tags('donotreply@mohitsharma.com') . "\r\n";
                        //$headers .= "CC: susan@example.com\r\n";
                        $headers .= "MIME-Version: 1.0\r\n";
                        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
                       
                        $message ='
                            <html>
                                <head>
                                <title>Account Activation Mail</title>
                                </head>
                                <body>
                                <p>Hi '.$full_name.', <br>
                                Thank you for Registration<br>

                                <p>Here is your Account Detail<br/>
                               
                                <table>
                                <tr>
                                <td>LoginId </td> <td>'.$user_name.'</td>
                                </tr>
                               
                                <tr>
                                <td>Password </td> <td>'.$user_pwd.'</td>
                                </tr>
                               
                                <tr>
                                <td>Email </td> <td>'.$user_email.'</td>
                                </tr>
                               
                                <tr>
                                <td>Phone </td> <td>'.$phone_no.'</td>
                                </tr>
                               
                               
                                </table>
                               
                                </p>
                                <P>Please Click the below link to confirm your email ID and to complete the fist account activation step <br/>
                                <a href="http://786info.net/signup1/email_conf.php?act_code='.$act_code.'">Confirm Email</a>
                                </p>
                                </body>
                            </html>';
                           
                            if (mail($to, $subject, $message, $headers))
                            {
                                  header('refresh: 3; URL=signup_success.php?');
                                  exit();
                            }
                            else
                            {
                              echo 'There was a problem sending the email.';
                            }
                           
                           
                                  exit();
                           
                } else
               
                {
                   
                      // If it did not run OK.
                   
                     // Public message:
                     echo '<h1>Error!</h1>
                     <p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>';
                   
                     // Debugging message:
                     echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $query .'</p>';

                }
               
                 mysqli_close($dbc); // Close the database connection.

                 // Include the footer and quit the script:
               
                 exit();                 
         }
         else
         {
         $error_list ='<span><h2>Please Fill Below mentioned Fields</h2><hr>
             <p class="error"><b>The following error(s) occurred:</b><br />';
       
             foreach ($errors as $msg)
             { // Print each error.
             $error_list.= " - $msg<br />\n";
             }
              $error_list .= "</span></p><hr>";
           
         } // error condition ends here*/
    } // submitted statement ends here
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="Stylesheet" href="style/style.css" />
    <title>Home Page</title>
<script LANGUAGE="JavaScript">
<!--

function ValidateForm(form){
    ErrorText= "";
    if (form.user_name.value == "") {ErrorText= "\nPlease enter your user name"}
    if (form.full_name.value == "") {ErrorText += "\nPlease enter your complete name"}

    if ((form.user_email.value == "" || form.user_email.value.indexOf('@', 0) == -1) || form.user_email.value.indexOf('.') == -1)
        {

        ErrorText+=     "\nPlease enter a proper value for your email"
       
        }
    if(form.user_pwd1.value == "" || (form.user_pwd1.value != form.user_pwd.value))
    {
    ErrorText +="\nYour Password does not matches the confirmed Password";
   
    }
   
    if(form.user_pwd1.value.length < 5){ ErrorText +="\nYour Password must be atleast 5 character long.";}
   
    if (form.phone_no.value == "") {ErrorText += "\nPlease enter your phone no"}
    if (form.city.value == "") {ErrorText += "\nPlease enter your city name"}
    if (form.state.value == "--Select--") {ErrorText += "\nPlease select your state"}
   
if (ErrorText!= "")
        {
        alert("Please check your Form submission mistakes :\n" + ErrorText);
        return false;
        }

       
        if (ErrorText= "") { form.submit() }
       
       
}

 -->
</script>



</head>
<body>
<div id="container">
  <!--Top menu starts here-->
  <!--Top menu ends here-->
  <!--image slider starts here-->
  <div id="middle">
      <div id="middleMain">
<div id="reg">
<div style="width:80%; color:#042976;"><h2>Joining Form</h2></div>
<div style="width:80%; color:#f55b07;"><sup>*</sup> Signed fields are mandatery, Please fill each and every below field with correct information</div>

<!--onsubmit="return ValidateForm(this)" -->

<?php echo $error_list; ?>

<center>
 <form name="form1" id="form1" method="post" action="signup.php" >
    <table width="auto;" cellpadding="2" cellspacing="3" class="style1">
        <tr>
            <td width="180px;">User Name<sup style="color:#f55b07;">*</sup></td>
          <td>
             <input id="user_name" name="user_name" type="text" value="" /><br /><br />
              <!-- <input type="button" onclick="validate();" value="Check Availability" />
              <div id="msg"></div> -->
              </td>
        </tr>
        <tr>
            <td>Your Complete Name <sup style="color:#f55b07;">*</sup><br />
          <!--<span style="font-size:x-small; color:#000000;"> (This must be your name, applicable in your bank account) </span> -->
                </td>
            <td>
                <input id="full_name" name="full_name" type="text" />
                </td>
        </tr>
        <tr>
            <td> Email <sup style="color:#f55b07;">*</sup>
                </td>
            <td>
                <input id="user_email" name="user_email" type="text" />
                </td>
        </tr>
        <tr>
            <td> Password <sup style="color:#f55b07;">*</sup>
                </td>
            <td>
                <input id="user_pwd" name="user_pwd" type="password" />
            </td>
        </tr>
        <tr>
            <td> Confirm Password <sup style="color:#f55b07;">*</sup>
                </td>
            <td>
               <input id="user_pwd1" name="user_pwd1" type="password" /><br />
          <span style="font-size:x-small; color:#000000;"> (Your Password must be 5 Characters long) </span>
                </td>
        </tr>
         <tr>
            <td> Address <br />
                </td>
            <td>
                <input id="address" name="address" type="text" maxlength="100" />
                </td>
        </tr>
        <tr>
            <td> Phone No. <br /><span style="font-size:x-small; color:#000000;"> (You may mention it later) </span>
                </td>
            <td>
                <input id="phone_no" name="phone_no" type="text" />
                </td>
        </tr>
        <tr>    <td> City </td> <td> <input id="city" name="city" type="text" /> </td>
        </tr>
        <tr>
            <td> State </td>
            <td> <select id="state" name="state">
            <option selected="selected" value="--Select--">--State--</option>
            <option value="Andhra Pradesh">Andhra Pradesh</option>
            <option value="Arunachal Pradesh">Arunachal Pradesh</option>
            <option value="Assam">Assam</option>
            <option value="Bihar">Bihar</option>
            <option value="Chhattisgarh">Chhattisgarh</option>
            <option value="Goa">Goa</option>
            <option value="Gujarat">Gujarat</option>
            <option value="Haryana">Haryana</option>
            <option value="Himachal Pradesh">Himachal Pradesh</option>
            <option value="Jammu and Kashmir">    Jammu and Kashmir</option>
            <option value="Jharkhand">Jharkhand</option>
            <option value="Karnataka">Karnataka</option>
            <option value="Kerala">Kerala</option>
            <option value="Madhya Pradesh">Madhya Pradesh</option>
            <option value="Maharashtra">Maharashtra</option>
            <option value="Manipur">Manipur</option>
            <option value="Meghalaya">Meghalaya</option>
            <option value="Mizoram">Mizoram</option>
            <option value="Nagaland">Nagaland</option>
            <option value="Orissa">Orissa</option>
            <option value="Punjab">Punjab</option>
            <option value="Rajasthan">Rajasthan</option>
            <option value="Sikkim">Sikkim</option>
            <option value="Tamil Nadu">Tamil Nadu</option>
            <option value="Tripura">Tripura</option>
            <option value="Uttaranchal">Uttaranchal</option>
            <option value="Uttar Pradesh">Uttar Pradesh</option>
            <option value="West Bengal">West Bengal</option>
            </select> </td>
        </tr>
        <tr>
            <td>&nbsp;
                </td>
            <td>
            <input name="ck_newsletter" type="checkbox" value="yes" checked align="absmiddle" />I want to receive newsletter. <br />
            <input name="ck_terms_cond" type="checkbox" value="Accept" checked align="absmiddle" />I Accept Terms and Conditions. <br />
                </td>
        </tr>
        <tr>
            <td>
                <input id="submitted" name="submitted" type="hidden" />
                </td>
            <td>
              <input name="submit" type="submit" value="submit"/>
                </td>
        </tr>
    </table>
    </form>
</center>
</div>
    </div>
  </div>
</div>
</body>
</html>
Continue Reading