Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Need advice

  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need advice

    this code does not seem to work. need advice. i have verified it does see the email and password and also connects to db.

    if(isset($_POST['email']) && !empty($_POST['email'])){

    if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
    $email=$_POST['email'];
    echo $email;
    }else{

    $email = false;
    $approve= false;
    }
    }

    if(isset($_POST['p']) && !empty($_POST['p'])){
    $pass= hash('sha512',$_POST['p']);
    echo $pass;
    }else{
    $pass=false;
    $approve= false;
    }


    if($email && $pass && $mysqli == true){

    if ($stmt = $mysqli->prepare("SELECT id, username, password, salt FROM members WHERE email = ? LIMIT 1")) {
    $stmt->bind_param('s', $email); // Bind "$email" to parameter.
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($user_id, $username, $db_password, $salt);
    $stmt->fetch();
    if($stmt->num_rows == 1) {
    echo 'yes';
    }

    }

    }


    thanks in advance

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,441
    Thanks
    274
    Thanked 32 Times in 31 Posts
    i didnt notice anything right off, but you have so many functions its hard to tell where something could be wrong. It could be in any function.

    Are you getting any errors, can you share the functions with us ?

    so you have checked the value of

    Code:
    $email && $pass && $mysqli
    And they all have the correct value?



    if they all have the correct value then the break in the code is after that i would think because it made it that far. So check your functions, db classes and such. You might try removing all the functions and code it freehand and see if it works, if it does then you know its your functions or classes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •