Ell20 Posted December 11, 2007 Share Posted December 11, 2007 Hi, I have started creating a website which sports clubs can register their club and fill out information about themselves, these members are set as admins. Then members of that club can use a separate registration to register to their club, these are set as members. This is all working perfectly. What I would like to do now is to allow "Guests" i.e users which don't want to register but only get limited access to pages. I have set up a dynamic drop down box on the login page which lists all the clubs currently available. How do I go about logging the guest into the club they want to once they have selected their club from the drop down box then press login as guest? Thanks for your help Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 If guests will have limited access, why do they need to log in as guest? Is it for tracking purposes? If so, just create a id called guest and don't require a PW. Quote Link to comment Share on other sites More sharing options...
Ell20 Posted December 11, 2007 Author Share Posted December 11, 2007 If guests will have limited access, why do they need to log in as guest? Is it for tracking purposes? If so, just create a id called guest and don't require a PW. I need some kinda of login for guests because there will be lots of websites based on different sports clubs, so without this there would be no way to determine which club to log the guest into. Thanks Quote Link to comment Share on other sites More sharing options...
Ell20 Posted December 11, 2007 Author Share Posted December 11, 2007 Ok I have now set it up so that when a new club is registered an account called Guest, with no password is set up. I now need to link my drop down box, which shows all the clubs available to login to, so that when the club is selected they are logged in as Guest with the correct club. My code for the drop down box is: <?php require_once ('mysql_connect.php'); $sql = "SELECT * FROM club"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $club_id = $row["club_id"]; $clubName = $row["clubn"]; $club_id == $OTHER_CLUB_ID ? $sel = 'SELECTED' : $sel = ''; ?> <option value="<?php echo $club_id ?>" <?php echo $sel ?>><?php echo $clubName ?></option> <?php } ?> </select> Appreciate any help. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted December 11, 2007 Share Posted December 11, 2007 I don't understand why when a guest goes to your page and selects a club to view you can't just keep track of the club in a session or something. Why create a hidden account? Quote Link to comment Share on other sites More sharing options...
Ell20 Posted December 11, 2007 Author Share Posted December 11, 2007 Im fairly new to PHP so I dont no all the ins and outs yet. I have a session which is created when a normal user logs in. I dont really have much idea how to set up the guest login which is why I was hoping to get some help here. Thanks Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted December 11, 2007 Share Posted December 11, 2007 What are you saving in the session when the user logs in? Quote Link to comment Share on other sites More sharing options...
Ell20 Posted December 11, 2007 Author Share Posted December 11, 2007 I think ive done it now. The session holds the user_id and the club_id of the user logged in. For that reason I have set it up to automatically create a guest account when a new club is created. Thanks for the original idea of doing it this way. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 You're welcome Quote Link to comment 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.