Advertisement
alatoru

reg.php

Mar 19th, 2023 (edited)
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.05 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['name'])
  3.     && isset($_POST['password'])
  4.         && isset($_POST['password_two']))
  5.     {
  6.  
  7.     $name = $_POST['name'];
  8.     $name = stripslashes($name);
  9.     $name = trim($name);
  10.     $name = htmlspecialchars($name);
  11.  
  12.     $password = $_POST['password'];
  13.     $password = stripslashes($password);
  14.     $password = trim($password);
  15.     $password = htmlspecialchars($password);
  16.  
  17.     $password_two = $_POST['password_two'];
  18.     $password_two = stripslashes($password_two);
  19.     $password_two = trim($password_two);
  20.     $password_two = htmlspecialchars($password_two);
  21.  
  22.     if ($password != $password_two) {
  23.         echo 'Error: Password mismatch!';
  24.         echo "<script>setTimeout('location=document.location.href', 3000 )</script>";
  25.         die();
  26.     }
  27.    
  28.     include 'a_api.php';
  29.  
  30.     $result = $proxy->createAccountEx($name, $password, AccessLevel::User(), AccountStatus::Active(), $name, null);
  31.  
  32.     if ($result->isOk()) {
  33.             echo " Account successfully created!";
  34.             echo "<script>setTimeout('location=document.location.href', 3000 )</script>";
  35.     } else {
  36.             echo " Error: The account already exists!";
  37.             echo "<script>setTimeout('location=document.location.href', 3000 )</script>";
  38.             return false;
  39.         }
  40.     } else {
  41. ?>
  42. <form method="post" style="max-width:500px;margin:auto">
  43. <h2>Register Form</h2>
  44.  
  45. <div class="input-container">
  46.     <i class="fa fa-user icon"></i>
  47.     <input placeholder="Username" class="input-field" type="text" name="name" pattern="[A-Za-z0-9]{4,16}" required />
  48.   </div>
  49.  
  50.  
  51.   <div class="input-container">
  52.     <i class="fa fa-key icon"></i>
  53.     <input placeholder="Password" class="input-field" type="password" name="password" pattern="[A-Za-z0-9]{4,16}" required />
  54.   </div>
  55.  
  56.   <div class="input-container">
  57.     <i class="fa fa-key icon"></i>
  58.     <input placeholder="Confirm Password" class="input-field" type="password" name="password_two" pattern="[A-Za-z0-9]{4,16}" required />
  59.   </div>
  60.  
  61.   <div class="input-container">
  62.   <button type="submit" class="btn" value="Registration">Register</button>
  63.   </div>
  64.  
  65.     <p><a href="?change">Change Password Form!</a></p>
  66. </form>
  67. <?php
  68. }
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement