Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. <?php $test = socket_create(AF_INET,SOCK_STREAM); while ($e = each($server)) { $status = 'off'; if (socket_connect($test,$e['serverIP'],$e['serverPort'])) $status = 'on'; echo "{$e['serverName']} {$status}line"; } ?> oh I'd also like to note I am not completely sure you can reuse a socket resource but this one tries to atleast, tell me if you get any errors.
  2. sorry don't use the above.. I made a boo-boo <?php $prev_room = -1; $hours = array(); while ($r = mysql_fetch_assoc($theQuery)) { if ($r['room_id'] != $prev_room) { $hours[$r['room_id']] = array_combine(range(0,23),array_fill(0,23,'available')); $prev_room = $r['room_id']; } $e = explode(':',$r['start_time'].':'.$r['end_time']); $s = $e[0]; $e = $e[3]; while ($e > $s) { $hours[$r['room_id']][$e - 1] = 'not available'; $s++; } } print_r($hours); ?> use that instead
  3. no no no -.- use something like md5($email.'2762@uya7s'.$password.'876aiuyas'); and just use that again from the database info and compare it to the md5 sentback in GET from the email
  4. no no you won't change any link tags or anything, just add the css.php file to your home directory, then in the .htaccess put: RewriteEngine on RewriteRule ^(.*\.css)$ css.php?file=$1 and htaccess will keep the usual url but will point to the css.php file pass the file via get and css.php will push headers from php then echo the file's contents
  5. this is quite interesting try making the query like this: SELECT * FROM bookings WHERE date= 2009-09-30 ORDER BY room_id ASC, start_time ASC to keep all the rooms in order than all the start_times in order then loop through the results with something like this <?php $prev_room = -1; $hours = array(); while ($r = mysql_fetch_assoc($theQuery)) { if ($r['room_id'] != $prev_room) { $hours[$r['room_id']] = array_combine($k = range(0,23),array_fill(0,23,'available')); $prev_room = $r['room_id']; } $e = explode(':',$r['start_time'].':'.$r['end_time']); $s = $e[0]; $e = $e[3]; while ($e > $s) { $hours[$r['room_id']][$e - 1] = 'not available'; $e++; } } print_r($hours); ?> then $hours should hold an array of available and not-available
  6. heres an example: SELECT * FROM table ORDER BY organization ASC SELECT * FROM table ORDER BY organization DESC
  7. idk about the others, but the 'expires' header can be sent with a tiny run around RewriteRule ^(.*\.css)$ css.php?file=$1 and in css.php <?php header('Content-Type: text/css'); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); readfile($_GET['file']); ?> ?>
  8. oh!! you could also do something like this: SELECT * FROM table WHERE email LIKE '%@hotmail.%' haha coz you can't have @ in your name in an email so that should always be accurate
  9. $q = mysql_query("the select"); while ($row = mysql_fetch_assoc($q)) { // cache or w.e here $row will hold only rows with the ip that matches }
  10. the suggested replacement essentially does the same thing but pushes a ton of extra information where as all he wants is the names
  11. I think maybe mysql doesn't support lazy repetition. just remove the ? from after the +
  12. <?php include('connectionInfo.php'); $fields = mysql_list_fields('database','table'); $i = 0; $db_fields = array(); while ($field = @mysql_field_name($fields,$i++)) { $db_fields[] = $field; } ?> you can also use this well you'd hafta modify it a bit to work in your class and probably don't need to include the connection info I just put that there to show you actually need an active connection
  13. RIGHT ON SELECT * FROM table WHERE email REGEXP '[^@]+?@hotmail\.[a-z.]{2,5}'
  14. SELECT * FROM table WHERE `IP` LIKE '%{$IP}%' that will look for any `ip` field which contains the ip that is contained in $IP
  15. that just says there is no need to seed it.. if you want to seed it you still can, however, you get a relatively random number already says php.
  16. ok let me try to understand.. you're going into your database and pulling a row.. and trying to assign the fields as attributes and the values of those fields as the values of the attributes... for example: db query returns an array like: $row['id'] = 19; $row['name'] = 'timmy'; $row['age'] = 95; you want to transform that into $this->id = 19; $this->name = 'timmy'; $this->age = 95; if so you'd do something like: foreach ($row as $k => $v) { $this->$k = $v; }
  17. "SELECT * FROM table WHERE `IP` = '{$IP}'" run that query you'll get results which have the same IP as $IP, however.. this is not a very good method to use to extend sessions, store the session id in its own field, then when a user logs in.. read his row's data, and start the session with the old id so that php doesn't start a completely new session its quite easy
  18. well, obviously, but this is a regex forum so I tried to keep up
  19. do you have php installed..? btw add me to msn or aim I want to discuss something with you but I might be goin to sleep soon, but add me anyway drop me a message and I'll hit you up later
  20. SELECT * FROM table WHERE LOWER(email) REGEXP '[^@]+@hotmail.com$'
  21. straight from php.net this is what I use and has always been true <3 <?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past ?>
  22. maybe try adjusting the syntax <?php if(isset($_POST['YES'])){ $sql = } ?> should probably look something like: <?php if (isset($_POST['YES'])) { $sql = ''; } ?>
  23. if you're using the paypal API they usually send a hit to a file on your server if I'm not mistaken to let you know confirmed or denied, although I've never integrated their system on any of my sites/projects, but I have looked @ some API videos from paypal and thats how it seems to work to me.
×
×
  • 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.