Advertisement
Guest User

Untitled

a guest
May 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. /*
  3. This uses minimal checking and should have a preliminary user/pass check before the main query for extra security.
  4. Should include a die on the query submission to check if it worked.
  5. */
  6.  
  7. // Config Info
  8. $host = "localhost";
  9. $user = "root";
  10. $pass = "";
  11. $data = "main";
  12. $tabl = "users";
  13.  
  14. if(isset($_REQUEST['username'],$_REQUEST['password'])) {
  15.    // Get Info
  16.    $username = $_REQUEST['username'];
  17.    $password = $_REQUEST['password'];
  18.  
  19.    // Connect Database
  20.    $con = mysql_connect($host,$user, $pass); // Send Connection
  21.    if (!$con) die('Could not connect: ' . mysql_error()); // Could Not Connect
  22.    mysql_select_db($data, $con); // Select Database
  23.    $query = "UPDATE ".$tabl." SET group_id = '5' WHERE username = '".$username."' AND password = '".$password."'";
  24.    mysql_query($query);
  25.    mysql_close($con);
  26. }
  27. // Else not enough info
  28. ?>
  29.  
  30. <html>
  31. <body>
  32. <form method="get">
  33. Username:<br>
  34. <input name="username"><br>
  35. Password:<br>
  36. <input name="password"><br>
  37. <input type="submit">
  38. </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement