mercredi 27 septembre 2017

I am trying to use an if query in php to see wether the mysql search brings back any results any ideas on how to do this?

Currently this is what i am trying but cant get it to work, i have the code running on an xampp server linked to a mysql database through "db.php"

    <?php
    require 'db.php';
    session_start();

    $first_name = $_SESSION['first_name'];
    $last_name = $_SESSION['last_name'];
    $email = $_SESSION['email'];
    $active = $_SESSION['active'];
    if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['hash']) && !empty($_GET['hash']))
    {
        $email = $mysqli->escape_string($_GET['email']); 
        $hash = $mysqli->escape_string($_GET['hash']); 


    $mysqli->query("SELECT * FROM users WHERE email='$email' AND hash='$hash' AND active='1'");
        if (@@ROWCOUNT <> 1 ) {

            $_SESSION['message'] = "Account has already been activated";


            echo '<script type="text/javascript">
               window.location = "/html/rtl/profile.php"
          </script>';
        }
    }


    ?>

Aucun commentaire:

Enregistrer un commentaire