Advertisement
Guest User

Untitled

a guest
May 5th, 2017
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ALL);
  4. ini_set('display_errors', '1');
  5.  
  6. require_once ('DBBase.php');
  7.  
  8. if(!isset($_GET["code"])) {
  9.     echo("error");
  10.     die("Ei koodia.");
  11. } else {
  12.     $code = $_GET["code"];
  13.     echo $code;
  14. }
  15.  
  16. $inputusername = "pietu";
  17. $inputpassword = "jepjep";
  18.  
  19. function updateCode($u) {
  20.     $DB = new DBBase();
  21.     $DB->update("users", array('userstate'), array('1'), "username = '" . $u . "'");
  22.     echo "koodi vaihdettu";
  23. }
  24.  
  25. function sendNotice($e) {
  26.     $subject = "Palveluun aktivointi onnistui";
  27.     $message = "Tervetuloa käyttämään palvelua, tilisi on nyt aktivoitu";
  28.     $from = "testi@testi.com";
  29.     $headers = "From: $from";
  30.     mail($e,$subject,$message,$headers);
  31. }
  32.  
  33. function checkVerification($c="", $iu="", $ip="") {
  34.    
  35.     $asd = new DBBase();
  36.     $result = $asd->select("username, password, email", "users", "userstate = '" . $c . "'");
  37.     while ($row = mysqli_fetch_object($result)) {
  38.         $username = $row->username;
  39.         $password = $row->password;
  40.         $email = $row->email;
  41.         echo $username;
  42.         echo $password;
  43.     }
  44.  
  45.     if ($ip == $password && $iu == $username) {
  46.         updateCode($username);
  47.         sendNotice($email);
  48.     }
  49.  
  50.     else {
  51.  
  52.         echo "Väärä käyttäjätunnus ja/tai salasana";
  53.  
  54.     }
  55.  
  56. }
  57.  
  58. checkVerification($code, $inputusername, $inputpassword);
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement