Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. I don't think I will have any technical related questions dealing with fileuploads after I finished that file management system, but I have encountered a spec's issue now.  I am getting picture uploads from people, and I am going to dynamically display them WITH there specific post.  I am going to have them uploaded, and deleted when the post run's out of time.  Now the thing I am wondering, I am not use to getting an upload to redisplay it later as an image, in a controlled location.  Normally the images were shown on there own page, that wasn't part of the layout with a plain white background, this time they are put within a layout, in a controlled enviroment.  Should I just have the display area, have a limit on width and height.  I can't just say "Hey you have to limit the size of your pictures." So if I just put <img src="<?php echo $dynamicpiclink; ?>" width="number" height="number" /> I would have to figure a standard size that wouldn't take up too much room, and wouldn't make the pictures look shitty either.  Any idea for a standard widthXheight I could go with for all the pictures displayed.
  2. [code]then you can just calculate how many days are there between the end date and today's date.[/code] That was what I was trying to do in the beginning, The due date and today's date, today's date is set in the database, each time it checks today's date against the last updated date, and changes the timeperiod. or are you meaning something else, can you elaborate a little more, so I can get these ideas in my head, I like where this is going?
  3. Also if I try to do that with the posts, I have to show them the time period they have left on there post's because I might end up allowing them to reupdate it, if they want to try and give it a longer lifespan before it runs out.
  4. That sounds inviting but what about showing them how many day's they have left??
  5. No I have everything like that worked out. Someone can sign up for a free account. Here is the thing. they are free. in the database paid is set to no and the timeperiod is set to none if they pay it's yes and 30 or 365 depending on how much they paid also the date the paid is recorded. When they log in, if the timeperiod is NOT none then it records the date, and takes the date from teh database, and compares them, it get's the number of days in between the last date, and today.  Then it updates it, and changes the timeperiod, to match how many active paid days they have left, an dupdates the date to today.  If they log in again today then it does nothing, but tomorrow it would subtract 1 more.  It keeps doing that, until the day they login, the timeperiod goes 0 or below.  Then it chnages it all in the database to unpaid status.  Everything is automatic thus far like she wanted.  Now I have it where people can post found items, or lost items.  Found items have a 100 day lifespan, lost items have a 30 day lifespan.  I am running the same operations on those, so one someone logs in, there posts' associated with that user, are updated to show the current posting setup.  THat is what is going on now, I need to calculate all of this, and the login is the best place.  UNLESS I just set it in the admin, where she can click one button, to automatically update all the existing entries, but that alone could kill the server.  If there are 6000 entries, and she clicks a button and it starts doing the database calls necessary to update all of those, it could be murder on the server, but then if it's happening a little at a time when people login, it shouldn't matter, I am trying to come up with a way to approach this.
  6. It's not that, I tested this out before, The reason I am afraid is for it to uncover hidden glitches.  The first time I fixed the script it was working, when I put it under heavier testing I noticed that it was having slight problems depending on certain circumstances.  I can try different things, and test them, but I am afraid something hidden, some kind of miscalculation that only happens under specific circumstances I am unable to cover.
  7. I am getting a little worried with how this is turning out.  I have a script setup that does updating with data in a database, it does some date calculations, and based on a series of events, it changes the amount of time left for something to be activated inside the database. I had this only on paid accounts, everytime they log in, it checks and calculates how many days they have remaning and updates the database, with safety areas in place, to make sure that there are no errors with it later. Now I see I have to run the same script again, with the same setup, to test for that users recent entries of found items, and for lost items, I have to be able to auto update all of these things.  Regularly, and I am afraid the server will overload or crash, how can I do this, without overloading the server, I will reformat my script later, and try to avoid this, maybe with less database calls, optimize my script some more, but if thousands of people start logging, in it's going to kill the server, if it's running that much everytime someone logs in, but there is a lot that needs done to keep everything running smoothly, and automatic. I was given advice on the script earlier, tbu I don't want to take the chance of it breaking the script it took me awhile to get this covering all angles, and checking properly, and the saem situation goes for lost and found postings, I can copy and paste this same code, and jsut check different fields in a different table for it to do the same thing. [code]// start if($_SESSION['controller'] === true) { // updates paid time period $select = "SELECT * FROM userinfo WHERE id = '$_SESSION[id]';"; $query = mysql_query($select);// query for info $row = mysql_fetch_array($query); // fetch array if ($row['timeperiod'] != "none") { // check status of timeperiod $currentdate = date("m/d/y");// get's todays date $paydate = $row['paydate']; // get's db pay date $currentdate = strtotime($currentdate); // test later with later date $paydate = strtotime($paydate); $datetoupdate = date("m/d/y"); $number_days = floor(($currentdate - $paydate)/86400); // 86400 = seconds per day $updatedversion = $row['timeperiod'] - $number_days; // new time period $checkforupdate = "SELECT timeperiod FROM userinfo WHERE id = '$_SESSION[id]' AND timeperiod != '$updatedversion';"; $checkquery = mysql_query($checkforupdate); if ($checkrow = mysql_fetch_array($checkquery)) { $update = "UPDATE userinfo SET timeperiod = '$updatedversion', paydate = '$datetoupdate' WHERE username = '$_SESSION[username]';"; $query2 = mysql_query($update); } } // Closes check for timeperiod equaling none. $selectinfo = "SELECT * FROM userinfo WHERE id = '$_SESSION[id]' AND timeperiod <= '0';"; $query3 = mysql_query($selectinfo); if ($rowforupdate = mysql_fetch_array($query3)) { $paid = "no"; $paypalid = "not applicable"; $paydate = "not applicable"; $timeperiod = "none"; $updatepayinfo = "UPDATE userinfo SET paid = '$paid', paypalid = '$paypalid', paydate = '$paydate', timeperiod = '$timeperiod' WHERE id = '$_SESSION[id]';"; $query4 = mysql_query($updatepayinfo); }// closes row to update payement information when number is 0 or below }// closes test to update paid[/code]if someone sees a way to cut down the number of database calls, and they KNOW what they are doing then I will appreciate the help, if you don't understand every word of every line of code don't try it'll just break it.  The areas are all correct, and this code does what I want it to do, it updates the database properly, and it only does so if the right circumstances are met, but I am afriad running this each login, plus running it again after that for found posts and lost posts, it's going to kill the server.
  8. thanks too wildteen for the debug thing, that'll help too later.
  9. I am back I am glad you 2 figured it out and everything is running now.
  10. king arthur was right I was wondering what he was talking about at first.
  11. he was right, the error is changing based on teh location, I don't know the technicalities of how far it has to be, but I guess don't use echo's too close to the thing, just remove test1
  12. try what wildteen said for now, remove test1, the echo at the top, see if that fixes that part, then we can concentrate on the part below that to get the query to work.
  13. [code]session.cookie_lifetime = 0[/code] increase that to 4 hours will allow the cookie to work after the browser is shut down.  There is nothing wrong with php.ini what about .htaccess THe thing I would suggest is give me a little while if no one else can help. I am leaving for like 2 hours.  Be back later.
  14. maybe sometimes you can't have anything next to session_start(); good practice, try putting it in it's own section <?php session_start(); ?> <?php everything else here Try that, but I don't understand this, the reason itw as coming up blank is the username and password don't match, or one of the queries is wrong, I don't see what else can be causing this.
  15. browsers handling sessions differently I never heard of it, it has something to do with php.ini I would guess, for now give us your entire php.ini file, and anything you might have in your .htaccess page.
  16. what about something in php.ini or htaccess that is making something output before the php page is even called from the server, that could be causing it.???
  17. As I said earlier there "something" above session_start(); also if all the tests are showing something isn't working right. make sure <?php session_start(); ?> the <?php make sure it's at the top wall of the page, with nothing else above it.not html, or anything.
  18. test1test3test4test5 Warning: Cannot modify header information - headers already sent by (output started at /home/lov3dco/public_html/test.php:3) in /home/lov3dco/public_html/test.php on line 24
  19. and how did you know my name was joyel?
  20. oh ok, I didn't know that, thanks for telling me [code]<?php session_start(); //start a sessions :D echo "test1"; $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } echo "test3"; mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query echo "test4"; if($rows = mysql_num_rows($query)){     $_SESSION['password'] = $password; //store the users password in a sesions var     $_SESSION['username'] = $username; //store the username in a session var $page = "index.php";    echo "test5"; header('Location: ' . $page); }else { echo "test6";     session_destroy(); } ?>[/code]
  21. And the first thing is going to be to test to make sure the script is reading anything at all.  It might not be matching the criteria.  Put echo "test1"; echo "test"2; echo "test3"; at different interval's to see where the script is running and where it's not, if at all.
  22. That is entirely not true. if you have <?php session_start(); ?> it can cause errors with headers already sent, it's happened a thousand times just because it doesn't doesn't mean it can't. Now what I suspect, is you have your form, above everything else.  If this is the case, show me the entire page, from top to bottom. then the entire form page from top to bottom. if they are the same page, display them both. If they are seperate pages show Form page code here Processor page code here In the next post and let me look over it some.
  23. [code]<?php session_start(); //start a sessions :D $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query if($rows = mysql_fetch_array($query)){     $_SESSION['password'] = $password; //store the users password in a sesions var     $_SESSION['username'] = $username; //store the username in a session var $page = "index.php";    header('Location: ' . $page); }else {     session_destroy(); } ?>[/code] For now just run that, copy that code, and paste it over yours.  I redid a few things, replaced a few things, and rewrote your whole query, also double check to make sure you uploaded the php.ini file as well.
  24. it might have something to do with his settings then:S
  25. I found the problem [code]<?php session_start(); //start a sessions :D $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query if($rows = mysql_fetch_array($query)){     $_SESSION['password'] = $password; //store the users password in a sesions var     $_SESSION['username'] = $username; //store the username in a session var $page = "index.php";    header('Location: ' . $page); }else {     session_destroy(); } ?>[/code] Use exactly what I show above, I changed mysql_num_rows to mysql_fetch_array that should make it run smoothly.  don't forget to upload the php.ini file, ti's not showing your errors.  Either that or your host doesn't support it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.