Jump to content

session_start


mysterbx

Recommended Posts

hello,

 

could you help me out here?

I am trieng to make a rating system on my site...

 

Herre the code:

<?php
$id="1";
$_SESSION[$id]="aaa";
session_start();  
if(isset($_SESSION[$id])) {
echo "works";
} else {
echo "doesnt";
}
?>

 

i can never set the value for $id, if for example:

 

$id="0000";
$_SESSION[$id]="aaa";

 

result should be

$_SESSION[$id]="aaa";

 

but it doesnt work, i get no result, session doesnt create...

Link to comment
https://forums.phpfreaks.com/topic/110427-session_start/
Share on other sites

Ok... i made this code: (it works)

<?php
if(isset($rate) && !preg_match("#".$id."#ise",$_SESSION['rate'])) {
$searchdl=mysql_num_rows(mysql_query("select * from downloads where id='$id'"));
if($searchdl==1 && $rateid>0 && $rateid<6) {
$_SESSION['rate']=$_SESSION['rate']." $id";

// DO SOMETHING
// DO SOMETHING
// DO SOMETHING

}
$sname=preg_replace("#(www.|http\:\/\/)#ise","",$siteurl);
if(preg_match("#".$sname."#ise",$_SERVER["HTTP_REFERER"])) {
header("location: ".$_SERVER["HTTP_REFERER"]."");
} else {
header("location: $siteurl/");
}
die();
?>
}

 

but when i remove cache and cookies the session disappers...

how can i make it unexpirable? or make it expire after some time...

 

something like "session_cache_limiter ('private_no_expire, must-revalidate');" (it doesnt work)

Link to comment
https://forums.phpfreaks.com/topic/110427-session_start/#findComment-566827
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.