Ben kaç saat için bu sorunu hata ayıklamak için çalışıyor, ama boşuna oldum. Ben yıllardır PHP kullanarak, ve uzun bir aradan sonra geri içine aldım, bu yüzden hala biraz paslı değilim oldum.
Her neyse, benim $ _SESSION vars ben çözemiyorum nedense kendi değerini koruyarak değildir. Site mükemmel localhost üzerinde çalıştı, ancak sunucuya yükleyerek onu kırmak gibiydi.
Ben kontrol ilk şey php.ini sunucu ayarlarını oldu. Her şey yolunda görünüyor. Aslında, benim giriş sistemi tabanlı oturum ve mükemmel çalışıyor. Yani şimdi ben $ _SESSIONS düzgün çalışan ve benim giriş için kendi değerini koruyarak biliyorum ki, ben sunucu küstah kurulum ve sorun benim komut olduğunu.
Burada bir soruna neden oluyor kod elimden versiyonu. Onlar bir GET değişkeni ile ayarlandıktan sonra $ tür, $ sipariş ve $ tarzı korunmuyor. Kullanıcı GET değişkeni ayarlar bir bağlantı tıklar ve bu değişken oturumuna kalanı için korunur.
Ben görmüyorum, benim mantığı ile bazı sorun var mı?
<?php
require_once('includes/top.php'); //first line includes a call to session_start();
require_once('includes/db.php');
$type = filter_input(INPUT_GET, 't', FILTER_VALIDATE_INT);
$order = filter_input(INPUT_GET, 'o', FILTER_VALIDATE_INT);
$style = filter_input(INPUT_GET, 's', FILTER_VALIDATE_INT);
/*
According to documentation, filter_input returns a NULL when variables
are undefined. So, if t, o, or s are not set via URL, $type, $order and $style
will be NULL.
*/
print_r($_SESSION);
/*
All other sessions, such as the login session, etc. are displayed here. After
the sessions are set below, they are displayed up here to... simply with no value.
This leads me to believe the problem is with the code below, perhaps?
*/
// If $type is not null (meaning it WAS set via the get method above)
// or it's false because the validation failed for some reason,
// then set the session to the $type. I removed the false check for simplicity.
// This code is being successfully executed, and the data is being stored...
if(!is_null($type))
{
$_SESSION['type'] = $type;
}
if(!is_null($order))
{
$_SESSION['order'] = $order;
}
if(!is_null($style))
{
$_SESSION['style'] = $style;
}
$smarty->display($template);
?>
Herkes bana doğru yönde işaret edebilir, ben çok takdir ediyorum. Teşekkürler.