title: dreamweaver php mysql + profile page
body: <p>hey guys i am creating a website with login and registration and profile page hat will be created by default as soon as the user register  in the form then log in these information will be displayed as a profile info in the profile page that is unique to each user. the username will specify each user and his profile page .these are some php files,
   anyone have an idea how to display the only the information that belong to the specified user and not all information of all  the users.  </p>
  
  <h1>registerForm.php</h1>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  
  
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Registration Page&lt;/title&gt;
  &lt;link href="style/stylesheet.css" rel="stylesheet" type="text/css" /&gt;
  
  &lt;/head&gt;
  
  &lt;?php require_once('header.php'); ?&gt;
  
  
  &lt;body&gt;
  
  &lt;h2 class="RegisterTitleForm"&gt;Registration Form&lt;/h2&gt;
  &lt;h3 class="requiredField"&gt;* Requierd Field!!&lt;/h3&gt;
  &lt;table width="280" border="0" align="center"&gt;
  &lt;form action="registerProcess.php" method="post" id="registerForm"&gt;
    &lt;tr&gt;
      &lt;input type="hidden" name="uid" id="uid" /&gt;
      &lt;td style="text-align: right"&gt;&lt;label for="firstname"&gt;&lt;span class="Fields"&gt;First Name&lt;/span&gt; &lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="firstname" id="firstname" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style="text-align: right"&gt;&lt;label for="lasttname" class="Fields"&gt;Last Name&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="lastname" id="lastname" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="birthdate"&gt;Birth Date&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="date" name="birthdate" value= "YYYY_MM_DD"  onfocus="if (this.value == 'YYYY_MM_DD') {this.value = '';}" onblur="if (this.value == '') {this.value = 'YYYY_MM_DD';}"  type="text" id="birthdate" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="phonenumber"&gt;Phone Number&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="tel" name="phonenumber" value="000-0-000 000" onfocus="if (this.value == '000-0-000 000') {this.value = '';}" onblur="if (this.value == '') {this.value = '000-0-000 000';}"  type="text"  id="phonenumber" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="gender"&gt;Gender &lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;
        &lt;label class="Fields"&gt;
          &lt;input type="radio" name="genderGroup" value="Male" id="genderGroup_male" /&gt;
          Male&lt;/label&gt;
        &lt;br /&gt;
        &lt;label class="Fields"&gt;
          &lt;input type="radio" name="genderGroup" value="Female" id="genderGroup_female" /&gt;
          Female&lt;/label&gt;
        &lt;br /&gt;
      &lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="country"&gt;Country&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;select name="country" id="country"&gt;&lt;option selected=&gt;please choose coutry&lt;option&gt;lebanon&lt;option&gt;Us&lt;option&gt;europe 
      &lt;/select&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="adress"&gt;Local Adress &lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="adress" id="adress" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="specialisation"&gt;Specialisation &lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;select name="specialisation" id="specialisation"&gt;
      &lt;/select&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="email"&gt;Email Adress&lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="email" name="email" id="email" /&gt;&lt;/td&gt;
  &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="username"&gt;User Name&lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;/td&gt;
  &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="password"&gt;Password&lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="password" name="password" id="password" /&gt;&lt;/td&gt;
  &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class="Fields" style="text-align: right"&gt;&lt;label for="password2"&gt;Re_Password&lt;span class="requiredField"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="password" name="password2" id="password2" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" name="register" id="register" value="Register" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/form&gt;
  &lt;/table&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h1>registerprocess.php</h1>
  
  <pre><code>&lt;?php
    require_once('config.php'); 
  
    if(isset($_POST['register']))
  {
    if(! get_magic_quotes_gpc() )
    {
     $firstname = addslashes ($_POST['firstname']);
     $lastname = addslashes ($_POST['lastname']);
     $birthdate = addslashes ($_POST['birthdate']);
     $phonenumber = addslashes ($_POST['phonenumber']);
     $genderGroup = addslashes ($_POST['genderGroup']);
     $country = addslashes ($_POST['country']);
     $adress = addslashes ($_POST['adress']);
     $specialisation = addslashes ($_POST['specialisation']);
     $email = addslashes ($_POST['email']);
     $password2 = addslashes ($_POST['password2']);
     $username = addslashes ($_POST['username']);
     $password = addslashes ($_POST['password']);
     $password2 = addslashes ($_POST['password2']);
    }
    else
    {
     $firstname = $_POST['firstname'];
     $lastname = $_POST['lastname'];
     $birthdate = $_POST['birthdate'];
     $phonenumber = $_POST['phonenumber'];
     $genderGroup = $_POST['genderGroup'];
     $country = $_POST['country'];
     $adress = $_POST['adress'];
     $specialisation = $_POST['specialisation'];
     $email = $_POST['email'];
     $username = $_POST['username'];
     $password = $_POST['password'];
     $password2 = $_POST['password2'];
  
    }
  
  
    $sql = "INSERT INTO users ".
         "(firstname,lastname, birthdate, phonenumber, gender, country, localadress, specialisation, email, username, password, password2, joindate) ".      "VALUES('$firstname','$lastname','$birthdate','$phonenumber','$genderGroup','$country','$adress','$specialisation','$email','$username','$password','$password2', NOW())";
  
    $retval = mysql_query( $sql, $conn );
    if(! $retval )
    {
     die('Could not enter data: ' . mysql_error());
    }
    echo "Entered data successfully\n";
  
  }
    mysql_close($conn);
  ?&gt;
  </code></pre>
  
  <h1>loginForm.php</h1>
  
  <pre><code>        &lt;?php require_once('Connections/conn.php'); ?&gt;
          &lt;?php
          if (!function_exists("GetSQLValueString")) {
          function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
          {
            if (PHP_VERSION &lt; 6) {
              $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
            }
  
            $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
            switch ($theType) {
              case "text":
                $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                break;    
              case "long":
              case "int":
                $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                break;
              case "double":
                $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                break;
              case "date":
                $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                break;
              case "defined":
                $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                break;
            }
            return $theValue;
          }
          }
          ?&gt;
          &lt;?php
          // *** Validate request to login to this site.
          if (!isset($_SESSION)) {
            session_start();
          }
  
          $loginFormAction = $_SERVER['PHP_SELF'];
          if (isset($_GET['accesscheck'])) {
            $_SESSION['PrevUrl'] = $_GET['accesscheck'];
          }
  
          if (isset($_POST['username'])) {
            $loginUsername=$_POST['username'];
            $password=$_POST['password'];
            $MM_fldUserAuthorization = "";
            $MM_redirectLoginSuccess = "profileForm.php";
            $MM_redirectLoginFailed = "registerForm.php";
            $MM_redirecttoReferrer = false;
            mysql_select_db($database_conn, $conn);
  
            $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
              GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
  
            $LoginRS = mysql_query($LoginRS__query, $conn) or die(mysql_error());
            $loginFoundUser = mysql_num_rows($LoginRS);
            if ($loginFoundUser) {
               $loginStrGroup = "";
  
              if (PHP_VERSION &gt;= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
              //declare two session variables and assign them
              $_SESSION['MM_Username'] = $loginUsername;
              $_SESSION['MM_UserGroup'] = $loginStrGroup;       
  
              if (isset($_SESSION['PrevUrl']) &amp;&amp; false) {
                $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
              }
              header("Location: " . $MM_redirectLoginSuccess );
            }
            else {
              header("Location: ". $MM_redirectLoginFailed );
            }
          }
          ?&gt;
          &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
          &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
          &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
          &lt;title&gt;Untitled Document&lt;/title&gt;
          &lt;/head&gt;
          &lt;!--link CSS--&gt;
          &lt;link href="style/stylesheet.css" rel="stylesheet" type="text/css" /&gt;
  
          &lt;body&gt;
          &lt;!--&lt;?php require_once('header.php'); ?&gt;--&gt;
                &lt;div  id="loginForm"&gt;&lt;table width="250" border="0" align="right"&gt;
            &lt;form id="loginForm" name="loginForm" method="POST" action="&lt;?php echo 
  
  $loginFormAction; ?&gt;"&gt;
              &lt;tr&gt;
                &lt;td&gt;&lt;label for="username"&gt;User Name&lt;/label&gt;&lt;/td&gt;
                &lt;td&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td&gt;&lt;label for="password"&gt;Password&lt;/label&gt;&lt;/td&gt;
                &lt;td&gt;&lt;input type="text" name="password" id="password" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                &lt;td bgcolor="#FFFFFF"&gt;&lt;input type="submit" name="login" id="login" value="Log In" /&gt;
                  &lt;a href="registerForm.php"&gt;&lt;strong&gt; Register&lt;/strong&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;/form&gt;
          &lt;/table&gt; 
          &lt;/div&gt;
          &lt;?php require_once('footer.php'); ?&gt;
          &lt;/body&gt;
          &lt;/html&gt;
  </code></pre>
  
  <h1>profileForm.php</h1>
  
  <p>
      
      
      
      Profile Page
      </p>
  
  <pre><code>&lt;body&gt;
  
  &lt;?php require_once('header.php'); ?&gt;
  
  
      &lt;?php
      $con = mysql_connect("localhost","root","root");
      if(!$con)
      {
      die('Could not connect: '.mysql_error());
      }
      mysql_select_db("testregister",$con);
  
      $username =(isset($_POST['username']));
  
      $result =mysql_query("Select * from users");
  
      while ($row=mysql_fetch_array($result))
      {
      echo "&lt;table border='0'&gt;
      &lt;tr&gt;
      &lt;td&gt; First Name: &lt;/td&gt;
      &lt;td&gt;" .$row['firstname'] ." &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt; Last Name: &lt;/td&gt;
      &lt;td&gt;" .$row['lastname'] ." &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Birth Date: &lt;/td&gt;
      &lt;td&gt;".$row['birthdate'] ." &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Phone Number: &lt;/td&gt;
      &lt;td&gt; ".$row['phonenumber'] ." &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Gender: &lt;/td&gt;
      &lt;td&gt; ".$row['gender'] ." &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Country: &lt;/td&gt;
      &lt;td&gt;".$row['country'] ."&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Specialization: &lt;/td&gt;
      &lt;td&gt;".$row['specialisation'] ."&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Email: &lt;/td&gt;
      &lt;td&gt;".$row['email'] ."&lt;/td&gt;
      &lt;/tr&gt;
  
  
      &lt;tr&gt;
      &lt;td&gt; User Name: &lt;/td&gt;
      &lt;td&gt;".$row['username'] ."&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt; Join Date: &lt;/td&gt;
      &lt;td&gt;".$row['joindate'] ."&lt;/td&gt;
      &lt;/tr&gt;";
      }
      echo "&lt;/table&gt;";
  
  
      mysql_close ($con);
      ?&gt;
      &lt;html&gt;
      &lt;body&gt;
      Login Successful
      &lt;p&gt;&lt;a href="logout.php\"&gt;Click here to logout!&lt;/a&gt;&lt;/p&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  
  
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>