Jump to content

*SOLVED* incrementing session please help thank you.


redarrow

Recommended Posts

How do i get the session $domain to increment so if the users ip looked at somthink twice the echo message apears thanks.

My code but needs help cheers.
[code]
<?
//start session
session_start();

// Put varable $doamin as an ip
$domain = GetHostByName($REMOTE_ADDR);

// Convert varable $doamin to a session.
$domian=($_session["$domian"]);

// If session $domain = 2 or is 2 echo message.
if($domian>=2){echo "sorry you searched twice please know register!";
}

?>
[/code]
Link to comment
Share on other sites

<?
//start session
session_start();

// Put varable $doamin as an ip
$domain = GetHostByName($REMOTE_ADDR);

if (!$_SESSION["$domain"]){
$_SESSION["$domain"]=1;
}
else {
$_SESSION["$domain"]++;
if ($_SESSION["$domain"] > 2) {
echo "sorry you searched twice please know register!";
}
}

?>


That should work as far as i can see but havn't had chance to test it.
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.