new@php Posted August 17, 2007 Share Posted August 17, 2007 Hey Guys, I need some help please. I have taken on a project which is slightly beyond me at the moment! I have been asked to complete a PHP Login Script that by the looks of it uses OOP. I have been given some files in which the script has been set up by it needs to be completed to do the following: User arrives at Login >>> User Logins in Successfully >> create User object and save in $_SESSION >> redirect to homepage >>> homepage retrieves User from session and displays "welcome username" If there no login registered then the user should be redirect to the login page. the same should be done if the username is not recognized. I have the following files on and scripts: index.php Code: <div id="Header">Header</div> <div id="Body">[WELCOME]</div> <div id="Footer">Footer</div> Login.php Code: <div id="Header">Header</div> <div id="Body">[LOGIN FORM]</div> <div id="Footer">Footer</div> Both these pages also contain: PHP Code: <?php require '_includes/_includes.php'; ?> These include files are: User.php PHP Code: <?php class User { var $id; var $username; var $password; var $firstName; var $lastName; var $active; var $email; function User($row) { $this->username = $row['username']; } } ?> and UserManager.php PHP Code: <?php class UserManager { function UserManager() { } function login ($username, $password) { return new User (); } function checkUserLoggedIn () { return false; } } ?> Can anyone help me out here with some possible solutions and maybe an explanation? As I'm kind of at a loss! I know a form is required which is straightforward enough and a login script but how do i integrate the current User.php and Usermanager.php files? Many thanks! Seb Quote Link to comment https://forums.phpfreaks.com/topic/65480-php-login-script-using-oop/ Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 this should be in the OOP section, i don't see where you are checking the usernames or redirecting ?! Quote Link to comment https://forums.phpfreaks.com/topic/65480-php-login-script-using-oop/#findComment-326938 Share on other sites More sharing options...
new@php Posted August 17, 2007 Author Share Posted August 17, 2007 yeah sorry. i've also added this to the OOP section @ http://www.phpfreaks.com/forums/index.php/topic,155435.0.html i'm abit brain dead going over this. how do i create a login script with files that i already have? Quote Link to comment https://forums.phpfreaks.com/topic/65480-php-login-script-using-oop/#findComment-326950 Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 Sorry you shouldn't double post.. thats code is only the basic start of the OOP login system.. Techie out Quote Link to comment https://forums.phpfreaks.com/topic/65480-php-login-script-using-oop/#findComment-326952 Share on other sites More sharing options...
new@php Posted August 17, 2007 Author Share Posted August 17, 2007 thanks. any tips or pointers or how I can go on to complete it? Quote Link to comment https://forums.phpfreaks.com/topic/65480-php-login-script-using-oop/#findComment-326959 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.