Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. // Retrieve username and password from database according to user's input, preventing sql injection
  2. $query ="SELECT * FROM affiliateuser WHERE (username = '" . mysqli_real_escape_string($con,$_POST['username']) . "') AND (password = '" . mysqli_real_escape_string($con,$_POST['password']) . "') AND (active = '" . mysqli_real_escape_string($con,"1") . "') AND (level = '" . mysqli_real_escape_string($con,"1") . "')";
  3. if ($stmt = mysqli_prepare($con, $query)) {
  4.  
  5. /* execute query */
  6. mysqli_stmt_execute($stmt);
  7.  
  8. /* store result */
  9. mysqli_stmt_store_result($stmt);
  10.  
  11. $num=mysqli_stmt_num_rows($stmt);
  12.  
  13. /* close statement */
  14. mysqli_stmt_close($stmt);
  15. }
  16. //mysqli_close($con);
  17. // Check username and password match
  18.  
  19. if (($num) == 1) {
  20.  
  21. $sqlquery11="SELECT expiry FROM affiliateuser where username = '$username'"; //fetching expiry date of username from table
  22. $rec211=mysqli_query($con,$sqlquery11);
  23. $row211 = mysqli_fetch_row($rec211);
  24. $expirydate=$row211[0]; //assigning expiry date
  25.  
  26. $curdate=date("Y-m-d");
  27. if($curdate > $expirydate)
  28. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement