Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once '../../dbconfig.php';
- require_once '../mail/send_mail.php';
- $result=[];
- if(empty($_POST['verify_id']) && empty($_POST['code']))
- {
- $result['success']=false;
- $result['error_msg']="codici non ricevuti";
- //$user->redirect('index.php');
- }
- if(isset($_POST['verify_id']) && isset($_POST['code']))
- {
- $id = base64_decode($_POST['verify_id']);
- $code = $_POST['code'];
- $statusY = "Y";
- $statusN = "N";
- $stmt = $db_con->prepare("SELECT user_id,userStatus FROM tbl_users WHERE user_id=:uID AND tokenCode=:code LIMIT 1");
- $stmt->execute(array(":uID"=>$id,":code"=>$code));
- $row=$stmt->fetch(PDO::FETCH_ASSOC);
- if($stmt->rowCount() > 0)
- {
- $result["success"]=true;
- if($row['userStatus']==$statusN)
- {
- $stmt = $db_con->prepare("UPDATE tbl_users SET userStatus=:status WHERE user_id=:uID");
- $stmt->bindparam(":status",$statusY);
- $stmt->bindparam(":uID",$id);
- $stmt->execute();
- $msg = "
- <div class='alert alert-success'>
- <button class='close' data-dismiss='alert'>×</button>
- <strong>WoW !</strong> Il vostro account è attivo : <a href='../../index.html'>Login here</a>
- </div>
- ";
- $result['success_msg']=$msg;
- }
- else
- {
- $result['success']=false;
- $msg = "
- <div class='alert alert-error'>
- <button class='close' data-dismiss='alert'>×</button>
- <strong>sorry !</strong> Il vostro account è già attivo : <a href='../../index.html'>Login here</a>
- </div>
- ";
- $result['error_msg']=$msg;
- }
- }
- else
- {
- $result['success']=false;
- $msg = "
- <div class='alert alert-error'>
- <button class='close' data-dismiss='alert'>×</button>
- <strong>sorry !</strong> Account non trovato : <a href='../../subscribe.html'>Signup here</a>
- </div>
- ";
- $result['id']=$id;
- $result['error_msg']=$msg;
- }
- }
- echo json_encode($result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment