PHP - Image Rotate Losing Transparency
I have the following code, works rotates the image. But it seems to lose its transparency and add color when rotated to say 45. How can I avoid this?
// File and rotation $filename = 'placeholder.png'; $degrees = 45; // Content type header('Content-type: image/png'); // Load $source = imagecreatefrompng($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); // Output imagepng($rotate); ?> Similar TutorialsHi, I want to create a function that reads the exif orientation data of an image and rotates it as required - needs to run before before the resize function here, I'm using GD library if that is relevant: function resize_gd($sourceFileName, $folder, $destinationFileName, $newWidth, $newHeight, $keepProportion) { $newWidth = (int)$newWidth; $newHeight = (int)$newHeight; if (!$this->gdInfo >= 1 || !$this->checkGdFileType($sourceFileName)) { return false; } $img = &$this->getImg($sourceFileName); if ($this->hasError()) { return false; } $srcWidth = ImageSX($img); $srcHeight = ImageSY($img); if ( $keepProportion && ($newWidth != 0 && $srcWidth<$newWidth) && ($newHeight!=0 && $srcHeight<$newHeight) ) { if ($sourceFileName != $folder . $destinationFileName) { @copy($sourceFileName, $folder . $destinationFileName); } return true; } if ($keepProportion == true) { if ($newWidth != 0 && $newHeight != 0) { $ratioWidth = $srcWidth/$newWidth; $ratioHeight = $srcHeight/$newHeight; if ($ratioWidth < $ratioHeight) { $destWidth = $srcWidth/$ratioHeight; $destHeight = $newHeight; } else { $destWidth = $newWidth; $destHeight = $srcHeight/$ratioWidth; } } else { if ($newWidth != 0) { $ratioWidth = $srcWidth/$newWidth; $destWidth = $newWidth; $destHeight = $srcHeight/$ratioWidth; } else if ($newHeight != 0) { $ratioHeight = $srcHeight/$newHeight; $destHeight = $newHeight; $destWidth = $srcWidth/$ratioHeight; } else { $destWidth = $srcWidth; $destHeight = $srcHeight; } } } else { $destWidth = $newWidth; $destHeight = $newHeight; } $destWidth = round($destWidth); $destHeight = round($destHeight); if ($destWidth < 1) $destWidth = 1; if ($destHeight < 1) $destHeight = 1; $destImage = &$this->getImageCreate($destWidth, $destHeight);Edited June 7, 2019 by mcfc4heatons Is there a way to use php to incorporate a folder of pictures as a clickable slideshow. For instance.... using a pic as a button... to go to the next pic.... except in quantities of 100... without having to manually write the code for each page...? In HTML: Code: [Select] <a href="index3.html"><img src="2.jpg" /></a> <a href="index4.html"><img src="3.jpg" /></a> <a href="index5.html"><img src="4.jpg" /></a> <a href="index6.html"><img src="5.jpg" /></a> <a href="index7.html"><img src="6.jpg" /></a> <a href="index8.html"><img src="7.jpg" /></a> <a href="index9.html"><img src="8.jpg" /></a> Something like using a basic rotating script activated on mouse click? How do i convert this into a button without making 100 pages? Code: [Select] <img src="/path/to/images/ rotate.php?img=my_static_image.jpg" /> I have come up with the rotate.php file as following: Code: [Select] <?php $folder = '/oprah/is/sofuckingfat.com/images/'; $extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['jpeg'] = 'image/jpeg'; $extList['png'] = 'image/png'; /* I believe that most of the following can be omitted once it hits the timer / countdown script */ $img = null; if (substr($folder,-1) != '/') { $folder = $folder.'/'; } if (isset($_GET['img'])) { $imageInfo = pathinfo($_GET['img']); if ( isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) && file_exists( $folder.$imageInfo['basename'] ) ) { $img = $folder.$imageInfo['basename']; } } else { $fileList = array(); $handle = opendir($folder); while ( false !== ( $file = readdir($handle) ) ) { $file_info = pathinfo($file); if ( isset( $extList[ strtolower( $file_info['extension'] ) ] ) ) { $fileList[] = $file; } } closedir($handle); if (count($fileList) > 0) { $imageNumber = time() % count($fileList); $img = $folder.$fileList[$imageNumber]; } } if ($img!=null) { $imageInfo = pathinfo($img); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($img); } else { if ( function_exists('imagecreate') ) { header ("Content-type: image/png"); $im = @imagecreate (100, 100) or die ("Cannot initialize new GD image stream"); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0,0,0); imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color); imagepng ($im); imagedestroy($im); } } ?> Would be more or less converting the rotate.php script into the base for the link structure. I assume the timing element in this script would be omitted with a replacement or nothing. I can't figure out what will be the quickest way to go about making the href follow the folder contents. I just want a basic click on the pic to go to the next one until it ends. Thoughts anyone? Hey, I know how to use the PHP GD functions but how would I resize an image > 1000 width to 1000 width and just resizing the height to w/e needed to keep aspect ratio if the image is set to 1000 width in pixels of course. I don't mess with images much so idk the whole ratio thing. I have the below code that outputs my image correctly expect it puts a black background in it, instead of keeping it transparent. I'm tried using imagealphablending and couldn't get it to work. What should I use to get it to work correctly and where should I put it. $src = imagecreatefrompng($target); echo $scr; list($width,$height)=getimagesize($target); $newwidth=54; // new width of image $newheight=54; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $image1 = imagecreatefrompng('Surround.png'); imagecopymerge($image1, $tmp, 5, 5, 0, 0, 54, 54, 100); This is what my gd script output looks like, the black needs to be transparent So basically I have two lines that generate an image from png and then preserve the transparency of said png. Code: [Select] $bub1 = imagecreatefrompng ("Energy/$energy1b.png"); imageSaveAlpha($bub1, true);This works by itself when generating just this image. But when combined with another image: Code: [Select] imagecopymerge($image, $bub1, 680, 40, 0, 0, 50, 50, 100);It fills in the back ground around the image and the transparency is not preserved. Why is this and how can i fix it? Hi, There are 10 images in a folder called "Images". All images are named like 1.jpg, 2.jpg, 3.gif, 4.png, and so on... I am using these images on my website with this link: MyDomain.com/Images/1.jpg Now what i want to do is change the image every minute. from 1... to ...10 all images one by one, every minute... Link should remain same, but it should give different image every time. and if someone copies my link of image, it still gets changed every minute. i hope to get some help, better with some example code... Thanks! Hey guy's i have a script i did a few months ago and now noticed that it is doing its job but keeps the old file ..so i got the image a few times but on a different angle...
how can i optimize this code to delete the old image when doing the rotation?
<?php session_start(); include_once 'dbconnect.php'; if (!isset($_SESSION['userSession'])) { header("Location: index.php"); } $degrees = -270; $path = $_GET['Folder']; $file =$_GET['Pic']; $fileid =$_GET['id']; $image = $path.'/'.$file; $imageN = $path.'/New_'.$file; //load the image $source = imagecreatefromjpeg($image); //rotate the image $rotate = imagerotate($source, $degrees, 0); $NewImg='New_'.$file ; //set the Content type //header('Content-type: image/jpeg'); //display the rotated image on the browser //imagejpeg($rotate); imagejpeg($rotate,$imageN,100); //free the memory imagedestroy($source); imagedestroy($rotate); $sql = "UPDATE Coupon_list SET product_image_thumb = '$NewImg' WHERE id = '$fileid'"; if (mysqli_query($DBcon, $sql)) { echo "Rotation ok"; echo('<script language="Javascript">opener.window.location.reload(false); window.close();</script>'); } else { echo "Error Rotating: " . mysqli_error($DBcon); } mysqli_close($DBcon); ?> <img src="gears.gif" alt="" />
How to do that when you turn 360 degrees no longer come back? Only in this way was? I am not sure If I am loosing my variable or if it is just getting cancelled out by the syntax. The error I get is this: Query string: "SELECT * FROM timeslip WHERE 1 and Initials=" ORDER BY "Date" ASC, "Cost" ASC Failed with error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"SELECT * FROM timeslip WHERE 1 and Initials=" ORDER BY "Date" ASC, "Cost" ASC' at line 1 Initials should have the value of GEC at this moment Here is my code: $qry_str="SELECT * FROM timeslip WHERE 1 "; if($_POST['Initials']) { $Initials=$_POST['Initials']; $qry_str.='and Initials="'.$Initials . '"'; } if($_POST['Identifier']) { $Identifier=$_POST['Identifier']; $qry_str.='and Identifier LIKE "%'.$Identifier . '%"'; } if($_POST['Type']) { $Type=$_POST['Type']; $qry_str.='and Type LIKE "%'.$Type . '%"'; } if($_POST['Terms']) { $Terms=$_POST['Terms']; $qry_str.='and Terms LIKE "%'.$Terms . '%"'; } if($_POST['Memo']) { $Memo=$_POST['Memo']; $qry_str.='and Memo LIKE "%'.$Memo . '%"'; } if($_POST['date1']) { $date1=$_POST['date1']; $date2=$_POST['date2']; $start=date('Y-m-d', strtotime($date1)); $end=date('Y-m-d', strtotime($date2)); $qry_str.="and Date >= $start and Date <= $end "; } if($_POST['order1'] && $_POST['order2']) { $order1=$_POST['order1']; $order2=$_POST['order2']; $qry=$_POST['qry']; $qry_str=' "'.$qry.'" ORDER BY "'.$order1 . '" ASC, "'.$order2 . '" ASC '; } elseif(isset($_POST['order1'])) { $order1=$_POST['order1']; $qry=$_POST['qry']; $qry_str='$qry ORDER BY $order1 ASC'; } else { if(isset($_POST['order2'])) { $order2=$_POST['order1']; $qry=$_POST['qry']; $qry_str='$qry ORDER BY $order2 ASC'; } } if( !$result = mysql_query($qry_str) ) { echo "<br>Query string: $qry_str<br>Failed with error: " . mysql_error() . '<br>'; } Alright I know scraping is frowned upon.. but its for a client... Anyways.. The below is supposed to form an array $kw for output. But its breaking on line 27: Code: [Select] foreach ($kw as $keyword => $pages) Ive concluded my array is being broken and then formed into an empty string, but I can't figure out where it wen't wrong. I want to say the trouble comes from lines 20-23: Code: [Select] foreach($data as $temp) { $kx = text_between('"','"',$temp); if (is_array($kx)) $kw[key($kx)] = current($kx); } The full version.. Code: [Select] <?php function text_between($start,$end,$string) { $keyword = ''; if ($start != '') {$temp = explode($start,$string,2);} else {$temp = array('',$string);} $temp = @explode($end,$temp[1],2); $temp2 = @explode($end,$temp[1],3); $pages = (int)@str_replace(',','',$temp2[1]); if ($pages) $keyword[$temp[0]] = $pages; return $keyword; } function gsscrape($keyword) { $keyword=str_replace(" ","+",$keyword); $keyword=str_replace("%20","+",$keyword); global $kw; $data=file_get_contents('http://clients1.google.com/complete/search?hl=en&gl=us&q='.$keyword); $data=explode('[',$data,3); $data=explode('],[',$data[2]); foreach($data as $temp) { $kx = text_between('"','"',$temp); if (is_array($kx)) $kw[key($kx)] = current($kx); } } #simple to use, just use yourscriptname.php?keywords echo $_SERVER['QUERY_STRING']; if ($_SERVER['QUERY_STRING']!='') { gsscrape($_SERVER['QUERY_STRING']); foreach ($kw as $keyword => $pages) { gsscrape($keyword); } } #all results are in array $kw... echo "<pre>"; print_r($kw); echo "</pre>"; ?> I seem to be losing my array value when it comes to the "Game Time" section of my script. I am printing out the array a long the entire time and this is where I lose it and can't figure out why. <form name="form1" method="post" action=""> <span class="whitetitle">How many teams?</span> <ul class="pageitem"> <li> <SELECT name="teams" onchange="document.form1.submit();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </SELECT> </li> </ul> </form> <? if($_POST['teams']) { ?> <form method="post" name="form2" action=""> <span class="whitetitle">Team Name</span> <?php $teams=$_POST['teams']; $count=0; while($count<$teams) { ?> <ul class="pageitem"> <li class="bigfield"> <input placeholder="Name" type="text" name="teamname[]"/> </li> </ul> <? $count++; } ?> <input type="hidden" value="<?=$teams?>" name="teams" /> <input type="submit" name="Submit" value="Next"> </form> <? } ?> <? if ($_POST['teamname']) { $teams=$_POST['teams']; $teamname=$_POST['teamname']; ?> <form name="form" method="post" action=""> <span class="name"><? print_r ($_POST['teamname']);?></span> <ul class="pageitem"> <li class="radiobutton"><span class="name">Season</span> <input name="schedule" type="radio" value="season" onClick="this.form.action='';this.form.submit()" /></li> <li class="radiobutton"><span class="name">Playoffs</span> <input name="schedule" type="radio" value="playoffs" onClick="this.form.action='';this.form.submit()"/></li> </ul> <input type="hidden" value="<?=$teams?>" name="teams" /> <input type="hidden" value="<?=$teamname?>" name="teamname" /> </form> <? } if($_POST['schedule']) { $teams=$_POST['teams']; $schedule=$_POST['schedule']; $teamname=$_POST['teamname']; ?> <form name="form4" method="post" action=""> <span class="name"><? print_r ($_POST['teamname']);?></span> <span class="whitetitle">Games per Night</span> <ul class="pageitem"> <li> <SELECT name="games" onchange="document.form4.submit();"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </SELECT> </li> </ul> <input type="hidden" value="<?=$teamname?>" name="teamname" /> <input type="hidden" value="<?=$teams?>" name="teams" /> <input type="hidden" value="<?=$schedule?>" name="schedule" /> </form> <? } if($_POST['games']) { $teams=$_POST['teams']; $schedule=$_POST['schedule']; $games=$_POST['games']; $teamname=$_POST['teamname']; $count=0; ?> <form name="form5" method="post" action=""> <span class="name"><? print_r ($_POST['teamname']);?></span> <span class="whitetitle">Times</span> <ul class="pageitem"> <? while($count<$games) { ?> <li> <input placeholder="Times" type="text" name="times[]"/> </li> <? $count++; } ?> </ul> <input type="hidden" value="<?=$teamname?>" name="teamname" /> <input type="hidden" value="<?=$teams?>" name="teams" /> <input type="hidden" value="<?=$schedule?>" name="schedule" /> <input type="hidden" value="<?=$games?>" name="games" /> <input type="submit" name="Submit" value="Next"> </form> <? } if($_POST['times']) { echo $_POST['teams']; print_r ($_POST['teamname']); echo $_POST['schedule']; echo $_POST['games']; echo implode(",",$_POST['times']); } ?> Maybe somebody knows a good way to do this... I have a simple query that seasonal categories - plus one special events header. then for each header I pull all the classes in that category. Right now it just pulls and orders by id. So, regardless of year, they come out in the same order: spring, winter, fall, special events. I'm trying to see if there's a way to make them show in order of relevance to the current time. right now, the "cat" table just has two fields: cat_id, cat_name. In other words, in autumn, I want them to order: Autumn, winter, summer, spring - then special events. In summer, I want them to order: Summer, spring, autumn, winter - then special events. any thoughts on how to do this? step one, order by relevence to current date. step two, special events is always last. Code: [Select] $query1 = "select * from tbl_cat ORDER by cat_id"; $result_cats = mysql_query($query1) or die(mysql_error()); while ($row = mysql_fetch_array($result_cats)) { $query_selectall = "select *,workshop_date AS tester from tbl_workshops WHERE category={$row['cat_id']} and active_inactive = '1' ORDER by workshop_date"; $result_all = mysql_query($query_selectall) or die(mysql_error()); $catid = $row['cat_id']; $catname = $row['cat_name']; echo "<font face='georgia' size=5><b>".$catname." </b></font><br><div style='color:#fff;'>"; while ($c_row = mysql_fetch_array($result_all)){ // rest of code pulls items that match that specific category id. } Alright, I've spent over a week trying to fix this now - And Im getting frustrated! I asked at other forums, I asked co-workers and I asked friends-of-friends, and nobody can explain what happens. Let's take a look at this first: $name = mysql_real_escape_string($_POST['name']); mysql_query(sprintf("UPDATE em_users SET name='%s' WHERE id='" . $in_user['id'] . "'", $name)); This will insert NO data on the Name field in the database. Obviously, I thought the $_POST variable wasn't passed correctly, but echo'ing it just before the query WILL show data. And as I said, I tried everything possible for the last week. Switching variables, adding static text on the $name variable instead of using the $_POST content (this does work). I used very very simple test data on the form, such as my name "Mark" or "test" and "hey". The query is correctly executed everytime. The truely WEIRD thing is, if I ensure there is content in $name before executing the query it will work as expected everytime. Like this: $name = mysql_real_escape_string($_POST['name']); $name && mysql_query(sprintf("UPDATE em_users SET name='%s' WHERE id='" . $in_user['id'] . "'", $name)); Of course I could do this, but I want to know why my code does or doesn't work + it's a lot of work to do for something that worked fine a week ago. It has spread to a lot of forms on my website that $_POST variables aren't processed correctly - and it happened out of nowhere. Even on codes that havnt changed in months. I really need help on fixing this! This project has been in development for nearly two years, and without a fix it's pretty much lost Hi everyone - I am trying to figure out how I can allow my logged in users to leave a php page and go to an html page without losing them as "currently logged in" - I have a site that is mixed with html and php pages and this is what I am needing: i have a user, they are logged in and are visiting a php page. then they want to go to another page(only logged in users can access the php page) - so they click on the html page they want to go to, great! - but then they want to visit another page that is a php page and requires them to be logged in in order to access it. How can i accomplish this without having them log in yet again? is this possible? i am using sessions. Hey there, Pretty frustrated with this. It seems so simple, but I've been staring at it and toying with it for ages, so I figured I'd post here. I have a variable called "$isTaken" that seems to be losing its value in an essential step in my function. Take a look. function subdomainTaken($inputtedSubdomain) { //Initialize $isTaken to 'true' $isTaken = true; echo "isTaken STARTS AS: <i>" . $isTaken . "</i><br />"; //FOR TESTING PURPOSES ONLY. VARIABLE HAS VALUE HERE //Check subdomain in database $subdomainDBQuery = mysql_query("SELECT * FROM `companies` WHERE company_subdomain = '$inputtedSubdomain'"); $foundResult = mysql_num_rows($subdomainDBQuery); if ($foundResult > 0) { $isTaken = true; } else { $isTaken = false; } return $isTaken; } By the time I get to the if statement, $isTaken has no value. I've echoed it to be sure. Any ideas? Thanks, Frank I am working with a fellow who runs an eCommerce shop. The transaction resolution comes in on a querystring.
I do not yet know what web server software is being used, nor if any security appliance/software is installed.
One of the values in the querystring starts with the @ character.
We know the web server gets this as there entries in the web server's access log that shows thing value is present.
It is not available in PHP's $_GET array.
We are trying to get an idea of where this value, and it's key, is getting discarded.
Is there a known problem with (actual server software being used not yet known) web server software discarding a key/value if the value has the @ character in the querystring?
I am trying to retain information from the $get variable after checking if a user, (Joomla code), is logged in but it is not working. (url: http://domain.com/script.php?file=data) define( '_JEXEC', 1 ); define( 'DS', DIRECTORY_SEPARATOR ); define('JPATH_BASE', '/path/to/joomla/dir/'); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); $mainframe =& JFactory::getApplication('site'); $mainframe->initialise(); $session =& JFactory::getSession(); $user =& JFactory::getUser(); // get username and name of user $username = $user->get('username'); $name = $user->get('name'); if (empty($username)) { die('Not logged in'); } $file = $_GET['file']; echo &file; exit; Any help appreciated. Afternoon, Not sure if i've been staring at the screen for too long or not, but have a log in script which saves the password as a session variable and I can pass that variable across my page like so: <?php session_start(); //Print_r ($_SESSION); echo "Erm, I have reached page.php and the password is ".$_SESSION['password']; ?> However, I want to make this secure, so I added a function to it which when you log in says if $_SESSION['password'] does not exist then send me away, like so: <?php session_start(); function checklogin() { session_start(); if(!isset($_SESSION['password'])) { header("location: /index/"); exit; } } checkLogin(); Print_r ($_SESSION); echo "Erm, I have reached page.php and the password is ".$_SESSION['password']; ?> However, using the function and a valid log-in it (as shown above) it chucks me out of the page even though $_SESSION['password'] exists? Am I doing something really stupid here? Thank you So whether I am uploading an image through my iphone or sending that image to my computer and uploading it from the computer, it has the same effect. If I upload that image, it'll orient the image in landscape mode. Having said that, I found a function that can fix the orient issue. The problem is I don't know the proper way to integrate it into the image upload script. I have tried several different ways but they all give me errors. Can you show me where exactly I should use this function? // IMAGE ORIENTATION function getOrientedImage($imagePath) { $image = imagecreatefromstring(file_get_contents($imagePath)); $exif = exif_read_data($imagePath); if(!empty($exif['Orientation'])) { switch($exif['Orientation']) { case 8: $image = imagerotate($image,90,0); swapHW(); break; case 3: $image = imagerotate($image,180,0); break; case 6: $image = imagerotate($image,-90,0); swapHW(); break; } } return $image; } // IMAGE UPLOAD SCRIPT if(isset($_FILES['fileToUpload']) AND !empty($_FILES['fileToUpload']["name"])) { if(is_uploaded_file($_FILES['fileToUpload']["tmp_name"])) { $target_dir = '../members/images/'.$global_user_id.'/projects/'.$url_project_id.'/'; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); $source_file = $_FILES["fileToUpload"]["tmp_name"]; $random_name = generateRandomString(10); $new_image = $random_name . '.' . $imageFileType; $resized_image = compressImage($source_file, $new_image, 50); $new_file_path = $target_dir . $resized_image; if(!is_dir($target_dir)){ mkdir($target_dir, 0775, true); } $uploadOk = 1; // Check if image file is a actual image or fake image $check = getimagesize($source_file); if($check !== false) { // echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errors[] = 'File is not an image!'; $uploadOk = 0; } // Check if file already exists if (file_exists($target_file)) { $errors[] = 'Sorry, file already exists!'; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 5000000) { $errors[] = 'Sorry, your file size is bigger than 5mb!'; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { $errors[] = 'Sorry, only JPG, JPEG, PNG & GIF files are allowed!'; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if($uploadOk == 0) { $errors[] = 'Sorry, your file was not uploaded!'; // if everything is ok, try to upload file } else { if(rename($new_image, $new_file_path)) { echo 'success'; } else { $errors[] = 'Sorry, there was an error uploading your file!'; } } } else { $errors[] = 'You must upload an image!'; } } Edited December 23, 2019 by imgrooot Hello,
I have a secure login script that uses sessions to maintain a users logged in status. I regenerate the session ID on each page reload for added security. Sometimes, I will lose sessions, and I am hard time figuring out why. It seems to be when I have a slow internet connection. I am wondering what could be causing this?? I have a few ideas, do any of these seem plausible.
-A max execution error, returns a fatal error.
-An ajax request get sent before the previous request returns, so the session ID's dont match an I am kicked out.
Any other ideas would be helpful.
Best,
James
|