Jump to content

[SOLVED] Guest Login


Ell20

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/81196-solved-guest-login/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/81196-solved-guest-login/#findComment-412008
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/81196-solved-guest-login/#findComment-412035
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/81196-solved-guest-login/#findComment-412059
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.