nobodyk Posted August 9, 2010 Share Posted August 9, 2010 I need advice on how to handle a php issue. I will try to simply my problem as best as I can. Index.php is used to upload multiple pictures engine.php is called each time for each picture. So if someone uploads 3 pictures engine.php is called 3 times and uploads each picture separately. What I want to be able to do is to track bulk uploads. For example, if someone uploads 10 pictures at once there would be a unique code in my database that I could query and see the results of the 10 pictures that where uploaded. Kinda like a batch. The problem is that I can't seem to create a unique code that it's used to to track batches. I have used cookies in my index.php and set it to a random variable. When my engine.php starts uploading images via POST method, it calls the cookie that was stores in index.php only to see that the value doesn't get passed. I check index.php by using echo $_COOKIE['...']; and a value does get into the cookie, but engine.php can't seem to access the cookie. (I used setcookie) Here's part of the code for the cookies (engine.php): $getmu = $_COOKIE['multiupload']; $insert_image = "INSERT INTO images (owner, dateadded, mimetype, originalfilename, filename, thumbname, filesize, description, originalip, originalwidth, originalheight, lastaccessed, tracker, mutracker) VALUES ($displayID, NOW(), '".preparedata($contenttype)."', '".preparedata($filename)."', '".preparedata($newfilename)."', '".preparedata($ranthumb)."' , '".preparedata($filesize)."', '".preparedata($imgdesc)."', '".preparedata($userip)."', '".$originalwidth."', '".$originalheight."', NOW(), '".preparedata($tracker)."', '".$getmu."')"; if I set $getmu to just any string, it seems to get inserted into the db, so it's not a syntax issue. When I use cookies, nothing gets inputed. I also tried using sessions, but since engine.php is called for each picture upload, the session changes for every picture. Any ideas or advice? I'm kinda stuck on this. The cookies should work, but they don't :/ Quote Link to comment https://forums.phpfreaks.com/topic/210192-bit-of-a-dilemma-need-help-with-cookies-and-sessions/ Share on other sites More sharing options...
JonnoTheDev Posted August 9, 2010 Share Posted August 9, 2010 For example, if someone uploads 10 pictures at once there would be a unique code in my database that I could query and see the results of the 10 pictures that where uploaded. Why not record the users IP address? $_SERVER['REMOTE_ADDR'] Quote Link to comment https://forums.phpfreaks.com/topic/210192-bit-of-a-dilemma-need-help-with-cookies-and-sessions/#findComment-1096914 Share on other sites More sharing options...
vichu.1985 Posted August 9, 2010 Share Posted August 9, 2010 Dude, In my view, you can use $_SERVER['HTTP_COOKIE']. While saving any image, save this value also with date if you required. Its easy to retrieve to get a particular client's images..... Quote Link to comment https://forums.phpfreaks.com/topic/210192-bit-of-a-dilemma-need-help-with-cookies-and-sessions/#findComment-1096917 Share on other sites More sharing options...
JonnoTheDev Posted August 9, 2010 Share Posted August 9, 2010 I can't see the benefit of using a cookie in this situation Quote Link to comment https://forums.phpfreaks.com/topic/210192-bit-of-a-dilemma-need-help-with-cookies-and-sessions/#findComment-1096953 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.