Jump to content

PHP codeing Problems


brainmltdwn

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.