View Full Version : Apparant server side problem...
jefbea
11-29-2000, 10:25 AM
First of all, I had a PHP programmer make this script for me.[nbsp][nbsp]I have a classified ad section on my site that is supposed to delete ads after XXX number of seconds (30 days).[nbsp][nbsp]For the last two months we've been testing it and it works on every other server (we've tried four different ones) except for the FutureQuest servers.[nbsp][nbsp]
I don't really know how to ask this question since I am not a great PHP programmer, but here is where the code can be found:
http://www.lease2purchase.com/php/classifieds/class.php
Thanks for any insight into this, FutureQuest.
Jeff
jefbea
11-29-2000, 10:26 AM
P.s. Maybe you (futurequest) could look at my PHP error logs to see if anything comes up there?
Just a thought...
Thanks again.
Jeff
I don't pretend to know the answer (at least not without knowing the question), but two questions I have are:
1) Is the code viewable somewhere on that page?[nbsp][nbsp](It would need to be saved in a text file or something, since PHP code is executed on the server and viewable only as HTML through the browser).
2) What is the question?
Dan
Terra
11-29-2000, 11:17 AM
Just because a script will work on 4 other servers, does not mean that it will work on ours - _and_ vice versa...
We cannot directly support 3rd party programs, and you will need to have the programmer log in to your account to isolate and adjust the program...[nbsp][nbsp]It boils down to the perspective of spending an hour or more of programming time debugging one script - or allocating that time to build things that thousands will use...
Most likely, the other 4 servers are not running as tight of security on their domains and PHP execution environment...[nbsp][nbsp]We run a tight configuration, and the tradeoff for this is more careful and thought out programming practice...
Hope this helps to narrow down the problem...
--
Terra
--Security is inversely proportional to convenience though I do my best to balance it out--
FutureQuest
Terra
11-29-2000, 11:23 AM
One more thing, please note that you are running on PHP 4.0.3pl1 as is shown via your phpinfo()...[nbsp][nbsp]Possibly this was written for PHP 3?
A quick update: I have asked our resident PHP expert 'Justin Nelson' to try and find some time for a cursory overview and see if it's a server configuration problem...
He may or may not find your problem - but he will at least verify our PHP integrity...
--
Terra
--Over a hundred domains on RASMUS ensure it's PHP integrity everyday--
FutureQuest
Justin
11-29-2000, 07:36 PM
The first thing I would do in this situation would be to simplify. First off, never use 'select *' unless you actually plan to use all available fields. In fact, even then you should specify the fields you want, as 'select *' creates an additional query (internally) to first determine what fields are available...
The simplest method would be:
</font><font face="Courier" size="3">
$time = time() - 86400 * 30; // 30 days ago
$result = mysql_query ("delete from class where time < '$time'");
if ($result) {
[nbsp][nbsp] print mysql_affected_rows ($result) . " rows deleted.";
} else {
[nbsp][nbsp] print "Error: " . mysql_error();
}
</font><font face="Verdana, Arial" size="2">
This is the most straight forward, as it requires only a single query, and checking the result (rather than assuming mysql_error() will be enough).
Once you've simplified your query, then you can proceed to figure out why it doesn't work (if it still doesn't work).
Hope this helps.
------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support
jefbea
11-29-2000, 08:24 PM
I will try that, Justin... I will post the results soon.
Thanks.
Jeff
jefbea
11-30-2000, 01:21 AM
Fair enough -- I look forward to hearing what Justin says.[nbsp][nbsp]In the meantime, I am going to try and get the actual code that deletes the database entries to show you and maybe you can point out whether I am an idiot or just plain crazy...
$sqlclean = mysql_query("SELECT * FROM class", $bd);
echo mysql_error();
$aaa = MYSQL_NUMROWS($sqlclean);
for($zz=0;$zz<$aaa;$zz++){
$times = (mysql_result($sqlclean,$zz,"time"));
if(($times += 2592000) < $timestampa)
{//echo "$times
";
$delsql = "delete from class where time = '$times'";
mysql_query($delsql,$bd);
echo mysql_error();
}
}
2592000 seconds is 30 days... ;-)
It produces no erros...
If you run the same command at the mysql prompt it works fine...
If you echo the $delsql it prints the same text as the command would be that you enter into the mysql prompt...
$times is equal to the timestamp that the ad was placed in seconds...
Thanks again...
Jeff
jefbea
12-02-2000, 01:19 AM
That code appears to have worked... I will double check it on monday as a few more ads are scheduled to be deleted over the weekend.
Thanks for the help -- I really appreciate it!
Jeff
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.