Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. Nobody said that.
  2. WELL FINE
  3. Make a gif with a transparent background and use that. You can never guarantee that everyone in the world will be able to view custom microsoft-only characters.
  4. There's a reason all logs are written at the end: Writing to the end of a log file is much faster and easier than writing to the beginning. The best solution is to make all your log entries a single line, then use a unix command like tail to view only the bottom of the file. The best way to solve your problem is: why do you want your log file in reverse-chronological order? Also, you can't do what kicken suggested (hi kicken!) because (a) log files of significant size will overflow your memory and (b) more than one simultaneous write request will ruin this file.
  5. that function is one line. Put that one line above session_start. The first argument is the number of seconds of inactivity.
  6. session_set_cookie_params allows you to set the timeout for the user's session cookie. kney's solution accomplishes roughly the same thing at the server level, but note that you need to die() after a header() call.
  7. Ok, there's a number of things wrong with this, I'm going to comment on every line: //this query is malformed and will throw a mysql error. You have to quote the email address. $query = "SELECT * FROM orders WHERE customeremail = joe@example.com"; //this runs the query and puts the results in $result $result = mysql_query($query); //this fetches the first row into $row. YOU NEVER USE THIS RESULT $row = mysql_fetch_array($result); //this runs the query a second time for no reason mysql_query ($query); //this loops through the result set starting at row #2, since you already fetched row #1 up there and discarded it. while ($row = mysql_fetch_array($result)) { $random = rand(10000000, 99999999); //If this field is a string password, the input really should still be quoted even though it's a number. $query = "UPDATE orders SET laybypassword = ".$random." WHERE id = ".$row['id'].""; //this line runs the above query. mysql_query ($query); } //All of this could be done in a single query without MySQL at all. -Dan
  8. Once again sphinx, please don't bump threads that have been dead for 8+ years. This topic is now also locked.
  9. You need to be more specific, do you want: 1) The session to expire after a certain amount of inactivity? For instance, if they get up and go to lunch, when they come back they'll be logged out? 2) The session to expire at a specific time after login regardless of their activity. For instance, they can only browse your site for 4 hours before they're automatically kicked out?
  10. basename
  11. WOULDN'T YOU LIKE THAT!?
  12. That link is in my sig ----v
  13. You're not reading what I wrote. You are looking at my code, which contains TWO VARIABLES: $row AND ANOTHER ONE CALLED $rows. See how they have two different names? You cannot print $row when I ask you to print $rows. See? Two different variables? You want to use multiple rows, right? Use $rows for that, not $row, because clearly $row is one row and $rows is ROWS. Go back. Copy my code. Paste my code. DO NOT CHANGE MY CODE. At the END of my code, AFTER my code, print_r($rows); Then, using that output, figure out what you need to do to get the data you want. You can alter the echo in my code to echo whatever you decide you need to echo.
  14. Copy. Paste. Seriously, what you have is nowhere near what I put. Do you not realize that $row and $rows are separate variables? One is singular, because it's one row. The other is plural, for all rows.
  15. That's impossible if you copied and pasted my code.
  16. Do what I said and then print_r($rows); You'll see the structure of the array and be able to use it then. If you still can't use it, copy and paste the results of print_r($rows) here.
  17. I know your religion prevents you from posting fully-formed questions, so here's a random code snippet that may or may not be what you're looking for: $query = "SELECT * FROM blog_posts ORDER BY id DESC LIMIT 5"; $results = mysql_query($query); $rows = array(); while($row = mysql_fetch_assoc($results)) { $rows[] = $row; } echo $rows[2][3];
  18. While this is true for very complex systems, don't worry about it right now. -Dan
  19. public function fetch($sql) { $array = mysqli_fetch_array($this->query($sql)); return $array; } You're calling $this->query() in there as if $sql is a string, when in reality $sql is already a result object. -Dan
  20. Definitely need more information than that. If you really do mean variable scope, then the answer is "non, I'd write the function properly."
  21. I love how we keep changing the section marked "please do not change below." Also, why is the "give it an ID and a name" solution not working? That's valid markup. Just because the validator said "change" doesn't mean that's the only solution.
  22. That's not what I wrote. Always copy and paste.
  23. document['Intro_Image'] That line finds by name. You could just do: document.getElementByI('Introl_Image')
  24. Go view the source of the web host, I bet it's flash. That being said, legally online signatures only require that you collect identifying information and have the user type their name into a box labeled "digital signature." I am not a lawyer, obviously, but that's what happens when you buy insurance online.
  25. Note that this won't be 100% accurate in some cases because of the problem of fractions and binary math. You might want to do a "close enough" disclaimer, or make use of the round() function.
×
×
  • 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.