Guest User

Untitled

a guest
Jul 21st, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php
  2. // include_once ("include/Functions.php");
  3. include_once ("include/dbconnect.php");
  4. ?>
  5. <?
  6. function alertAndRedirect() {
  7.  
  8. ?>
  9. <script>
  10. <!--
  11. alert("You could not be logged in. Please ensure your password and user name are correct! Then try again.");
  12. location.href = "index.php";
  13. // -->
  14. </script>
  15. <?
  16. } // End Sub
  17.  
  18. setcookie("AuthorID", "");
  19. $UserName=$_REQUEST['UserName'];
  20. $UserPassword=$_REQUEST['UserPassword'];
  21. $query = "Select * from Author where Author_Username='" . $UserName . "'";
  22. $result = mysql_query($query) or die('<h3>Query failed: '.mysql_error().'</h3>');
  23. $TotRecords = mysql_num_rows($result);
  24. $row=$authorRS = mysql_fetch_array($result);
  25.  
  26. if ($TotRecords > 0) {
  27. setcookie("AuthorID",$row['idAuthor']);
  28. setcookie("UserName", $row['Author_UserName']);
  29. setcookie("UserPassword", $row['Author_Password']);
  30. $szUpdate = "Update Author Set Author_Last_Login = '" . date("r") . "' Where idAuthor=" . $row['idAuthor'];
  31. $Insert_Result = mysql_query($szUpdate) or die(mysql_error());
  32. $RedirectURL="/story/index.php";
  33. if ($_REQUEST['SourcePage'] !=""){
  34. $RedirectURL=$_REQUEST['SourcePage'];
  35. } // end if
  36. header("Location: " .$RedirectURL);
  37. } else {
  38. // alertAndRedirect();
  39. echo "<h1>Debug</h1>";
  40. echo "<p> Tot Records = " . $TotRecords;
  41. echo "<p> Result: ";
  42. print_r ($result);
  43. } // end if
  44. ?>
  45. <html>
  46. <head>
  47. <title>User Login</title>
  48. </head>
  49. <body>
  50. <?php
  51. include_once ("footer.php");
  52. ?>
  53. </body>
  54. </html>
Add Comment
Please, Sign In to add comment