Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP session variable, check then delete
    primarykey
    data
    text
    <p>Code: <pre><code> if(!$picture) $error = $error."&lt;div&gt;This is a photo site, we require you select a photo.&lt;/div&gt;"; if(!$imgname) $error = $error."&lt;div&gt;You must enter a name for your photo.&lt;/div&gt;"; if(!$description) $error = $error."&lt;div&gt;You must enter a description for your photo.&lt;/div&gt;"; else if(strlen($description) &gt; 500) $error = $error."&lt;div&gt;Your descriptions to long. 500 characters max.&lt;/div&gt;"; if(!$error) { $case = 2; $max_width_new = 190; $make_thumb=1; $make_medium=1; $make_original=1; $imagename = "picture"; $folders = "accounts/".$dbid."/"; if(!file_exists($folders)) mkdir($folders); include("scripts/php/uploadpicture.php"); if($file) { $connect = mysql_connect("localhost","headinth_admin","adobe1234"); mysql_select_db("headinth_core"); mysql_query("INSERT INTO pictures (id, uploader, name, description, location, picture, date) VALUES('','$dbid','$imgname','$description','$location','$file_name','$date')"); $_SESSION['uploaded'] = 1; header("location: ?upload"); } } else echo "&lt;div class='green f18 fl coolvetica' style='text-align:left;'&gt;".$error."&lt;/div&gt;&lt;div class='c20'&gt;&lt;/div&gt;"; } if(isset($_SESSION['uploaded'])) { echo "&lt;div class='white f18 fl coolvetica' style='text-align:left;'&gt;Your picture was uploaded.&lt;/div&gt;&lt;div class='c20'&gt;&lt;/div&gt;"; unset($_SESSION['uploaded']); } ?&gt; </code></pre> <p>So it goes through and if everything successful it declares $_SESSION['uploaded'] = 1. Makes sense. Since theres a header it refreshes the page. Then I check if $_SESSION['uploaded'] exists, to see if a photo was just uploaded. If it was then it should send the message "Your photos been uploaded". Then it would have to delete the $_SESSION['uploaded'] variable so it doesn't show up again if the page is refreshed or an invalid submission is made. </p> <p>The issue is that its just skipping the if(isset($_SESSION['uploaded'])) line and just unsetting the session. So its not echoing the success message. IF i delete the unset it works, just always appears until the entire session is destroyed. So the goal, carry a variable over a page refresh, echo it then remove it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload