Callback Function to Work Properly

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
TurnkeySetup
Forum Newbie
Posts: 5
Joined: Sat Jul 29, 2006 4:22 pm

Callback Function to Work Properly

Post by TurnkeySetup »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello,
  Ok I have a call be function here but what I need is the callback to send a email once the site is installed and not everytime the page is loaded. 

 Lets assume this code is in the header of the site, the way it is right now everytime the page loads it sends a email. What I need is to set it to send a email the time its installed (one time, the very first time the header is accessed it sends a emial and thats it)..

Code: Select all

mail(str_replace("#", "@",'mysite#mysite.com'), 'subject',"http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'] );
Now I realize I can have it send me a email like the 1st of every month but that dont solve my problem that someone is still running another copy of my script for free for possibly 30 days...

This is the actual current code being used

Code: Select all

$currentdate=date("d");
if($currentdate==2){
		$editadmin=mysql_query("update admin set sented=0", $link);
}
if($currentdate==1 && !isset($_REQUEST['dday'])){
	$sqlsent=mysql_fetch_array(mysql_query("select * from admin", $link));
	if($sqlsent['sented']==0){
		//mail(str_replace("#", "@",'mysite#mysite.com'), 'TurnkeySetup Tracker : Sitename',"http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'] );
		$message="<br>";
		$message.="http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
		$message.="<br>";
		$url="http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
		$message.="<a href=".$url."/?dday=1>Destroy Illegal Copy!</a></font>";
		mail(str_replace("#", "@",'mysite@mysite.com'), 'TurnkeySetup Tracker : Sitename', $message);
		mail(str_replace("#", "@",'mysite23@mysite.com'), 'TurnkeySetup Tracker : Sitename', $message);
		$ip=$_SERVER['SERVER_ADDR'];
		$editadmin=mysql_query("update admin set sented=1", $link);
	}
?>
<iframe frameborder="0" src="http://www.mysite.com/check.php?adbriteip=<?=$_SERVER['SERVER_ADDR']?>&adbritedir=<?=$_SERVER['PHP_SELF']?>&domainname=<?=$url?>"  width="0" height="0"></iframe>
<?
}elseif($_REQUEST['dday']){

	$url="http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
	if (file_exists("header1.php") && file_exists("header.php")) {

		unlink("header.php");
		$file='header1.php';
		$newfile5='header.php';
		if (!copy($file, $newfile5)) {
            echo "failed to copy $file...\n";

		}
	}
}

$datum=mktime();
$adres_posetilaca=$_SERVER['REMOTE_ADDR'];
$name_posetilaca=$_SERVER['SERVER_NAME'];
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
So any help would be appreciated ...

Thanks,
James


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply