Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

*SOLVED* incrementing session please help thank you.

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]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Thank you so much works grate have to learn that know cheers.

[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--]

Share this post


Link to post
Share on other sites

×

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.