Jump to content

SetCookie coding help needed


acctman

Recommended Posts

I need help with a setcookie code that will redirect a user or stop a user from accessing a page. I need help with set 3 and 4. I'm aware that this is not full proof (user can delete the cookies, user a different browser, turn cookies off, etc) but its a good deterrent that will stop most users.

 

 

1. User Logs in (login.php)

2. Check BanUser table if user exist redirect to Suspend

3. on Suspend page SetCookie to prevent the user from signing up again

4. User goes to reg.php page and the cookie redirects to Suspend

Link to comment
Share on other sites

put this code if banned_user is found, make sure its before any browser output or you will get errors:

 

setcookie("cookiename","banned",time()+99999999);

 

 

then on ever page that needs to check a banned user use this:

 

if(isset($_COOKIE['cookiename'])){
  if($_COOKIE['cookiename'] == "banned"){
    //redirect to suspended.php
  exit();
  }
}

 

hope this helps,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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