Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Anyone have any thoughts on this? Apparently, as from next year, TLDs wont just be limited to things like countries. Sounds like it'll be pretty annoying to me.
  2. You'll need a left join: $sql = "SELECT h_id,h_name,COUNT(hi_type) as count FROM header LEFT JOIN header_images ON header.h_id=header_images.hi_type GROUP BY hi_type ORDER BY count DESC"; $result = mysql_query($sql) or trigger_error(mysql_error()); while($row = mysql_fetch_assoc($result)){ echo 'ID: '.$row['id'].' Count: '.$row['count'].'<br />'; }
  3. The best place for these kind of questions is the manual. If you look under the description for the path parameter, you will notice that, by default, a cookie is only available in the folder it was set in. To access it across you site, you must specifiy a path of /
  4. Rather than posting pointlessly, you can track a topic by clicking the notify option.
  5. If you're using a windows machine you could use imagegrabwindow. I suggest you read the user notes if you do decided to try it out.
  6. You can match filenames with wildcards using the glob() function.
  7. mysql_fetch_array() returns an array containing data from the current row that has been selected. To access an element of the array, you'll need to provide the key -- which is either 0 or the field name (the default behaviour of mysql_fetch_assoc is that it gives both a numerically indexed array and an associatively indexed array. See the manual for more) So echo $row['series']; //or echo $row[0];
  8. I was going to post a reply commenting on your attitude. But i wont waste my breath.
  9. Perhaps you could try reading through the tutorial then? I'm sure if you had checked the next page/read a little, you would have noticed i was wrong and the code for the pagination is on page 3.
  10. Do you think we could see the actual code you are now using? It's a bit difficult to keep track of without it.
  11. There is an example of the correct code. On page 2 i believe.
  12. The most likely cause of these is that you not placing quotes around a key of an array which is a string. PHP then thinks the key is a constant, rather than a string. It can cope, because if PHP finds an undefined constant, it treats it as a string. I disagree with DarkWater that doing the above is a fix. It merely hides the problem. I'll direct you to my tutorial for a fuller explanation: http://www.phpfreaks.com/tutorial/debugging-a-beginners-guide In particular, see page 4.
  13. A \n would be a newline character (on certain OS's). However, a browser does not display the newline character; you'll need the <br /> tag for that. Obviously this does not want to be converted with htmlentities().
  14. Im going to direct you to a very good tutorial on pagination: http://www.phpfreaks.com/tutorial/basic-pagination There's no point in us typing out another tutorial for you on the forums; so take a look at that one
  15. That would be because you are selecting a row number, then grabbing the number of rows. It will always return one row. You need to check the value of that row: $sql="SELECT count(*) FROM $tbl_name WHERE username='$username'"; $result=mysql_query($sql); $num = mysql_result($result,0); if($num > 0){ header("location:register.php?r=1"); exit(); }
  16. Looks ok to me apart from the fact that the function doesn't have a closing brace. Not sure if you just missed that off in pasting your code though.
  17. I'm not sure i follow your description, but if you're looking to get data from the server without reloading the entire page, then AJAX is your solution.
  18. Convert the deadline to a unix timestamp and then compare with the current timestamp. Without any of your code, its a little difficult to give you any more than this: <?php $deadline = strtotime($deadline); $now = time(); if($now - $deadline < 60*60*24*5){//if less than 5 days away //colour red } ?>
  19. Most definitely. You should never ever trust user's data.
  20. Two problems: 1.) filesize() expects the filename not the resource handler. 2.) If you want to read existing data, you'll need r, not w -- using w wipes the file first. (see: http://www.php.net/fopen) So: $fp = fopen("C:\hello.txt", 'r+'); $letter = fread($fp, fileszie("C:\hello.txt"));
  21. It's a little awkward to point out exactly what's wrong with your script without having some sample data. Either way, if you can guarantee that an ID couldn't be part of an address, you could just do a simple search for that ID in the file: $file = file_get_contents('data/clients.DAT'); if(strpos($file,$a) !== false){ //exists }else{ //doesn't exist -- write to file } Of course, using a database would be an easier alternative.
  22. yes, you may right .. but even then giving those keys/IDs in address bar (GET method) is something not so standerd .. also why dont bound them to give "slightly more effort" if they want to break it, rather then giving them ready-made . And I dont get how you can get post variables by viewing source, you can do that in case of GET vars, as far as I know. If your application would break because someone found an ID then you pretty deep in the brown stuff.
  23. Right, because it's so difficult to view the source to look at the ID? The idea that POST is somehow more secure than GET is a complete falacy. Sure it might take slightly more effort, but it's no more secure.
  24. Right, but the value isn't changed by the user. So just add a hidden field which contains the same value.
  25. Erm, perhaps contacting the people who made that particular forum would be more appropriate?
×
×
  • 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.