PHP Classes

File: changepass.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   PHP Mnemonic Secret Path Login   changepass.php   Download  
File: changepass.php
Role: Auxiliary script
Content type: text/plain
Description: auxilliary script
Class: PHP Mnemonic Secret Path Login
Detect human users telling to click on page places
Author: By
Last change:
Date: 6 years ago
Size: 961 bytes
 

Contents

Class file image Download
<?php
        session_start
();
        include_once
'config.php';
       
// include_once 'src/clicktoconnect.php';
       
if(isset($_POST["oldpassword"])&&isset($_POST["password"])&& !empty($_POST["password"])){
            if(
$_POST["oldpassword"]!=$_POST["password"]&& !empty($_POST["password"])){
                       
$req=$bdd->prepare('UPDATE users SET
                        password=:password
                        WHERE user_id=:user_id AND password=:oldpass'
);
                       
$req->bindValue(':user_id',$_SESSION["user_id"],PDO::PARAM_INT);
                       
$req->bindValue(':password',sha1(Salt.$_POST["password"].Salt),PDO::PARAM_STR);
                       
$req->bindValue(':oldpass',sha1(Salt.$_POST["oldpassword"].Salt),PDO::PARAM_STR);
                       
$req->execute();
                        if(
$req->rowCount()>0){
                            echo
'success';
                           
$req->CloseCursor();
                        }else{
                            echo
"Failed";
                           
$req->CloseCursor();
                        }
            }else{
                echo
"Password unchanged as you enter the same thing as the old one";
            }
        }else{
                echo
"Failed";
        }
?>