Dyno Posted April 20, 2007 Share Posted April 20, 2007 Hi, i'm looking for a Login Script Where On My Site i'll Have The Defualt Layout with Links on the left hand side. But if someone logs in it will give them extra links that only logged in members can see. right now i have my site integrated with phpBB so when they login. i'm just wondering if its easy to add extra links once there logged in. Thanks Dyno Link to comment https://forums.phpfreaks.com/topic/47926-looking-for-login-script/ Share on other sites More sharing options...
Dyno Posted April 21, 2007 Author Share Posted April 21, 2007 can someone please tell me if its possible i think it is Link to comment https://forums.phpfreaks.com/topic/47926-looking-for-login-script/#findComment-234789 Share on other sites More sharing options...
taith Posted April 21, 2007 Share Posted April 21, 2007 anything is possible... and yes... it is quite easy :-) but thats relative to the programmer lol Link to comment https://forums.phpfreaks.com/topic/47926-looking-for-login-script/#findComment-234796 Share on other sites More sharing options...
Destramic Posted April 21, 2007 Share Posted April 21, 2007 you want to use mysql create a table users ----------------- user_id username password ---------------- login.php <?php $username = $_POST['username']; $password = md5($_POST['password']); $query = "SELECT username, password FROM users WHERE username = '".$username."' AND password = '".$password."'"; $result = mysql_result($query) $count = mysql_num_rows($result); $row = mysql_fetch_array($result); if ($count > 0) { session_start(); $_SESSION['username'] = $row['username']; $_SESSION['password'] = $row['password']; $_SESSION['user_id'] = $row['user_id']; } else { echo "Login details incorrect.<br \>\n"; } ?> logout.php <?php session_start(); unset($_SESSION['username']); unset($_SESSION['password']); unset($_SESSION['user_id']); session_destroy(); ?> index.php <?php if (isset($_SESSION['username']) && isset($_SESSION['password'])) { echo "control panel here!<br />\n"; } ?> this should work...just written it up now...very simple way of doing thinks which can be adapted upon..any problems give me a shout Ricky Link to comment https://forums.phpfreaks.com/topic/47926-looking-for-login-script/#findComment-234800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.