hello,

my sign in working fine..but not my logout and signin script...help please.

this is my logout script:
<?php
session_start();
session_unset();
session_destroy();
header("Location: index.php");

and my signin script:

  <?php
if (isset($_POST['login-submit'])) {

    require 'dbh.inc.php';

    $mailuid = $_POST['mailuid'];
    $password = $_POST['pwd'];

    if(empty($mailuid) || empty($password)) {

        header("Location: ../index.php?error=emptyfields");
        exit();
    }
    else{

        $sql = "SELECT * FROM users WHERE uidUsers=?; ";
        $stmt = mysqli_stmt_init($conn);

        if (!mysqli_stmt_prepare($stmt, $sql)) {
            header("Location: ../index.php?error=sqlerror");
            exit();
        }
        else{
            mysqli_stmt_bind_param($stmt, "s", $mailuid);
            mysqli_stmt_execute($stmt);
            $result = mysqli_stmt_get_result($stmt);

            if ($row = mysqli_fetch_assoc($result)) {
                $pwdCheck = password_verify($password, $row['pwdUsers']);
                if ($pwdCheck == flase) {
                    header("Location: ../index.php?error=wrongpassword");
                    exit();
                }
                else if($pwdCheck == true) {
                    session_start();
                    $_SESSION['userId'] = $row['idUsers'];
                    $_SESSION['userUid'] = $row['uidUsers'];

                    header("Location: index.php?login=success");
                    exit();
                }

                else{
                    header("Location: ../index.php?error=wrongpassword");
                    exit();
                }
            }
            else{
                header("Location: ../index.php?error=nouser");
            exit();
            }
        }
    }
}
else{
    header("Location: ../index.php");
        exit();
}

You need to use full path

   <?php
   session_start();
     session_unset();
     session_destroy();
     header("Location: https://www.google.com/page_name.php");
    ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.