session_start(); $session_uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : NULL;Sessions bu, bunu nasıl cookie yapabilirim neyi değiştirmem gerekli ? Şimdiden teşekkürler.
[Yardım] SESSION'u COOKİE'YE çevirme
3
●455
- 14-12-2015, 22:34:04Merhaba,
session_start(); $session_uid = isset($_COOKIE['uid']) ? $_COOKIE['uid'] : NULL;
Verdiğiniz kodları cookie'ye böyle dönüştürebilirsiniz ama bir yerde bu session atanıyor muhtemelen orayı da bulup orada
$_SESSION['uid'] = $falan;
yerine
setcookie("uid", $falan, time() + (86400 * 30), "/"); // 86400 = 1 gün
kullanmanız gerekecek. cookie süresine göre çarpar bölersiniz.
kolaylıklar.
AkincanD adlı üyeden alıntı: mesajı görüntüle - 14-12-2015, 22:40:43Üyeliği durdurulduBumudur hocam ?bluexpres adlı üyeden alıntı: mesajı görüntüle
$_SESSION['uid']=$login;
Beceremedim hocam kodun tamamı budur.
ob_start("ob_gzhandler"); error_reporting(0); error_reporting(E_ALL & ~E_DEPRECATED); ini_set('display_errors', -1); include_once 'includes/Mat_Updates.php'; $Mat = new Mat_Updates(); include_once 'includes/db.php'; include_once 'includes/User.php'; session_start(); $session_uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : NULL; if (empty($session_uid)) { if (isset($_COOKIE['token'])) { $session_uid = $User->check_remember($_COOKIE['token']); } } if(!empty($session_uid)) { header("location:dashboard.php"); } $User = new User(); //Giriş $login_error=''; $login_error_div=''; if(!empty($_POST['user']) && !empty($_POST['passcode'])) { $username=$_POST['user']; $password=$_POST['passcode']; if(strlen($username)>0 && strlen($password)>0) { $login=$User->User_Login($username, $password); if($login) { $User->Check_Banned($_SESSION['uid']); $_SESSION['uid']=$login; header("Location:dashboard.php"); } else { $login_error="Hatalı kullanıcı adı veya şifre!"; $login_error_div="error"; } } } //Kayıt $reg_error=''; $reg_error_div=''; if(!empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password'])) { $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $name = $_POST['name']; $full_check = preg_match('~^[A-Za-z0-9_. ]{3,50}$~i', $name); if(strlen($username)>0 && strlen($password)>0 && strlen($email) && strlen($name)) { $reg=$User->User_Registration($username, $password, $email, $name); if($reg) { $_SESSION['uid']=$reg; header("Location:dashboard.php"); } else { $reg_error="Bu kullanıcı adı kullanımda."; $reg_error_div="error"; } } } - 14-12-2015, 23:28:41zaten kodunuz eğer session yoksa eski cookie'den uid alıp $session_uid'e atıyor ama illa değiştireyim diyorsanız evet $_SESSION['uid']=$login; ve $_SESSION['uid']=$reg; satırlarını dediğim şekilde setcookie yapmanız gerek.
kolaylıklar.
AkincanD adlı üyeden alıntı: mesajı görüntüle