Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8166387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:50:51+00:00 2026-06-06T19:50:51+00:00

i build a website and it has a sign in form, when user sign

  • 0

i build a website and it has a sign in form, when user sign in, the sign in form will not appear, and a sign out will apprear instead

my problem is when the user sign out the session doesn’t destroy

when user sign in , i got to the function run, when user sign out i go to the function sign out

HTML

<?php
        Session::init();
        $l = Session::get('loggedIn');
        if (isset($l) && $l==true) {
                ?>
        <a href="<?php echo URL; ?>login/signout" class="smallLink">sign out</a>
            <?php

        } else {
            ?>
            <a href="login/run">Sign in</a>
            <br/>
            <form action="<?php echo URL;?>login/run" method="POST">
                <div class="staticSignin">
                    phoneNumber
                    password
                </div>
                <div id="userInputSignin">
                    <input type="text" name="MNumber"/>
                    <input type="password" name="password"/>
                    <input type="image" src="http://localhost/Mar7ba/public/images/signinButton.png"/>
                </div>
            </form>
            <?php
        }
        ?>

run for sign in

Session::init();
            $row = $sth->fetch();
            $ID = $row['ID'];
            $rollID = $row['rollID'];
            Session::set('loggedIn', true);
            Session::set('ID', $ID);
            Session::set('roolOfUser', $rollID);

sign out

 public function signout() {
        Session::set("loggedIn", false);
        Session::destroy();
        $this->view->render('index/index');
    }

Session Class

<?php

class Session {

    public static function init() {
        session_start();
    }

    public static function set($key, $value) {

        @$_SESSION[$key] = $value;
    }

    public static function get($key) {
        if (isset($_SESSION[$key]))
            return $_SESSION[$key];
    }

    public static function destroy() {
        unset ($_SESSION);
        session_destroy();
    }

}

when sign out , the sign in form doesn’t appear

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:50:53+00:00Added an answer on June 6, 2026 at 7:50 pm

    To destroy a session you need first to start it using session_start(), seems that you aren’t doing this

    Try to do it:

    session_start();
    
    // Deleting all content in $_SESSION
    $_SESSION = array();
    
    // Destroying the session
    session_destroy();
    

    EDIT 1

    Try to do these changes in destroy() to test if the session is really being started:

    public static function destroy() {
    
        session_start();
    
        // Deleting all content in $_SESSION
        $_SESSION = array();
    
        // Destroying the session
        session_destroy();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I build a website focussing on loading only data that has to be loaded.
I'm trying to build a website that has a Member section, and I'm struggling
we have a big community website build in drupal, where the site has a
I'm looking to build a website that has a flash interface and allows visitors
i build a new website.but the host is in USA.i am not in USA.
I would like to build a website that has some elements of a social
I am helping my daughter build an asp.net website that has an Access database.
I have to build a News based website but I am not sure whether
I need to build a website which will be viewed inside a FileMaker Pro
I'm going to build a Classic Music website and the client already has several

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.