Jump to content
php.lv forumi

Login


dAivEd

Recommended Posts

Saitā uztaisīju Login pareli, piereģistrējos, un ielogojos, itkā viss kārtībā, session_start(); ir bet tiklīdz refresh, vai pāreju uz citu sadaļu viņš automātiski izlogojas... kā to varētu izlabot? cik saprotu sesija nesaglabājas. ( uz cita servera viss iet perfekti, bet nopirku hostingu un parādijās šī problēma...

Link to comment
Share on other sites

Vai uzstādās sesijas cookie? Vai tam ir pareizas vērtības? Kādas tās ir?

 

$_SESSION['id'] = $id; // pieshkiram sessija ID, lietotaja ID no mysql
if(isset($_SESSION['id'])) {
echo "Ir sessija";
}
else {
echo "Nav sessijas";
}

 

Sesija tiek piešķirta tikai 1 reizej, pēc refresh, tā pārtraucas, un izmet no logina ārā

Edited by dAivEd
Link to comment
Share on other sites

Ok, kā gribi. :) Ja saki, ka nevajag tātad nevajag. Arlabunakti.

 

setcookie("id", "", $expire);
setcookie("nick", "", $expire);
setcookie("password", "", $expire);

if($_COOKIE['password'] != "$check_real_pw") {
header("location: http://mysite.lv/?action=logout");
}

 if(isset($_COOKIE['id']) and (isset($_COOKIE['password'])) and (isset($_COOKIE['nick']))) {

$check_pw = $_COOKIE['password'];
$check_nick = $_COOKIE['nick'];
$check_id = $_COOKIE['id'];
$query = "SELECT * FROM users WHERE password = '$check_pw' AND nick = '$check_nick' AND id = '$check_id'
";
$result = mysql_query("$query") or die(mysql_error());

Ja tas protams palīdzēs

Edited by dAivEd
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...