Advertisement
Guest User

Untitled

a guest
Feb 15th, 2016
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.65 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.     <title>Sign Up!</title>
  5.    
  6.     <style>
  7.         body {
  8.             background-image: url("img/site/common/tile.jpg");
  9.             margin: 0;
  10.             padding: 0;
  11.         }
  12.  
  13.         #sign_up_form {
  14.             margin: 0 auto; /*to float in center*/
  15.             margin-top: 60px;
  16.       margin-bottom: 60px;
  17.             padding: 30px;
  18.            
  19.             border-radius: 10px;
  20.             border-style: solid;
  21.             border-color: rgb(255,154,104);
  22.  
  23.             width: 650px;
  24.             /*height: 500px;*/
  25.  
  26.             background-color: white;
  27.  
  28.             color: rgb(255,154,104);
  29.             font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  30.         }
  31.  
  32.     .warning {
  33.                 margin: 0;
  34.                 padding: 0;
  35.                 font-size: 15px;
  36.                 font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  37.                 color: red;
  38.                 display: inline;  
  39.             }
  40.     .alright {
  41.                 margin: 0;
  42.                 padding: 0;
  43.                 font-size: 15px;
  44.                 font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  45.                 color: green;  
  46.                 display: inline;
  47.             }
  48.  
  49.         h1 {
  50.             color: rgb(255,154,104);
  51.             font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  52.         }
  53.  
  54.         h3 {
  55.             color: rgb(255,154,104);
  56.             font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
  57.         }
  58.  
  59.         input[type=text]{
  60.                 border-radius: 10px;
  61.                 border-style: solid;
  62.                 border-color: rgb(255,154,104);
  63.                 color: rgb(171,171,171);
  64.                 font-style: italic;
  65.                 padding:8px;
  66.  
  67.                 width: 200px;
  68.          }
  69.  
  70.     input[type=password]{
  71.                 border-radius: 10px;
  72.                 border-style: solid;
  73.                 border-color: rgb(255,154,104);
  74.                 color: rgb(171,171,171);
  75.                 font-style: italic;
  76.                 padding:8px;
  77.  
  78.                 width: 200px;
  79.          }
  80.  
  81.          input[type=submit]{
  82.                 width: 84px;
  83.                 margin-top: 30px;
  84.                 border: none;
  85.                 border-radius: 10px;
  86.                 background-color: rgb(255,154,104);
  87.                 color: white;
  88.                 text-decoration-color: black;
  89.                 padding: 15px;
  90.                 cursor: pointer;
  91.             }
  92.  
  93.             input[type=submit]:hover{
  94.                 width: 84px;
  95.                 margin-top: 30px;
  96.                 border: none;
  97.                 border-radius: 10px;
  98.                 background-color: rgb(255,154,104);
  99.                 color: white;
  100.                 text-decoration-color: black;
  101.                 padding: 15px;
  102.                 cursor: pointer;
  103.             }
  104.    
  105.     /* Pulse effect */
  106.     @-webkit-keyframes pulse {
  107.      25% {
  108.       -webkit-transform: scale(1.2);
  109.       transform: scale(1.2);
  110.       }
  111.       75% {
  112.       -webkit-transform: scale(0.8);
  113.       transform: scale(0.8);
  114.       }
  115.     }
  116.     @keyframes pulse {
  117.       25% {
  118.      -webkit-transform: scale(1.2);
  119.      -ms-transform: scale(1.2);
  120.      transform: scale(1.2);
  121.      }
  122.     75% {
  123.     -webkit-transform: scale(0.8);
  124.     -ms-transform: scale(0.8);
  125.     transform: scale(0.8);
  126.     }
  127.   }
  128. .pulse {
  129.   display: inline-block;
  130.   -webkit-transform: translateZ(0);
  131.   -ms-transform: translateZ(0);
  132.   transform: translateZ(0);
  133.   box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  134. }
  135. .pulse:hover {
  136.   -webkit-animation-name: pulse;
  137.   animation-name: pulse;
  138.   -webkit-animation-duration: 1s;
  139.   animation-duration: 1s;
  140.   -webkit-animation-timing-function: linear;
  141.   animation-timing-function: linear;
  142.   -webkit-animation-iteration-count: infinite;
  143.   animation-iteration-count: infinite;
  144. }            
  145.  
  146.     </style>
  147. </head>
  148.  
  149. <body>
  150.     <!-- Sign up form -->
  151.     <div id="sign_up_form" >
  152.   <form name="form_sign_up" method="POST" action="sign_up.php" >
  153.  
  154.         <h1>Sign up @ Jhotika Barta</h1>
  155.         <h3>&#10004; It's free and always will be!</h3>
  156.         <br><br><br>
  157.  
  158.     <?php
  159.       // database connection
  160.       require 'jhotika_db_connection.php';
  161.     ?>
  162.  
  163.         Your name: <br>
  164.         <input type="text" name="first_name" placeholder="first name" required >
  165.         <input type="text" name="last_name" placeholder="last name" >
  166.     <?php
  167.       // checking if first name is entered
  168.       $input_first_name = '';
  169.       $input_last_name = '';
  170.       if( isset($_POST['sign_up_button']) ) {
  171.         $input_first_name = htmlentities($_POST['first_name']);
  172.         $input_last_name = htmlentities($_POST['last_name']);
  173.  
  174.         if( empty($input_first_name) ) {
  175.          echo '<p class="warning" >&#10008; First name required!</p>';  
  176.         } else {
  177.           echo '<p class="alright" >&#10004; </p>';  
  178.         }
  179.       }
  180.     ?>
  181.     <br>
  182.  
  183.         <br>
  184.  
  185.         Choose your user id: <br>
  186.         <input type="text" name="user_id" placeholder="example" required > @ jhotika.com
  187.     <?php
  188.       $input_user_id = '';
  189.       $user_id_taken = 0;
  190.       if( isset($_POST['sign_up_button']) ) {
  191.         $input_user_id = htmlentities($_POST[ 'user_id' ]);
  192.         if( !empty($input_user_id) ) {
  193.           //checking if user id is available
  194.           // query
  195.           $users_query_username="select * from users where user_id='".$input_user_id."'";
  196.           $result_table = mysql_query($users_query_username);
  197.           // checking if table has a row
  198.           if( $row=mysql_fetch_assoc($result_table) ) {
  199.             $user_id_taken = 1;
  200.             echo '<p class="warning" >&#10008; User id already taken!</p>';    
  201.           } else {
  202.             echo '<p class="alright" >&#10004;</p>';  
  203.           }
  204.         } else {
  205.           echo '<p class="warning" >&#10008; User id required!</p>';  
  206.         }
  207.       }
  208.     ?>
  209.     <br>
  210.  
  211.         <br>
  212.  
  213.     Enter your password: <br>
  214.     <input type="password" name="password" placeholder="password" required ><br>
  215.     <input style="margin-top:5px;" type="password" name="confirm_password" placeholder="confirm password" required >
  216.     <?php
  217.       $input_user_pass = '';
  218.       $input_user_pass_confirm = '';
  219.       $pass_dont_match = 0;
  220.       if( isset($_POST['sign_up_button']) ) {
  221.         $input_user_pass = htmlentities($_POST[ 'password' ]);
  222.         $input_user_pass_confirm = htmlentities($_POST[ 'confirm_password' ]);
  223.  
  224.         if( !empty($input_user_pass) ) {
  225.           if( $input_user_pass==$input_user_pass_confirm ) {
  226.             echo '<p class="alright" >&#10004;</p>';  
  227.           } else {
  228.             echo "<p class='warning' >&#10008; Passwords don't match</p>";  
  229.           }
  230.         } else {
  231.           echo "<p class='warning' >&#10008; Password required!</p>";  
  232.         }
  233.       }
  234.     ?>
  235.     <br>
  236.  
  237.     <br>
  238.  
  239.         <input type="checkbox" name="accept_terms"> I accept all the terms and agreements.
  240.     <?php
  241.       $terms_agree = 0;
  242.       if( isset($_POST['sign_up_button']) ) {
  243.         if(isset($_POST['accept_terms'])) {
  244.           $terms_agree = 1;
  245.         } else {
  246.           echo "<p class='warning' >&#10008; Accept terms and conditions!</p>";
  247.         }
  248.       }
  249.     ?>
  250.     <br>
  251.  
  252.         <!-- Submit button at the center of the page -->
  253.         <div style="text-align:center" >
  254.             <input class="pulse" type="submit" name="sign_up_button" value="SIGN UP" >
  255.         </div>
  256.     <?php
  257.       if( isset($_POST['sign_up_button']) && $user_id_taken==0 && $pass_dont_match==0 && $terms_agree==1 ) {
  258.         $add_query = "
  259.          insert into users ( user_id, password, first_name, last_name )
  260.          values ( '".$input_user_id."', '".$input_user_pass."', '".$input_first_name."', '".$input_last_name."' )
  261.        ";
  262.         mysql_query($add_query);
  263.         header('location: sign_up_success.php');
  264.       }
  265.     ?>
  266.  
  267.     </form>
  268.   </div>
  269. </body>
  270.  
  271. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement