Soldato
Add the moment adding new users to my main sig script is quite a labour intensive process and due to the impending demise of the GamesNight Crew script I can see that there is going to be a fair bit of demand for this.
Please bear with me whilst I try to come up with a better way of managing things, in the meantime I have posted below a version of my script which can run independently of the database that my main script uses. Anyone who has webspace which supports php can modify the variables to suit their needs and upload it to their webspace.
Also if anyone has experience of developing a webpage which can allow users to modify data in a MySQL database in a secure manner (ie people shouldn't be able to tweak other people's sig) and wants to put something togther for me it would be much appreciated.
The red line highlights a change made at 8:47 on 14th Jan - If you have a copy of this script older than this then you will need to change the line as shown.
Please bear with me whilst I try to come up with a better way of managing things, in the meantime I have posted below a version of my script which can run independently of the database that my main script uses. Anyone who has webspace which supports php can modify the variables to suit their needs and upload it to their webspace.
Also if anyone has experience of developing a webpage which can allow users to modify data in a MySQL database in a secure manner (ie people shouldn't be able to tweak other people's sig) and wants to put something togther for me it would be much appreciated.
The red line highlights a change made at 8:47 on 14th Jan - If you have a copy of this script older than this then you will need to change the line as shown.
Code:
<?php
//Code for overlaying SETI stats over a JPEG or PNG image
//By Phil Cutler (kaiowas) of Team OcUK Oct 2002
//Visit the OcUK team forum: [url]http://forums.overclockers.co.uk/forumdisplay.php?s=&forumid=39[/url]
//Uses a local file to cache the users total and reduce bandwidth hit on Berkeley
//Setup Variables For Sig
$UserEmail="[email protected]";
$PreText="";
$PostText="WU";
$TextRed=251;
$TextGreen=251;
$TextBlue=251;
$FontSize=9;
$TextX=83;
$TextY=36;
$ImageURL="http://www.kaiowas.plus.com/images/legosig/LegoSig_05.png";
$UpdatePeriod=3600; //Maximum frequency in seconds at which the script will poll Berkeley
//Setup Variables For Webspace - Must be absolute paths
$LocalFile="/files/home3/kaiowas/cmp/WUTotal.dat";
$FontFile="/files/home3/kaiowas/cgi-bin/fonts/verdana.ttf";
[color=red]if(!FileMTime($LocalFile) or time()-FileMTime($LocalFile)>$UpdatePeriod)[/color]
{
//Get Total Number Of WUs from personal stats page at Berkeley
$fp =@fopen ("http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?email=" . $UserEmail . "&cmd=user_stats_new", "r");
if ($fp)
{
while (!feof($fp))
{
$WebPage.=fgets($fp,200);
}
if (strpos($WebPage,"No user with that name was found")==0)
{
$TotalStart=strpos($WebPage,"Results Received");
$StartPos=strpos($WebPage,"<td>",$TotalStart)+4;
$EndPos=strpos($WebPage,"</td>",$StartPos);
$WUs=ltrim(rtrim(substr($WebPage,$StartPos,$EndPos-$StartPos)));
}
else
{
$WUs="User not found.";
}
}
fclose($fp);
//Update Local File With Total
$Output = fopen ($LocalFile, "a");
ftruncate ($Output, 0);
fseek($Output,0);
fwrite($Output, $WUs);
fclose($Output);
}
else
{
//Read Total from Local File
$Local=@fopen ($LocalFile, "r");
$WUs=fgets($Local,200);
fclose($Local);
}
//Build Text String
$Text=$PreText . " " . $WUs . " " . $PostText;
//Create Image
$size = ImageTTFBbox ($FontSize, 0, $FontFile , $Text);
$im_x=abs($size[4]-$size[0]);
$im_y=abs($size[5]-$size[1]);
if (substr($ImageURL,strlen($ImageURL)-3,3)=="jpg")
{
//Create a Sig image based on a JPEG
Header("Content-type: image/jpeg");
$im_size = GetImageSize ($ImageURL);
$imageWidth = $im_size[0];
$imageHeight = $im_size[1];
$im = ImageCreateFromJPEG($ImageURL);
$text_color = imagecolorclosest ($im, $TextRed, $TextGreen, $TextBlue);
if ($TextX+$im_x>$imageWidth){$TextX=$imageWidth-$im_x-2;}
if ($TextY>$imageHeight){$TextY=$imageHeight-2;}
imagettftext ($im, $FontSize, 0, $TextX, $TextY, $text_color, $FontFile, $Text);
ImageJpeg ($im);
ImageDestroy ($im);
}
elseif (substr($ImageURL,strlen($ImageURL)-3,3)=="png")
{
//Create a Sig image based on a PNG
Header("Content-type: image/png");
$im_size = GetImageSize ($ImageURL);
$imageWidth = $im_size[0];
$imageHeight = $im_size[1];
$im = ImageCreateFromPNG($ImageURL);
$text_color = imagecolorclosest ($im, $TextRed, $TextGreen, $TextBlue);
if ($TextX+$im_x>$imageWidth){$TextX=$imageWidth-$im_x-2;}
if ($TextY>$imageHeight){$TextY=$imageHeight-2;}
imagettftext ($im, $FontSize, 0, $TextX, $TextY, $text_color, $FontFile, $Text);
ImagePNG ($im);
ImageDestroy ($im);
}
?>
Last edited: