Jump to content

Recommended Posts

I am setting up a login for my website and I am very new to PHP coding. The script lets me login, and brings me to the logged in page. I want it to bring up the logged in page and then open a new page at another URL. How can I do this. Here is the code I need to change, but im not sure what to put in to have it open another page in a new window. also the second set of code is for the logout button. How do I get it to do the same thing as clicking logout by just closing the browser.

 

functions.inc.php:

<?php

function show_userbox()
{
    // retrieve the session information
    $u = $_SESSION['username'];
    $uid = $_SESSION['loginid'];
    // display the user box
    echo "<div id='userbox'>
         Welcome $u
                <ul>
                   <li><a href='/RRP/index.html'> Please Click Here To enter E-Learning</a></li>
                   <li><a href='./logout.php'>You Must Click Logout Here</a></li>
                </ul>
             </div>";

}
?>


Logout.php:

 

<?php
session_start();
if( session_unregister('loginid') == true
                && session_unregister('username')==true ) {
   header('Location: index.php');
   session_destroy();
} else {
   unset($_SESSION['loginid']);
   unset($_SESSION['username']);
   session_destroy();
   header('Location: index.php');
}

 

Please. any help would be great.

 

Thank You.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/228727-php-codeing-problems/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.