Backend Development PHP Session is NULL Submitted by Venipa, 14-06-2016, 04:08 PM, Thread ID: 21822 Thread Closed Reply 14-06-2016, 04:08 PM This post was last modified: 14-06-2016, 05:00 PM by Venipa #1 http://stackoverflow.com/questions/37812...on-is-null ^ Dont really want to describe it here again. Request to upload.php (image): Website to check it: https://temp.venipa.net More /au4to0] RE: PHP Session is NULL 14-06-2016, 04:47 PM #2 Have you tried if(empty()) ? PHP Code:<?php if(empty($_SESSION['test'])){ session_start(); $_SESSION['test'] = "Session has started"; print_r($_SESSION['test']); echo "<a href='destroy.php'>Destroy</a>"; }else{ die("Session is not started"); } ?> Or if you still prefer using !isset PHP Code:<?php if(!isset($_SESSION['test'])){ session_start(); $_SESSION['test'] = "Session has started"; print_r($_SESSION['test']); echo "<a href='destroy.php'>Destroy</a>"; }else{ die("Session is not started"); } ?> Destroy.php PHP Code:<?php session_destroy(); header("refresh:0; url=index.php");?> More RE: PHP Session is NULL OP 14-06-2016, 04:58 PM #3 i tried it, still null More /au4to0] RE: PHP Session is NULL 14-06-2016, 06:01 PM #4 are you still only using $_SESSION and not $_SESSION['title'] More RE: PHP Session is NULL OP 14-06-2016, 06:06 PM #5 14-06-2016, 06:01 PMBurnedDesigns Wrote: are you still only using $_SESSION and not $_SESSION['title'] i use $_SESSION['user_session'] to check it, since there's nothing wrong More /au4to0] RE: PHP Session is NULL 14-06-2016, 06:12 PM #6 14-06-2016, 06:06 PMVenipa Wrote: 14-06-2016, 06:01 PMBurnedDesigns Wrote: are you still only using $_SESSION and not $_SESSION['title'] i use $_SESSION['user_session'] to check it, since there's nothing wrong Why do you want to check Code:if (!isset($_SESSION))" in the first place? Why don't you just session_start() at the beginning of your php files? It won't harm you and your session won't get overwritten More Aisaka Squad Clxud | @231 | Kyoko |@1126 |@1256 | @5056 | @25108| @3747 RE: PHP Session is NULL OP 14-06-2016, 07:31 PM #7 Already fixed it, thanks to Burned Designs ! Got that simple thing was the issue, you cant bind the session value with PDO More /au4to0]
RE: PHP Session is NULL 14-06-2016, 04:47 PM #2 Have you tried if(empty()) ? PHP Code:<?php if(empty($_SESSION['test'])){ session_start(); $_SESSION['test'] = "Session has started"; print_r($_SESSION['test']); echo "<a href='destroy.php'>Destroy</a>"; }else{ die("Session is not started"); } ?> Or if you still prefer using !isset PHP Code:<?php if(!isset($_SESSION['test'])){ session_start(); $_SESSION['test'] = "Session has started"; print_r($_SESSION['test']); echo "<a href='destroy.php'>Destroy</a>"; }else{ die("Session is not started"); } ?> Destroy.php PHP Code:<?php session_destroy(); header("refresh:0; url=index.php");?> More
RE: PHP Session is NULL 14-06-2016, 06:01 PM #4 are you still only using $_SESSION and not $_SESSION['title'] More
RE: PHP Session is NULL OP 14-06-2016, 06:06 PM #5 14-06-2016, 06:01 PMBurnedDesigns Wrote: are you still only using $_SESSION and not $_SESSION['title'] i use $_SESSION['user_session'] to check it, since there's nothing wrong More /au4to0]
RE: PHP Session is NULL 14-06-2016, 06:12 PM #6 14-06-2016, 06:06 PMVenipa Wrote: 14-06-2016, 06:01 PMBurnedDesigns Wrote: are you still only using $_SESSION and not $_SESSION['title'] i use $_SESSION['user_session'] to check it, since there's nothing wrong Why do you want to check Code:if (!isset($_SESSION))" in the first place? Why don't you just session_start() at the beginning of your php files? It won't harm you and your session won't get overwritten More Aisaka Squad Clxud | @231 | Kyoko |@1126 |@1256 | @5056 | @25108| @3747
RE: PHP Session is NULL OP 14-06-2016, 07:31 PM #7 Already fixed it, thanks to Burned Designs ! Got that simple thing was the issue, you cant bind the session value with PDO More /au4to0]