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]
<?
//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.

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.