Guest User

Untitled

a guest
Mar 24th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. if($_SERVER["REQUEST_METHOD"] == "POST") {
  2. // username and password sent from form
  3.  
  4. if(isset($_POST['okbutton'])){
  5.  
  6. if( isset($_POST['clientuser'], $_POST['clientpass']) ) {
  7.  
  8. $clientuser = $_POST['clientuser'];
  9. $clientpass = $_POST['clientpass'];
  10.  
  11. $_SESSION['cuser'] = $clientuser;
  12. $_SESSION['cpass'] = $clientpass;
  13.  
  14. header('Location: trialaccount.php');
  15. die();
  16.  
  17. }
  18. }
  19. }
  20.  
  21. if(isset($_SESSION['cuser'])){
  22.  
  23. $stmt = $conn->prepare("SELECT user_id FROM user WHERE user_id=:username");
  24. $stmt->bindParam(':username', $_SESSION['cuser']);
  25. $stmt->execute();
  26.  
  27. $checkdup = $stmt->rowCount();
  28.  
  29. if($checkdup == 0){
  30.  
  31. $stmt = $conn->prepare("INSERT INTO user (user_id, user_pass, user_online, user_enable, user_start_date, user_end_date, reseller, type) VALUES (:clientuser, :clientpass,0, 1, now(), now() + interval 4 hour, :panelUSER, 'Trial')");
  32.  
  33. $stmt->bindParam(':clientuser', $_SESSION['cuser']);
  34. $stmt->bindParam(':clientpass', $_SESSION['cpass']);
  35. $stmt->bindParam(':panelUSER', $username);
  36. $stmt->execute();
  37.  
  38.  
  39. $success = "Trial Account Created Successfully!";
  40.  
  41. }
  42. else{
  43. $error = "Username '" . $_SESSION['cuser'] . "' is already taken. Try to input unique username." ;
  44. }
  45.  
  46. }
  47. catch(PDOException $e)
  48. {
  49. echo "Error: Database Error";
  50. }
  51.  
  52. <?php if(isset($success)){ echo $success; } ?>
Add Comment
Please, Sign In to add comment