PHP Session Validation Problem.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maddenuk
Forum Commoner
Posts: 27
Joined: Fri May 18, 2007 3:07 am

PHP Session Validation Problem.

Post by maddenuk »

I've done some validation which uses session to return the value of the class if there is a problem with a certain field. Currently all error messages are hidden by using CSS. However if there is an error then the user is returned to the form and the error message is displayed by changing the value of the Session value to error to display the message.

This currently isn't happening and i can't figure out why. Anybody able to point me in the right direction?

Thanks

Code: Select all

<?php 


class Tools 

{ 
    private $mMysqli; 
     
    //constructor opens database connection 
     
    function __construct() { 
     
    $this->mMysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE); 
     
    } 
     
    //destructor closes database connection 
     
    function __destruct() { 
     
    $this->mMysqli->close(); 
     
    } 
     
     
    public function ValidatePHP() 
    { 
     
     
        $errorsExist = 0; 
        $name = $_POST["txtName"]; 
        $house_number = $_POST["txtHouseNumber"]; 
        $street = $_POST["txtStreet"]; 
        $town = $_POST["txtTown"]; 
        $mobile = $_POST["txtMobile"]; 
        $city = $_POST["txtCity"]; 
        $country = $_POST["txtCountry"]; 
        $telephone = $_POST["txtTelephone"]; 
        $email = $_POST["txtEmail"]; 
        $postcode = $_POST["txtPostcode"]; 


        //clear the errors session flag 
        if (isset($_SESSION['errors'])) 
        unset($_SESSION['errors']); 
         
        //by default all fields are considered valid 
        $_SESSION['errors']['txtName'] = 'hidden'; 
        $_SESSION['errors']['txtHouseNumber'] = 'hidden'; 
        $_SESSION['errors']['txtStreet'] = 'hidden'; 
        $_SESSION['errors']['txtTown'] = 'hidden';         
        $_SESSION['errors']['txtMobile'] = 'hidden'; 
        $_SESSION['errors']['txtCity'] = 'hidden'; 
        $_SESSION['errors']['txtTelephone'] = 'hidden'; 
        $_SESSION['errors']['txtEmail'] = 'hidden'; 
        $_SESSION['errors']['txtMobile'] = 'hidden'; 
        $_SESSION['errors']['txtCountry'] = 'hidden'; 
         
         
                 
        if (!$this->validateName($_POST['txtName'])) 
        { 
            $_SESSION['errors']['txtName'] = 'error'; 
            $errorsExist = 1; 
        } 
         
        if (!$this->validateEmail($_POST['txtEmail'])) 
        { 
            $_SESSION['errors']['txtEmail'] = 'error'; 
            $errorsExist = 1; 
        } 
         
        if (!$this->validateTelephone($_POST['txtTelephone'])) 
        { 
            $_SESSION['errors']['txtTelephone'] = 'error'; 
            $errorsExist = 1; 
        } 
         
        if (!$this->validateMobile($_POST['txtMobile'])) 
        { 
            $_SESSION['errors']['txtMobile'] = 'error'; 
            $errorsExist = 1; 
        } 
         
        if (!$this->validateStreet($_POST['txtStreet'])) 
        { 
            $_SESSION['errors']['txtStreet'] = 'error'; 
            $errorsExist = 1; 
        } 
         
        if (!$this->validateHouseNumber($_POST['txtHouseNumber'])) 
        { 
            $_SESSION['errors']['txtHouseNumber'] = 'error'; 
            $errorsExist = 1; 
        } 
         
        if (!$this->validatePostcode($_POST['txtPostcode'])) 
        { 
            $_SESSION['errors']['txtPostcode'] = 'error'; 
            $errorsExist = 1; 
        } 
         
         
        if (!$this->validateCity($_POST['txtCity'])) 
        { 
            $_SESSION['errors']['txtCity'] = 'error'; 
            $errorsExist = 1; 
        } 
         
         
        if ($errorsExist == 0) 
        { 
         
        $this->register($name, $house_number, $street, $town, $city, $postcode, $country, $telephone, $mobile, $email); 
         
        } 
         
        else 
        { 
            foreach ($_POST as $key => $value) 
            { 
                $_SESSION['values'][$key] = $_POST[$key]; 
            } 
            return '../index.php?error=true'; 
        } 
     
     
    } 

     
     
    /* 
    * Function registers users values into database and sends off
    * an email to both the user and Core Telecom 
    */ 
    private function register($name, $house_number, $street, $town, $city, $postcode, $country, $telephone, $mobile, $email) 
    { 

    $query = $this->mMysqli->query("INSERT into requests VALUES (NULL,'$telephone', '$mobile' , '$email' , '', '$name','$house_number' , '$street', '$town', '$city', '$postcode', '$country')"); 
    $this->sendCoreEmail($email, $name, $telephone, $mobile); 
    $this->sendUserEmail($email, $name); 
    header('Location: http://www.waphoo.net'); 
     
     
    } 
     
     
    public function getAccounts() 
    { 
     
    $results = $this->mMysqli->query('SELECT * FROM requests ORDER BY ID DESC'); 
     
    if($this->mMysqli->affected_rows == 0) 
    { 
        echo '<p>There are currently no entries</p>'; 
    } 
     
    else   
    { 

        echo '<table border="0" cellpadding="0" cellspacing="0" class="indexTable sortable" id="indexTable">'; 
        echo '<tr> 
                <th scope="col">Name</th> 
                <th scope="col">Telephone</th> 
                <th scope="col">Mobile</th> 
                <th scope="col">Email</th> 
                <th colspan="2">Action</th>         
            </tr>'; 
         
    while ( $row = $results->fetch_array() ) 
    { 
        echo '<tr>'; 
        echo '<td>'.$row['5'].'</td>'; 
        echo '<td>'.$row['1'].'</td>'; 
        echo '<td>'.$row['2'].'</td>'; 
        echo '<td>'.$row['3'].'</td>'; 
     
     
       echo     "<td class=\"narrow\" width=\"200px\"><a href=\"javascript:BRB_PHP_DelWithCon('delete.php', 'id',".$row['0'].", 'Are you sure you want to delete this entry?');\">Delete</a></td>"; 
       echo  '<td class="narrow" width="200px"><a href="edit.php?id='.$row['0'].'">Update</a></td>'; 
       echo     '</tr>'; 
             
    } 
      echo '</table>'; 
             
     
    } 
} 
     
     
     
     
     
    public function editAccount($value) 
    { 
     
    $results = $this->mMysqli->query('SELECT * FROM requests '. 
                                        'WHERE id = "'.$value.'"'); 
                                         
    $row = $results->fetch_row(); 
     

    echo '<form method="post" action="update.php" enctype="application/x-www-form-urlencoded">'; 
     
    echo '<table border="0" cellpadding="0" cellspacing="0" class="indexTable sortable" id="indexTableEdit">'; 

    echo '<tr> 
           <td >Name</td><td>'.$row['5'].'</td> 
         </tr>'; 
     
    echo '<tr> 
           <td >House Number</td><td>'.$row['6'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >Street</td><td>'.$row['7'].'</td> 
         </tr>'; 
     
    echo '<tr> 
           <td >Town</td><td>'.$row['8'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >City</td><td>'.$row['9'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >Postcode</td><td>'.$row['10'].'</td> 
         </tr>'; 
     
    echo '<tr> 
           <td >Country</td><td>'.$row['11'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >Mobile</td><td>'.$row['2'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >Telephone</td><td>'.$row['1'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >Email</td><td>'.$row['3'].'</td> 
         </tr>'; 
         
    echo '<tr> 
           <td >Waphoo Number</td><td><input type="text" name="waphoo_number" value="'.$row['4'].'" /></td> 
         </tr>'; 
         
         
    echo '<tr> 
           <td colspan="2"> 
           <input type="hidden" value="'.$row['0'].'" name="id" /> 
           <input type="submit" name="submit" value="Update" /></td> 
         </tr>'; 


    echo '</table>'; 
     
    echo '</form>';     
     
     
    } 
     
     
     
     
     
     
     
     
    private function validateEmail($value) 
    { 
     
        return(!eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)*(\.[a-z]{2,3})$', $value)) ? 0 : 1; 
    } 
     
     
     
    private function validateTelephone($value) 
    { 
     
        return(!eregi('/^[0-9]+$/ ', $value)) ? 0 : 1; 
    } 
     
     
    private function validateMobile($value) 
    { 
     
        return(!eregi('/^[0-9]+$/ ', $value)) ? 0 : 1; 
    } 
     
     
     
     
    private function validateName($value) 
    { 
     
        $value = trim($value); 
         
        if($value) 
            return 1; 
            else 
            return 0; 
    } 
     
     
    private function validateStreet($value) 
    { 
     
        $value = trim($value); 
         
        if($value) 
            return 1; 
            else 
            return 0; 
    } 
     
     
    private function validateHouseNUmber($value) 
    { 
     
        $value = trim($value); 
         
        if($value) 
            return 1; 
            else 
            return 0; 
    } 
     
     
    private function validateCity($value) 
    { 
     
        $value = trim($value); 
         
        if($value) 
            return 1; 
            else 
            return 0; 
    } 
     
     
    private function validatePostcode($value) 
    { 
     
        $value = trim($value); 
         
        if($value) 
            return 1; 
            else 
            return 0; 
    } 
     
     
     

     
     
     
    private function validateNumberAvaliable($value) 
    { 
         
        $value = $this->mMysqli->real_escape_string(trim($value)); 
        if ($value == null) 
        return 0; 
         
        $query = $this->mMysqli->query('SELECT * FROM requests '. 
                                        'WHERE number = "'.$value.'"'); 
        if($this->mMysqli->affected_rows > 0) 
            return '1'; 
            else 
            return '0';         
     
    } 
     
     
    public function updateWaphooNumber($value, $value2) 
    { 
         
    /*if ($this->validateNumberAvaliable($value2) == 1) 
    { 
     
    header('Location: http://www.waphoo.net/admin/index.php?error=1');     
     
    } 
     
    else*/ 
     
    $results = $this->mMysqli->query("UPDATE requests SET number = '$value2'". 
                                        "WHERE id = '$value'");     
                                         
    $this->sendWaphooNumberConfirmationToUser($value); 
                                         
     
    header('Location: http://www.waphoo.net/admin/index.php'); 

     
     
    } 
     
     
     
     
    public function deleteAccount($value) 
    { 
     
     
    $results = $this->mMysqli->query("DELETE FROM requests WHERE id = '$value'");     
                                         
     
    header('Location: http://www.waphoo.net/admin/index.php');     
     
    } 
     

     
     
     
    private function sendCoreEmail($email, $name, $tele, $mobile) 
    { 
     
    $sender = 'Waphoo'; 
    $time_of_enquiry = date('r'); 
    $recipient = 'pt@leapfrogsolutions.co.uk'; 
    $headers = "MIME-Version: 1.0\n"; 
    $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; 
    $headers .= "X-Mailer: php\n"; 
    $headers .= 'From: Waphoo <'.$sender.'>'; 
    $subject = "Waphoo -  New Number Request"; 
    $mail = ' 
     
    A new user has requested for a number to be mapped at waphoo. 
     
    Name: '.$name.' 
    Email: '.$email.' 
    Telephone:'.$tele.' 
    Mobile: '.$mobile.' 
     
    To view information and send this user a number. Login to the Waphoo Control Panel. 
     
    http://www.waphoo.net/admin/ 
     
             
     
    Regards, 
    Waphoo 
         
             
            '; 
             
            $result = mail($recipient, $subject, $mail, $headers);
     
     
     
    } 
     
     
     
     
    private function sendUserEmail($email, $name) 
    { 
     
    $sender = 'Waphoo'; 
    $time_of_enquiry = date('r'); 
    $recipient = $email; 
    $headers = "MIME-Version: 1.0\n"; 
    $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; 
    $headers .= "X-Mailer: php\n"; 
    $headers .= 'From: Waphoo <'.$sender.'>'; 
    $subject = "Waphoo -  Your New Number Request"; 
    $mail = ' 
     
    Hello '.$name.' 
     
    Thanks for requesting your own personal international follow me telephone number. 
     
    A member of our team will be in touch within the next 24 hours to guide you through the setup and your number. 
             
     
    Regards, 
    Waphoo 
         
             
            '; 
             
            $result = mail($recipient, $subject, $mail, $headers);
     
     
     
    } 
     
     
     
    private function sendWaphooNumberConfirmationToUser($value) 
    { 
     
    $query = $this->mMysqli->query('SELECT * FROM requests '. 
                                        'WHERE id = "'.$value.'"'); 

    $row = $query->fetch_row(); 
     
    $sender = 'Waphoo'; 
    $time_of_enquiry = date('r'); 
    $recipient = $row['3']; 
    $headers = "MIME-Version: 1.0\n"; 
    $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; 
    $headers .= "X-Mailer: php\n"; 
    $headers .= 'From: Waphoo <'.$sender.'>'; 
    $subject = "Waphoo -  Your New Waphoo Number"; 
    $mail = ' 
     
    Hello '.$row['5'].' 
     
    Thanks for requesting your own personal international follow me telephone number. 
     
    Your Number has been mapped and your new follow me number is '.$row['4'].'. 
             
     
    Regards, 
    Waphoo 
         
             
            '; 
             
            $result = mail($recipient, $subject, $mail, $headers);
         
     
     
     
     
    } 
     
     
     
     
    } 

?>

Code: Select all

<?php 
ini_set('error_reporting',E_ALL); 
ini_set('display_errors','on'); 
require_once("classes/tools.class.php"); 
require_once("classes/validate_header.php"); 

if(!isset($_GET["errors"])) { 

    $_SESSION['errors']['txtName'] = 'hidden'; 
    $_SESSION['errors']['txtHouseNumber'] = 'hidden'; 
    $_SESSION['errors']['txtStreet'] = 'hidden'; 
    $_SESSION['errors']['txtTown'] = 'hidden'; 
    $_SESSION['errors']['txtCity'] = 'hidden'; 
    $_SESSION['errors']['txtPostcode'] = 'hidden'; 
    $_SESSION['errors']['txtEmail'] = 'hidden'; 
    $_SESSION['errors']['txtMobile'] = 'hidden'; 
    $_SESSION['errors']['txtTelephone'] = 'hidden'; 
} 

?> 

<!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" /> 
<link href="css/styles.css" rel="stylesheet" type="text/css" /> 
<link href="css/validate.css" rel="stylesheet" type="text/css" /> 
<title>Waphoo! - Map Your Mobile Number for Free International Calls</title> 
</head> 

<body> 
<div id="maincontainer"> 

    <div id="header"> 
     
    <div id="header-text"> 
    <p><strong>What Is Waphoo?</strong> Ever wanted your own exclusive International follow me mobile number which allows you to call abroad from your free inclusive mobile minutes or have your own exclusive 0844 number to make international calls abroad to all destinations* for a flat fee of 5p per minute to the most popular destinations for life*–we have the answer – Waphoo! You can have both
absolutely free.</p> 
        <p>&nbsp;</p> 
    <p><strong>How does Waphoo Work?</strong></p> 
<p>Waphoo is very simple to set up and it’s exclusively yours - Simply fill in the form below and we will do the rest. 

Please remember your mobile and landline number will be mapped to your free mobile and 0844 number and will only be able to access these via these phones. </p> 
     
    </div> 

    </div> 
     
     
    <div id="form-background"> 
    <form method="post" action="register.php" enctype="application/x-www-form-urlencoded"> 
    <table> 
        <tr> 
            <th colspan="2">Step One : Enter Your Address Details</th><th colspan="2">Step Two : Enter Your Contact Details</th> 
        </tr> 
        <tr> 
            <td width="157">Name</td><td width="221"><input type="text" name="txtName" id="txtName" value="<?php echo $_SESSION['values']['txtName'] ?>" /></td><td width="148">Telephone Number</td><td width="236"><input type="text" name="txtTelephone" id="txtTelephone" value="<?php echo $_SESSION['values']['txtTelephone'] ?>" /></td>     
        </tr> 
        <tr> 
              <td colspan="1"></td><td><span id="txtNameFailed" class="<?php echo $_SESSION['errors']['txtName'] ?>">You haven't entered your name.</span></td> 
            <td colspan="1"></td><td><span id="txtTelephoneFailed" class="<?php echo $_SESSION['errors']['txtTelephone'] ?>">You haven't entered a correct telephone Number.</span></td> 
          </tr> 
        <tr> 
            <td>House Number/Name</td><td><input type="text" name="txtHouseNumber" id="txtHouseNumber" value="<?php echo $_SESSION['values']['txtHouseNumber'] ?>"  /></td><td>Mobile Number</td><td><input type="text" name="txtMobile" id="txtMobile" value="<?php echo $_SESSION['values']['txtMobile'] ?>"  /></td>     
        </tr> 
        <tr> 
              <td colspan="1"></td><td><span id="txtHouseNumberFailed" class="<?php echo $_SESSION['errors']['txtHouseNumber'] ?>">You haven't entered your house number / name.</span></td> 
            <td colspan="1"></td><td><span id="txtMobileFailed" class="<?php echo $_SESSION['errors']['txtMobile'] ?>">You haven't entered a correct mobile number.</span></td> 
          </tr> 
        <tr> 
            <td>Street</td><td><input type="text" name="txtStreet" id="txtStreet" value="<?php echo $_SESSION['values']['txtStreet'] ?>" /></td><td>Email</td><td><input type="text" name="txtEmail" id="txtEmail" value="<?php echo $_SESSION['values']['txtEmail'] ?>" /></td>     
        </tr> 
        <tr> 
              <td colspan="1"></td><td><span id="txtStreetFailed" class="<?php echo $_SESSION['errors']['txtStreet'] ?>">You haven't entered your street address.</span></td> 
            <td colspan="1"></td><td><span id="txtEmailFailed" class="<?php echo $_SESSION['errors']['txtEmail'] ?>">You haven't entered a correct email address.</span></td> 
          </tr> 
        <tr> 
            <td>Town</td><td><input type="text" name="txtTown" id="txtTown" value="<?php echo $_SESSION['values']['txtTown'] ?>" /></td> 
            <td colspan="2" rowspan="3" valign="middle" class="form-text">After submitting your landline and mobile number we will send your access numbers and instructions.

The mobile service is only available to Orange, Virgin, Vodaphone & T-Mobile customers at the moment.</td>     
        </tr> 
        <tr> 
            <td>City</td><td><input type="text" name="txtCity" id="txtCity" value="<?php echo $_SESSION['values']['txtCity'] ?>" /></td> 
        </tr> 
        <tr> 
            <td colspan="1"></td><td><span id="txtCityFailed" class="<?php echo $_SESSION['errors']['txtCity'] ?>">You haven't entered the city you live in.</span></td> 
          </tr> 
        <tr> 
            <td>Postcode</td><td><input type="text" name="txtPostcode" id="txtPostcode" value="<?php echo $_SESSION['values']['txtPostcode'] ?>" /></td></tr> 
        <tr> 
              <td colspan="1"></td><td><span id="txtPostcodeFailed" class="<?php echo $_SESSION['errors']['txtPostcode'] ?>">You haven't entered a postcode</span></td> 
          </tr> 
        <tr> 
            <td>Country</td><td> 
            <select name="txtCountry" id="txtCountry"> 
                      <option selected="selected">United Kingdom </option> 
                    <option>Ireland </option> 
                    <option>United States of America </option> 
                    <option>Afghanistan </option> 
                    <option>Albania </option> 
                    <option>Algeria </option> 
                    <option>American Samoa </option> 
                    <option>Andorra </option> 
                    <option>Angola </option> 
                    <option>Anguilla </option> 
                    <option>Antarctica </option> 
                    <option>Antigua and Barbuda </option> 
                    <option>Argentina </option> 
                    <option>Armenia </option> 
                    <option >Aruba </option> 
                    <option>Australia </option> 
                    <option>Austria </option> 
                    <option >Azerbaijan </option> 
                    <option>Bahamas </option> 
                    <option>Bahrain </option> 
                    <option>Bangladesh </option> 
                    <option>Barbados </option> 
                    <option>Belarus </option> 
                    <option>Belgium </option> 
                    <option>Belize </option> 
                    <option>Benin </option> 
                    <option >Bermuda </option> 
                    <option>Bhutan </option> 
                    <option>Bolivia </option> 
                    <option>Bosnia and Herzegovina </option> 
                    <option>Botswana </option> 
                    <option  >Bouvet Island </option> 
                    <option>Brazil </option> 
                    <option>British Virgin Islands </option> 
                    <option>Brunei </option> 
                    <option  >Bulgaria </option> 
                    <option>Burkina Faso </option> 
                    <option>Burundi </option> 
                    <option>Cambodia </option> 
                    <option >Cameroon </option> 
                    <option>Canada </option> 
                    <option>Cape Verde </option> 
                    <option>Cayman Islands </option> 
                    <option>Central African Republic </option> 
                    <option  >Chad </option> 
                    <option>Chile </option> 
                    <option>China </option> 
                    <option>Christmas Island </option> 
                    <option>Cocos Islands </option> 
                    <option>Colombia </option> 
                    <option>Comoros </option> 
                    <option>Congo </option> 
                    <option>Cook Islands </option> 
                    <option  >Costa Rica </option> 
                    <option>Croatia </option> 
                    <option>Cuba </option> 
                    <option>Cyprus </option> 
                    <option>Czech Republic </option> 
                    <option>Denmark </option> 
                    <option>Djibouti </option> 
                    <option  >Dominica </option> 
                    <option>Dominican Republic </option> 
                    <option>Venezuela </option> 
                    <option>East Timor </option> 
                    <option>Ecuador </option> 
                    <option>Egypt </option> 
                    <option  >El Salvador </option> 
                    <option>Equatorial Guinea </option> 
                    <option>Eritrea </option> 
                    <option>Estonia </option> 
                    <option>Ethiopia </option> 
                    <option>Falkland Islands </option> 
                    <option  >Faroe Islands </option> 
                    <option>Fiji </option> 
                    <option>Finland </option> 
                    <option>France </option> 
                    <option>French Guiana </option> 
                    <option>French Polynesia </option> 
                    <option>Gabon </option> 
                    <option>Gambia </option> 
                    <option>Georgia </option> 
                    <option  >Germany </option> 
                    <option>Ghana </option> 
                    <option>Gibraltar </option> 
                    <option >Greece </option> 
                    <option>Greenland </option> 
                    <option>Grenada </option> 
                    <option>Guadeloupe </option> 
                    <option>Guam </option> 
                    <option>Guatemala </option> 
                    <option>Guinea </option> 
                    <option>Guinea-Bissau </option> 
                    <option>Guyana </option> 
                    <option>Haiti </option> 
                    <option value="hn" >Honduras </option> 
                    <option>Hong Kong </option> 
                    <option>Hungary </option> 
                    <option>Iceland </option> 
                    <option>India </option> 
                    <option>Indonesia </option> 
                    <option value="ir" >Iran </option> 
                    <option>Iraq </option> 
                    <option>Israel </option> 
                    <option>Italy </option> 
                    <option>Ivory Coast </option> 
                    <option>Jamaica </option> 
                    <option>Japan </option> 
                    <option>Jordan </option> 
                    <option>Kazakhstan </option> 
                    <option>Kenya </option> 
                    <option>Kiribati </option> 
                    <option>Korea, North </option> 
                    <option>Korea, North </option> 
                    <option>Kuwait </option> 
                    <option>Kyrgyzstan </option> 
                    <option>Laos </option> 
                    <option>Latvia </option> 
                    <option>Lebanon </option> 
                    <option>Lesotho </option> 
                    <option>Liberia </option> 
                    <option>Libya </option> 
                    <option>Liechtenstein </option> 
                    <option>Lithuania </option> 
                    <option>Luxembourg </option> 
                    <option>Macau </option> 
                    <option>Macedonia </option> 
                    <option>Madagascar </option> 
                    <option>Malawi </option> 
                    <option>Malaysia </option> 
                    <option>Maldives </option> 
                    <option>Mali </option> 
                    <option>Malta </option> 
                    <option>Marshall Islands </option> 
                    <option>Martinique </option> 
                    <option>Mauritania </option> 
                    <option>Mauritius </option> 
                    <option>Mayotte </option> 
                    <option>Mexico </option> 
                    <option>Micronesia </option> 
                    <option>Moldova </option> 
                    <option>Monaco </option> 
                    <option>Mongolia </option> 
                    <option>Montserrat </option> 
                    <option>Morocco </option> 
                    <option>Mozambique </option> 
                    <option>Myanmar </option> 
                    <option>Namibia </option> 
                    <option>Nauru </option> 
                    <option>Nepal </option> 
                    <option>Netherlands </option> 
                    <option>New Caledonia </option> 
                    <option>New Zealand </option> 
                    <option>Nicaragua </option> 
                    <option>Niger </option> 
                    <option>Nigeria </option> 
                    <option>Niue </option> 
                    <option>Norfolk Island </option> 
                    <option>Norway </option> 
                    <option>Oman </option> 
                    <option>Pakistan </option> 
                    <option>Palau </option> 
                    <option>Panama </option> 
                    <option>Papua New Guinea </option> 
                    <option>Paraguay </option> 
                    <option>Peru </option> 
                    <option>Philippines </option> 
                    <option>Pitcairn Island </option> 
                    <option>Poland </option> 
                    <option>Portugal </option> 
                    <option>Puerto Rico </option> 
                    <option>Qatar </option> 
                    <option>Reunion </option> 
                    <option>Romania </option> 
                    <option>Russia </option> 
                    <option>Rwanda </option> 
                    <option>Saint Kitts & Nevis </option> 
                    <option>Saint Lucia </option> 
                    <option>Samoa </option> 
                    <option>San Marino </option> 
                    <option>Sao Tome and Principe </option> 
                    <option>Saudi Arabia </option> 
                    <option>Senegal </option> 
                    <option>Seychelles </option> 
                    <option>Sierra Leone </option> 
                    <option>Singapore </option> 
                    <option>Slovakia </option> 
                    <option>Slovenia </option> 
                    <option>Somalia </option> 
                    <option>South Africa </option> 
                    <option>Spain </option> 
                    <option>Sri Lanka </option> 
                    <option>St. Helena </option> 
                    <option>Sudan </option> 
                    <option>Suriname </option> 
                    <option>Swaziland </option> 
                    <option>Sweden </option> 
                    <option>Switzerland </option> 
                    <option>Syria </option> 
                    <option>Taiwan </option> 
                    <option>Tajikistan </option> 
                    <option>Tanzania </option> 
                    <option>Thailand </option> 
                    <option>Togo </option> 
                    <option>Tokelau </option> 
                    <option>Tonga </option> 
                    <option>Trinidad and Tobago </option> 
                    <option>Tunisia </option> 
                    <option>Turkey </option> 
                    <option>Turkmenistan </option> 
                    <option>Tuvalu </option> 
                    <option>Uganda </option> 
                    <option>Ukraine </option> 
                    <option>United Arab Emirates </option> 
                    <option>Uruguay </option> 
                    <option>Uzbekistan </option> 
                    <option>Vanuatu </option> 
                    <option>Vatican City </option> 
                    <option>Vietnam </option> 
                    <option>Virgin Islands </option> 
                    <option>Western Sahara </option> 
                    <option>Yemen </option> 
                    <option>Yugoslavia (Former) </option> 
                    <option>Zaire </option> 
                    <option>Zambia </option> 
                    <option>Zimbabwe </option> 
                  </select></td><td></td><td> 
              <input type="image" src="images/complete-button.jpg" class="complete-button" /> 
              </td> 
        </tr> 
    </table> 
    </form> 
    </div> 
     
     
     
    <div id="footer"> 
         
    </div> 
</div> 
</body> 
</html>
Validate_header.php

Code: Select all

<?php 
session_start(); 

if (!isset($_SESSION['values'])) 
{ 
    $_SESSION['values']['txtName'] = ''; 
    $_SESSION['values']['txtHouseNumber'] = ''; 
    $_SESSION['values']['txtStreet'] = ''; 
    $_SESSION['values']['txtTown'] = ''; 
    $_SESSION['values']['txtCity'] = ''; 
    $_SESSION['values']['txtPostcode'] = ''; 
    $_SESSION['values']['txtEmail'] = ''; 
    $_SESSION['values']['txtMobile'] = ''; 
    $_SESSION['values']['txtTelephone'] = ''; 
} 

if (!isset($_SESSION['errors'])) 
{ 

    $_SESSION['errors']['txtName'] = 'hidden'; 
    $_SESSION['errors']['txtHouseNumber'] = 'hidden'; 
    $_SESSION['errors']['txtStreet'] = 'hidden'; 
    $_SESSION['errors']['txtTown'] = 'hidden'; 
    $_SESSION['errors']['txtCity'] = 'hidden'; 
    $_SESSION['errors']['txtPostcode'] = 'hidden'; 
    $_SESSION['errors']['txtEmail'] = 'hidden'; 
    $_SESSION['errors']['txtMobile'] = 'hidden'; 
    $_SESSION['errors']['txtTelephone'] = 'hidden'; 

} 

?>
Register.php

Code: Select all

<?php 
ini_set('error_reporting',E_ALL); 
ini_set('display_errors','on'); 
require_once("classes/tools.class.php"); 


$tools = new Tools(); 

header("Location:" . $tools->ValidatePHP()); 

?>
Post Reply