Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Sorry, what? What are you trying to compare? I could be wrong, but it looks to me like a large amount of that code is irrelevant to your problem. Try narrowing it down.
  2. I think you're looking for implode. Something like: $array = array(); while($r = @mysql_fetch_array($res)){ $array[] = $r['code_id']; } $string = implode(',',$array); echo $string;
  3. Oh my. How embarrassing. I've just realised that i've had firefox zoomed out marginally for the past few hours and that was what was causing the issue. Whoops.
  4. Anyone else noticing some problems with the horizontal borders between topics? Seems a few are missing, but with little consistency - seems to affect the top 6 posts on quite a few boards, but sometimes it's just the top 2 or the first post is fine and then there's problems. I get the problems with Firefox 3.05 in ubuntu, though it doesn't happen with the same version of firefox running under Wine :s [attachment deleted by admin]
  5. And where do you propose this sticky is put? In every single forum? Don't you think that's a bit pointless. It's all covered in the rules anyway. You know, that link in the me. I'm going to assume you just needed a good rant. Which is fair enough really.
  6. No. $myoffers = mysql_query("SELECT DISTINCT(trade_id), item_id, user_id, cp FROM `trade_offers` WHERE `user_id`='$userid' LIMIT 0,1"); $myoffers is a mysql result resource. Apart from anything else, you'll need to extract the relevant data out of it first. Even then, you'll need to compare the current time with the time the offer was made. How you do that will depend on what format the data is in.
  7. 1.) im using javascript for form validation. Solely relying on javascript for form validation is always a bad idea. What about users who turn it off? You should always back up client side validation which may be done to improve the user experience with server side validation. 2.) To prevent bots, you could use a captcha. You'll find plenty of tutorials or existing scripts if you google. Alternatively, you could set a hidden field in your page. Users will never see it and thus wont fill it in. The majority of bots wouldn't realise it was hidden so will fill it in. You can then set up your script to only process the rest of the form if this field isn't filled in. Or probably not at all. I can't imagine too many bots being sent out with a spurious user agent being specified.
  8. If you're asking us to do this for you, you'll need to post over in the freelance board. If you want to tackle it yourself, you'll find a whole host of php tutorials for this kind of thing - but break it down; search for some registration tutorials and learn about that, then take a look at image uploading etc. If you get stuck with something in particular, you can always post here. Lastly, you'll find plenty of existing scripts for some of these things - the image gallery for example. You may be able to use one of those and modify it for your needs. Again, google is your friend.
  9. Unfortunately it took an awful long time for a lot of hosts to turn the setting off due to so many older scripts relying on them and the expected nightmare of dealing with 4 billion "my site's broken" support requests. This meant it look even longer for some people to become aware that it was a bad practice - there used to be a lot of people who just thought that was how PHP worked.
  10. Order by the time? Compare the time with now and see if 15 minutes has passed? After 3000 posts, i would have thought you'd have realised it might help to post some relevant code.
  11. That will indeed work but if you're only wanting the name field, that is all you should select (rather than selecting all fields, which * does). Selecting more fields than you need is inefficient.
  12. 1.) You need to place that loop between the <form> tags - otherwise those submit buttons you're echoing wont be part of the form. 2.) You're going to need some way of identifying which friend requests are being accepted/rejected. Perhaps make the submit button's name an array with the id of the friend/friend request as the key.
  13. That's a pretty nasty way of checking if they're active or not. I'd do much more of the work with mysql: (Edit: Comment wasn't directed at you Mchl or Ken; but i'd still do the work with mysql.) $sql = "SELECT COUNT(*) FROM yourtable WHERE username='$username' AND start_date + INTERVAL type MONTH >= CURDATE()"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); if(mysql_resut($result,0) > 0){ //active subscription }else{ //subscription ended. } Im assuming that you're start_date field has type DATE, your type field contains the number of months of their subscription and you have a field called username
  14. Sounds like all of your problems are to do with the register_globals directive. Perhaps someone finally got round to turning this off (it should be off, it's a security issue), causing you a problem. Either fix your code to work with the superglobal arrays(best method), turn them back on or write something to create local variables from all inputs (such as that found here)
  15. For starters, try debugging the query: $shoutresult = mysql_query($shoutquery) or trigger_error(mysql_error(),E_USER_ERROR);
  16. According to ISO specification (on which the PHP date functions are based!?) the 2.1.09 is in week 53. Yep, it's very critical as a major script is built upon correct/valid week number function :-// thanks According to wikipedia, this is week 1.
  17. Please define "doesn't work". What happens? Do you get an error message?
  18. You need to use a comma to separate the things you wish to order by, not AND.
  19. Yup. Use arrays for the names of the text fields. I'd go with two dimensions like this: <input type="text" name="data[a][sf]" /><br /> <input type="text" name="data[a][be]" /><br /> <input type="text" name="data[a][bb]" /><br /> <input type="text" name="data[b][sf]" /><br /> <input type="text" name="data[b][be]" /><br /> <input type="text" name="data[b][bb]" /><br /> //etc Then use PHP like this: $temp = array(); $temp2 = array(); foreach($_POST['data'] as $type => $stats){ $temp2[] = "('".mysql_real_escape_string($type)."'"; foreach($stats as $stat){ $temp2[] = "'".mysql_real_escape_string($stat)."'"; } $temp[] = join(',',$temp2).')'; $temp2 = array(); } $sql = join(',',$temp); $sql = "INSERT INTO yourtable SET (type,sf,be,bb) VALUES $sql"; mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR);
  20. You'll need to save the alpha channel information of $image2 before you save it with imagesavealpha
  21. Perhaps you're looking for the UNION sql clause? I'm not entirely sure if that's what you're after from your description though - perhaps you could give us an example.
  22. So the final table is the result you're after? That is, this one: If so, it should be a simple case of a HAVING clause: SELECT *,COUNT(*) as friend_count FROM people WHERE member = 1 OR member = 4 GROUP BY friend HAVING friend_count=2
  23. You don't need to use the strcmp() function - just return the difference between the two integers. That said, if this data is coming from a database, why don't you sort in the query?
  24. Better to do it all in the query: $sql = mysql_query("SELECT *,UNIX_TIMESTAMP(startdate + INTERVAL 3 DAY) AS timestamp FROM pleagues WHERE id = '".$league."'") or die(mysql_error()); The timestamp would then be in $data['timestamp'];
×
×
  • 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.