Tuesday 2 June 2015

PHP assignment.... PHP Login & reristration management system

(1).-----reg.php----

 <?php
   session_start();
  ?> 
<html>
 <head>
  <title>home</title>
  <style type="text/css">
          body{background:aliceblue;
               }
          h1{color:orange;       
          
             }
          button{background:orange;
                       
            border-radius:11px 1px;
            color:white;
            padding:5px 5px;
          
                }  
          input#radius{border:1px solid tranparent;
      background:grey;         
            border-radius:10px;
   color:white;
   font:bold;
          }
  
  
   </style>
  
 </head>
 <body>
  <form action="inprocess.php" method="post">
 <center><h1>Welcome to our sign up page</h1>
     <table border="0"cellspacing="5"cellpadding="5"width="400">
  <tr>
     <td>User Name:</td> 

            <td><input id="radius"type="text" name="username"/></td>
   
    </tr>
    <tr>
     <td>First Name:</td> 

            <td><input id="radius"type="text" name="firstname"/></td>
   
    </tr>
    <tr>
     <td>Last Name:</td>
   <td><input id="radius"type="text" name="lastname"/></td>
   
    </tr>
    <tr>
     <td>Your Email:</td> 

   <td><input id="radius" type="text" name="mail"/></td>
   
    </tr>
    <tr>
     <td>Password:</td>
   <td><input id="radius"type="password" name="pass"/></td>
   
    </tr>
          <tr>
     <td> Confirm Password:</td>
   <td><input id="radius"type="password" name="confirmpass"/></td>
   
    </tr>
          <tr>
     <td colspan="2" align="center"><button type="submit">Sign up</td>
   
   
    </tr>
  
  
  
        </center>
      </form>
 </body>
</html>

----End of Registration page----

(2). ---inprocess.php---

<?php
  session_start();
  //type lessing..........
     $s =& $_SESSION; 
     $p =& $_POST;
  //start to process
       $s["reginame"]= $p["username"];
    $s["regipass"]=$p["password"];
    
    if( $p["pass"] == $p["confirmpass"] ):
           print "Your Account is succesfull...<br/>";
     print "Your name is ".$p["firstname"].$p["lastname"]."</br>";
     print "Your username is ".$p["username"]."</br>";
     print "Your name is ".$p["firstname"].$p["lastname"]."</br>";
     print "Your password is ".$p["[pass"]."</br>";
             include("login.php");
   endif;
       else {
          include("reg.php");
      echo "Password not a match";
    };
?> 
  
---End of inprocess---
(3).---login.php---
  <?php
  session_start();
  ?>

       <html>
  <title>home</title>
  <style type="text/css">
          body{background:aliceblue;
               }
          h1{color:orange;       
          
             }
          button{background:orange;
                       
            border-radius:11px 1px;
            color:white;
            padding:5px 5px;
          
                }  
          input#radius{border:1px solid tranparent;
      background:grey;         
            border-radius:10px;
   color:white;
   font:bold;
          }
  
  
   </style>
  
 </head>
 <body>
  <form action="home.php" method="post">
 <center><h1>Welcome to our login page</h1>
     <table border="0"cellspacing="5"cellpadding="5" width="400">
    <tr>
     <td>User Name:</td> 

            <td><input id="radius"type="text" name="logname"/></td>
   
   
   
    </tr>
    <tr>
     <td>Password:</td>
   <td><input id="radius"type="password" name="logpass"/></td>
   <tr>
     <tr>
     
   <td><input id="radius"type="checkbox" name="setcookie"/>Remember Me</td>
     <?php if(isset($_POST["setcookie"])) print "cheked";?>
   </tr>
          <tr>
     <td colspan="2" align="center"><button type="submit">login</td>
   
   
    </tr>
  
    
  
  
  
        </center>
      </form>
 </body>
</html>
  ---end of login page---

(4).---home.php---
<?php
   session_start();
     //type lessing..........
     $s =& $_SESSION; 
     $p =& $_POST;
  //start to process
     
 
if($p["logname"] == $s["reginame"]):
   
        if($p["logpass"] == $s["regipass"]):
             
              echo "Welcome  " . $s["reginame"] . "<br/>" ;
        endif;
   else{
             include("login.php");
                 echo "<br/> Password not match ";
        };
 
endif;
else{
     include("login.php");
     echo "<br/> Username not founded ,Please Try again.......";
};
 
?> 

Usage

Firstly You Have to create 1.(reg.php)
2.(inprocess.php)
3.(login.php)
4.(home.php)
 

0 comments:

Post a Comment