Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Its the format string for minutes. See: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
  2. Erm, if you're pulling data from a mysql table, which you're concatenating with the mysql query, only to then explode, what's the point? Why not cycle through the rows and do what you want to do with the data. Secondly, as you mentioned, the proposed solution would run into troubles if there was a single quote contained inside the string - if this is an issue, then what about if the user places a comma inside the string? Edit: As a final point, you can do it like this, using regular expressions: <?php $str = 'something1,something2,1\,2\,3'; $bits = split('[^\\],',$str); print_r($bits); ?>
  3. You can do it all with mysql functions: SELECT TIME_FORMAT( TIMEDIFF( NOW( ) , `yourfield` ) , '%i' ) AS difference FROM `yourtable` This will return the number of whole minutes between your timestamp and the current time.
  4. Personally i hate websites where the lost password function returns your original password. This is inherently more insecure than a hashed password which would not be retrievable. I also dislike the idea of having my normal password stored in one of my emails - if i'm logged in to my email and someone were to read that email, they would have my actual password, rather than a random string that most lost password functions generate.
  5. Wow, that must be the longest post i've ever bothered to read! And i certainly notice a couple of parallels with my own problems with attempting to use linux. About a year ago, i installed ubuntu (which i agree, is very nice)but i was using a rather crappy USB wireless adatpter, which i just couldn't get to work in linux, despite the useful information i found about achieving such a thing. Now, i have a proper network card, and so would like to give ubuntu another try. However, i've since chucked away the second hard disk i installed ubuntu on, and so would need to reformat my hard drive to make a linux partition - not something i particularly want to do. I keep telling myself that either next i do a clean re-install (when windows, as you mentioned, grinds to a halt - though i have to say, to it's credit, it seems to be working well at the moment), or when i get a new hard disk/new computer, that i'll make a partition to install linux on. I only hope i remember!
  6. Believe it or not, I never learnt to ride a bike.
  7. Well, firstly, the parameter you pass is called file - with a small f. The file you try to unlink is called $File with a capital F. Also, did you retrieve that variable from the $_GET array? Try: <?php unlink($_GET['file']); ?>
  8. Not that i can think of. At the end of the day, you still have to do something with the old data, otherwise you'd end up just writing on top of all the old chat. Personally, i'd favour the option of reloading the whole chat - i could be wrong, but i think you'll find a lot of AJAX driven chats do the same. You will notice that if the chat stays idle, e.g. no one talks, the chat window will empty. That way, there's never huge amounts of data to be dealing with.
  9. If you have a website that serves a purpose (be it to make people laugh/give information/provide a service etc), then people will come. There are so many websites out there, it's likely some of them are offering the same thing as you. What makes your website different? Why would someone want to come to your website rather than another? If you don't have answers to those questions, then you wont get vary far.
  10. It rather depends on the website. I had one cURL request which failed due to a problem with the SSL certificate; for other sites you may need to specify a cookie etc.
  11. I dont think there are any options other than the two you've mentioned. You either do it via javascript, or by refreshing the whole chat window. I don't suppose either will cause a huge load - be realistic, you're not going to get 1000 lines of chat in 1 minute.
  12. For example, to sort by file type: <?php $array[1]['File_Name'] = 'test.doc'; $array[1]['File_Type'] = 'MS Word'; $array[1]['Size'] = 50; $array[2]['File_Name'] = 'test.pdf'; $array[2]['File_Type'] = 'Adobe PDF'; $array[2]['Size'] = 150; $array[3]['File_Name'] = 'test.xls'; $array[3]['File_Type'] = 'MS Excel'; $array[3]['Size'] = 60; function mysort($a,$b){ if($a['File_Type'] == $b['File_Type']){ return 0; } return ($a['File_Type'] < $b['File_Type']) ? -1 : 1; } usort($array,'mysort'); echo '<pre>'; print_r($array); echo '</pre>'; ?>
  13. You'll need to use the usort() function to define your own sorting criteria.
  14. In what way is get more insecure than post? Thats just rediculous - its simply a method for transferring data. What does it matter if someone sends a request to your page? As long as they are logged in then they should be able to chat. You dont actually care where that comes from. If they really wanted to set up their own form to send data, then why the hell not? No-one could achieve anything useful by doing that, so its not a problem.
  15. For the easiest solution, uninstall what you've installed and install wamp. You can't really go wrong with it. Of course, if your after experience of installing the various elements, then carry on. But if you just want something working, then its the easiest way to go.
  16. Try seeing if there is an error with cURL: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.mapsite.com/search.php?"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); echo curl_error($ch); curl_close($ch); echo "$result"; Edit: It could be that you need to set other headers/curl options to make this work. If the site you are connecting to shows different information based on user agent for example, then you'll need to pass that along.
  17. Using the mysql COUNT() function is quicker than the php mysql_num_rows() function
  18. Hmm, well looks like i misread. I can only assume that the field title has a case sensitive collation. Try this query: SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_general_ci = "my first dl" If that works, then modify the collation on the field.
  19. As the link i posted shows, you need to set the collation to one of the case senstive options. If you want all of your searches on that field to be case senstive, then modify the collation on the field. If you just want this particular query to be case sensitive, then try: SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE latin1_general_cs = "My first dl"
  20. Try: <?php $query = mysql_query("SELECT COUNT(*) FROM `Applicants` WHERE `Name`='".$userdata['user_name']."'") or die(mysql_error(); $num = mysql_result($query,0); if($num == 0){ print "<tr>"."<td>"."<INPUT TYPE=\"SUBMIT\" name=\"apply\" VALUE=\"Apply\">"."</td>"."</tr>\n"; }else{ print "<tr>"."<td>"."<INPUT TYPE=\"SUBMIT\" name=\"unapply\" VALUE=\"Unapply\">"."</td>"."</tr>\n"; } ?> The idea is that you find out how many rows exist with that given name. If it is 0, then you know it's not in the database.
  21. Why would you want to? By downloading all of your website, all people get is the generated HTML code. They can't see any of your php code. Obviously there is the problem of bandwidth, but i don't suppose huge numbers of people will be doing this anyway. My advice: don't worry about it.
  22. If you want to do this without reloading the page (as in the example you showed) then you'll need to use AJAX. There's an FAQ here: http://www.phpfreaks.com/forums/index.php/topic,155984.0.html Or for more of an introduction to AJAX, look here: http://www.ajaxfreaks.com/tutorials.php
×
×
  • 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.