Advertisement
neal777

Register

Oct 19th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.25 KB | None | 0 0
  1. <?php
  2.    include('config.php');
  3. if($_SERVER["REQUEST_METHOD"]== "POST"){
  4.     $myusername = mysqli_real_escape_string($db,$_POST['username']);
  5.     $mypassword = mysqli_real_escape_string($db,$_POST['password']);
  6.     $myemail = mysqli_real_escape_string($db,$_POST['email']);
  7.    
  8.     $validation = "SELECT username FROM carpool_ WHERE username = '$myusername'";
  9.     $validResult = mysqli_query($db,$validation);
  10.     $validCount = mysqli_num_rows($validResult);
  11.    
  12.     if ($validCount != 1){
  13.     $sql = "INSERT INTO carpool_ (username, password, email) VALUES ('$myusername', '$mypassword' , '$myemail' )";
  14.       $result = mysqli_query($db,$sql);
  15.     }else{
  16.         $duplicate =  "This username is already installed";
  17.     }
  18.    
  19.      
  20. }
  21. ?>
  22. <html>
  23.    
  24.    <head>
  25.       <title>Register</title>
  26.         <style type = "text/css">
  27.          body {
  28.             font-family:Arial, Helvetica, sans-serif;
  29.             font-size:14px;
  30.          }
  31.          
  32.          label {
  33.             font-weight:bold;
  34.             width:100px;
  35.             font-size:14px;
  36.          }
  37.          
  38.          .box {
  39.             border:#666666 solid 1px;
  40.          }
  41.       </style>
  42.    </head>
  43.     <body bgcolor = "#FFFFFF">
  44.    
  45.       <div align = "center">
  46.          <div style = "width:300px; border: solid 1px #333333; " align = "left">
  47.             <div style = "background-color:#333333; color:#FFFFFF; padding:3px;"><b>Register</b></div>
  48.                
  49.             <div style = "margin:30px">
  50.                
  51.                <form action = "" method = "post">
  52.                   <label>Username  :</label><br /><input type = "text" name = "username" class = "box" required/><br /><br />
  53.                   <label>Password  :</label><br /><input type = "password" name = "password" class = "box" pattern=".{8,16}" required title="8 to 16 characters"/><br/><br />
  54.                    <label>Email  :</label><br /><input type = "email" name = "email" class = "box" required/><br/><br />
  55.                    
  56.                   <input type = "submit" value = " Register   "/><br />
  57.                </form>
  58.                
  59.                <div style = "font-size:11px; color:#cc0000; margin-top:10px"></div>
  60.                    
  61.             </div>
  62.                
  63.          </div>
  64.            
  65.       </div>
  66.  
  67.    </body>
  68.    
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement