Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', '1');
- require_once ('DBBase.php');
- if(!isset($_GET["code"])) {
- echo("error");
- die("Ei koodia.");
- } else {
- $code = $_GET["code"];
- echo $code;
- }
- $inputusername = "pietu";
- $inputpassword = "jepjep";
- function updateCode($u) {
- $DB = new DBBase();
- $DB->update("users", array('userstate'), array('1'), "username = '" . $u . "'");
- echo "koodi vaihdettu";
- }
- function sendNotice($e) {
- $subject = "Palveluun aktivointi onnistui";
- $message = "Tervetuloa käyttämään palvelua, tilisi on nyt aktivoitu";
- $from = "testi@testi.com";
- $headers = "From: $from";
- mail($e,$subject,$message,$headers);
- }
- function checkVerification($c="", $iu="", $ip="") {
- $asd = new DBBase();
- $result = $asd->select("username, password, email", "users", "userstate = '" . $c . "'");
- while ($row = mysqli_fetch_object($result)) {
- $username = $row->username;
- $password = $row->password;
- $email = $row->email;
- echo $username;
- echo $password;
- }
- if ($ip == $password && $iu == $username) {
- updateCode($username);
- sendNotice($email);
- }
- else {
- echo "Väärä käyttäjätunnus ja/tai salasana";
- }
- }
- checkVerification($code, $inputusername, $inputpassword);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement