Guest User

Untitled

a guest
Dec 12th, 2017
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2. require_once('userClass.php');
  3. $userObj = new USER();
  4. session_start();
  5. $type = $_GET['type'];
  6.  
  7.  
  8. if(empty($type) || !isset($type)) {
  9.  
  10. echo 'Request type is not set';
  11.  
  12. } else if($type == 'signup') {
  13.  
  14. $data = USER::addNewUser($_REQUEST);
  15. $_SESSION = $data;
  16. if($data['status'] == 'error') {
  17. header("location:register.php");
  18. } else {
  19. header("location:index.php");
  20. }
  21. } else if($type == 'login') {
  22. $username = addslashes($_REQUEST['username']);
  23. $password = addslashes($_REQUEST['password']);
  24. $_SESSION = USER::login($username, $password);
  25. if($_SESSION['status'] == 'error') {
  26. header("location:index.php");
  27. }
  28. else {
  29.  
  30. header("location:profile.php");
  31.  
  32. }
  33. /*if($_SESSION['username'] == 'admin@admin.com') {
  34. header("location:admin.php");
  35. }
  36. else {
  37.  
  38. header("location:profile.php");
  39.  
  40. }*/
  41.  
  42.  
  43. } else if($type == 'logout') {
  44. unset($_SESSION);
  45. session_destroy();
  46. header("location:index.php");
  47. }
  48.  
  49.  
  50. ?>
Add Comment
Please, Sign In to add comment