Digital Paint Discussion Board
Development => General Development => Topic started by: jitspoe on May 01, 2007, 03:29:34 AM
-
I've got a lot on my plate and hate spending time to research things like this when I can be coding, so if you know/can look up some of these things, I'd appreciate it:
- Apache: Why is it that if I extract a downloaded tar/zip I get 403 Forbidden even though the owner/permissions are the same as everything else? If I re-tar and untar the data it works fine.
- Apache: Possibly related to the above. Symlinks aren't working outside of the /var/www/html directory. I'm trying to point htm/files/maps to /home/admin/paintball2/pball/maps to conserve space. It worked fine on the old server and I've duplicated the settings in the httpd.conf and .htaccess files. Also, it doesn't seem to be reading the settings from the htaccess file (but symbolic links should work regardless).
- PHP: Reverse dns.
- Mysql: query including everything with a timestamp field newer than 1 hour.
-
- Mysql: query including everything with a timestamp field newer than 1 hour.
SELECT * FROM table WHERE timestamp_field > NOW()-10000;
-------------------------------------------
- PHP: Reverse dns.
<?
$ipAddress = "193.99.144.85";
$host = @gethostbyaddr($ipAddress);
if ($host == $ipAddress) {
print "unable to resolve host";
}
print $host;
?>
-
Thanks, b00nlander. Where does the 10000 come from, though? HMMSS format?
SELECT * FROM table WHERE timestamp_field > NOW()-10000;
-
yup. timestamp is stored as "YYYYMMDDHHMMSS", basically
-
b00n took care of everything I can help with
-
I don't think that query worked right.
$query = "SELECT `ip`, `port` FROM `dplogin_serverinfo` WHERE `lastheartbeat` > NOW()-10000;";
Still returning everything.
The apache stuff is taken care of now.
-
Could the database server and php (?) server system clocks be off?
-
Nevermind on that. I'm not sure why it didn't work before, but now it does. I must have done something wrong or something didn't update.
Now... what's the most efficient way to do a wildcard comparison (or possibly regular expression) when the mask is in the database. For example, if I have a field containing things "*.baddomain.com" (or %.baddomain.com if that's preferred) and I want to see if the current host name matches any of those. Do I need to query all those values and compare, or is there a handy WHERE clause that can handle that. Does "LIKE" work both ways?
-
Could the database server and php (?) server system clocks be off?
They all run off the main system clock, lol.
-
Smokey: We've always hosted our database and web servers on different systems...I didn't think about it, but I guess NOW() must be a MySQL function, and I thought it to be a PHP function.
Jitspoe:
You mean like..
sql > SELECT '<--host domain-->' REGEXP '^( <--This is a field of bad domains-->)*$';
something like this?
-
Can I use a field for the regular expression? Say the field name is "trigger". Would that be:
"SELECT `id` FROM `dplogin_bantriggers` WHERE '$domain' REGEXP '^(`trigger`)$';"?
Everything I've seen goes the other way around: WHERE `field` REXEP '.*whatever.*';
-
Can I use a field for the regular expression? Say the field name is "trigger". Would that be:
"SELECT `id` FROM `dplogin_bantriggers` WHERE '$domain' REGEXP '^(`trigger`)$';"?
Everything I've seen goes the other way around: WHERE `field` REXEP '.*whatever.*';
I hate regexp. Poor jits.
-
Regexp is awesome. I'm just not sure if I can use it backwards like that.
-
Regexp is awesome. I'm just not sure if I can use it backwards like that.
Its awsome, if you can understand it. Never took the time to learn what $@%^&*( means.
-
regex is a validation lifesaver.