![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
So Fucking Banned
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
|
Cron Jobs - why doesn't this work
I wrote a simple PHP script and set in CPanel Cron Jobs to run it every midnight. Here is the source (gal_update.php):
<? copy("gal_today.html","gal_yesterday.html"); $fp = 'fopen("gal_today.html", "w")'; fputs($fp,"<TABLE width=650 bgcolor=Black align=center cellspacing=1 cellpadding=3><TR bgcolor=Navy><TD>\n"); fputs($fp," <TABLE width=100%>\n"); fputs($fp," <TR bgcolor=Navy align=left>\n"); fputs($fp," <TD width=33%>\n"); fputs($fp," <TABLE cellspacing=0 cellpadding=0 border=0>\n"); for ($i = 1; $i < 34; $i++) { fputs($fp,gen_link($i)); fputs($fp,"\n"); } fputs($fp," </TABLE>\n"); fputs($fp," </TD>\n"); fputs($fp," <TD width=33%>\n"); fputs($fp," <TABLE cellspacing=0 cellpadding=0 border=0>\n"); for ($i = 1; $i < 34; $i++) { fputs($fp,gen_link($i)); fputs($fp,"\n"); } fputs($fp," </TABLE>\n"); fputs($fp," </TD>\n"); fputs($fp," <TD width=33%>\n"); fputs($fp," <TABLE cellspacing=0 cellpadding=0 border=0>\n"); for ($i = 1; $i < 34; $i++) { fputs($fp,gen_link($i)); fputs($fp,"\n"); } fputs($fp," </TABLE>\n"); fputs($fp," </TD>\n"); fputs($fp," </TR>\n"); fputs($fp," </TD></TR></TABLE>\n"); fputs($fp,"</TABLE><BR>\n"); fclose; function gen_link ($i) { require '/home/phrona/public_html/galadmin/mysql.php'; mysql_connect ($dbhost, $dbuser, $dbpass) or die ('Error: ' . mysql_error()); mysql_select_db ($dbname); $result = mysql_query("SELECT sponsorid FROM galleries ORDER BY sponsorid DESC LIMIT 1") or die ('Error: ' . mysql_error()); $log = mysql_fetch_array($result); $sponsorid = rand(1,$log[sponsorid]); $result = mysql_query("SELECT galleryno FROM galleries WHERE sponsorid='$sponsorid' ORDER BY galleryno DESC LIMIT 1") or die ('Error: ' . mysql_error()); $log = mysql_fetch_array($result); $galleryno = rand(1,$log[galleryno]); $result = mysql_query("SELECT description,content_count,url,sponsor FROM galleries WHERE sponsorid='$sponsorid' AND galleryno='$galleryno' LIMIT 1") or die ('Error: ' . mysql_error()); $log = mysql_fetch_array($result); $description = $log[description]; $content_count = $log[content_count]; $url = $log[url]; $sponsor = $log[sponsor]; $url = urlencode($url); if (($i/5) hahahaha (intval($i/5))) { $content_count = rand(50,99); $url = "cgi-bin/ucj/c.cgi?link=gal__skim"; $link = "<TR><TD align=right><B>$content_count LIN</B> </TD><TD><A name=free_teen_porn href=$url target=_blank>$description</A></TD></TR>"; } else { $url = "cgi-bin/ucj/c.cgi?url=$url&p=80&link=gal_$sponsor"; $link = "<TR><TD align=right><B>$content_count</B> </TD><TD><A name=free_teen_porn href=$url target=_blank>$description</A></TD></TR>"; } return $link; } ?> Hosting support done its best, but nothing was solved. When I run this script by hand, it works without any problems, but when I try to run it using cronjobs, I receive this error (to my e-mail): /home/phrona/public_html/gal_update.php: line 1: ?: No such file or directory /home/phrona/public_html/gal_update.php: line 2: syntax error near unexpected token `'gal_today.html','gal_yesterday.html'' /home/phrona/public_html/gal_update.php: line 2: ` copy('gal_today.html','gal_yesterday.html'); ?>' Replacing gal_today.html and gal_yesterday.html with absolute paths doesn't work - same error. Anyone can help? Please answer here and if you think we can discuss it (you need more info etc.), let here your ICQ. Thank you all very much. |
![]() |
![]() ![]() ![]() ![]() ![]() |