script recommander cette page
Posté : 26 janv. 2008, 16:47
bonjour,
J'ai trouvé un script de recommandation de page seulement voila il ne fonctionne pas. Je pense que le script n'est pas complet car il est censé fonctionner avec mysql mais je ne vois rien dans le code qui permette d'établir la connexion. Pourriez vous m'aider s'il vous plait? voici les codes referrer.php
refer_link
referrer_log
il y a aussi un fichier referrer.txt à mettre en CHMOD 666
Je vous précise que j'ai essayé de contacter l'auteur du script, mais sans résultat
J'ai trouvé un script de recommandation de page seulement voila il ne fonctionne pas. Je pense que le script n'est pas complet car il est censé fonctionner avec mysql mais je ne vois rien dans le code qui permette d'établir la connexion. Pourriez vous m'aider s'il vous plait? voici les codes referrer.php
Code : Tout sélectionner
// log file and date output, these proabably won't have to be changed
$log_file = "referrer.txt";
$date_output = date("n/j/y h:i:s A");
// Config the email sent out here!
// The key of the codes you can use in the email are below.
// Please test out a message to make sure it's what you want before you put it up on your site.
/*
$date_output
this is the date the refer of the page was sent
$url
this is the URL that the person is sending
$senders_name
this is the name of the person sending email to someone
$senders_email
this is the email address of the sender
$emails
this is the list of email(s) of the people the send is referring
$message
this is the message the persons types and sends along with the link
*/
// now below you can use those above codes to put information into the emails
################### config the emails here! ###################
// put what you want the title of the email to be here
$send_refer_Email_message_title = "PHPNewbie.net message from $senders_name";
// put in what you want the email it's self to say here
$send_refer_Email_message = "Sent on $date_output
$senders_name wanted to tell you about this page on www.PHPNewbie.net
$url
They have also left the following message:
$message";
################### STOP! ###################
?>
<html><head>
<title>Send page to a friend</title>
</head><body>
<?
if(!empty($send)){
if(empty($senders_name) || empty($emails) || empty($senders_email) || empty($message)) {
echo "The following errors have occured.<br><hr>";
if(empty($message)){ echo "You didn't enter a message<br>"; }
if(empty($senders_name)){ echo "You didn't enter your name<br>"; }
if(empty($emails)){ echo "You didn't enter any emails to send it to<br>"; }
if(empty($senders_email)){ echo "You didn't enter your email"; }
echo "<hr> Please fix them and try again.";
$error = "yes";
} else {
$message = stripslashes($message);
$senders_name = stripslashes($senders_name);
mail(
"$emails", "$send_refer_Email_message_title", "$send_refer_Email_message", "From: <$senders_email>");
$message = str_replace ("\r\n","<br>", $message);
$to_log = "$date_output|::|$url|::|$senders_name|::|$senders_email|::|$emails|::|$message|::|\n";
// logs the email
$fp = fopen($log_file, "a");
$fw = fwrite($fp, $to_log);
fclose($fp);
echo "Thank you! Email(s) have been sent.";
}
}
if(empty($send) || $error == "yes"){
$message = stripslashes($message);
$senders_name = stripslashes($senders_name);
echo "<form action=referrer.php method=post>\n";
echo "<input type=hidden name=url value=\"$url\">\n";
echo "<b>Refering: $url</b><p>\n";
echo "<small>Enter all the emails of the people you want to send this page to.<br>\n";
echo "Seperate them by commas.</small><br>";
echo "Email(s) to send to: <br><input type=text size=30 name=emails value=\"$emails\"><br>\n";
echo "Your name:<br><input type=text size=25 name=senders_name value=\"$senders_name\"><br>\n";
echo "Your Email:<br><input type=text size=25 name=senders_email value=\"$senders_email\"><br>\n";
echo "Your message: <small>(this will have the link to the page already included)</small>\n";
echo "<br><textarea rows=8 cols=40 name=message>$message</textarea><br>\n";
echo "<input type=submit value=\"Send Email(s)\" name=send>\n";
echo "</form>";
}
?>
</body></html>Code : Tout sélectionner
/ You must include paste this code on the pages
// that you want people to be able to refer to someone
// Put in the FULL URL to the referrer.php file
$URL_to_referrer = "http://www.domain.com/referrer.php";
// Put in what you want the link text to be, you can also enter a image tag if you wish
$refer_link = "Recommend this page";
?>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- start
function NewWindow(mypage, myname, w, h, top, left, scroll, resize, status, menubar, toolbar, resizable, address) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winops = 'height='+h+',width='+w+',top='+top+',left='+left+',scrollbars='+scroll+',resize='+resize+',status='+status+',toolbar='+toolbar+',resizable='+resizable+',location='+address+''
win = window.open(mypage, myname, winops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// end -->
</script>
<?
// on the page where you want it to be refered
if(!empty($QUERY_STRING)){ $query= '?'.$QUERY_STRING; }
$full_URL = 'http://'.$HTTP_HOST.$PHP_SELF.$query;
$full_URL = urlencode($full_URL);
echo "<a href=$URL_to_referrer?url=$full_URL onClick=\"NewWindow(this.href,'name','400','425', '0', '250', 'yes','no', 'no', 'no', 'no', 'no');return false;\">$refer_link</a>";
?>Code : Tout sélectionner
// Set the admin password for
$set_password = "test";
// the file that the archive is stored in
$logfile = "referrer.txt";
// number to archive by
$perPage = 10;
#################### STOP! ####################
echo "<html><head><title>Referrer Log</title></head><body>";
echo "<h1 align=center>Referrer Log</h1>";
if($set_password != $password){ ?>
<center>Enter Password:<br>
<form action=referrer_log.php method=post>
<input type=password name=password>
</form>
</center>
<?
} else {
if(empty($number)){
$number = $perPage;
}
$file_line = file($logfile);
$total_lines = count($file_line);
echo "<center>total: ".($total_lines)."<br>";
echo "Now showing: ".($number-($perPage-1))." to ".($number)."</center>";
echo "<hr>";
for($i=($total_lines-1); 0 <= $i; $i--) { $line[] = $file_line[$i]; }
for($i = 0; $i < $total_lines; $i++){
if ($i >= ($number-$perPage) && $i < $number){
$line_array = explode("|::|",$line[$i]);
$line_array[0] = stripslashes($line_array[0]);
$line_array[1] = stripslashes($line_array[1]);
$line_array[2] = stripslashes($line_array[2]);
$line_array[3] = stripslashes($line_array[3]);
$line_array[4] = stripslashes($line_array[4]);
$line_array[5] = stripslashes($line_array[5]);
/*
$date_output = $line_array[0]
$url = $line_array[1]
$senders_name = $line_array[2]
$senders_email = $line_array[3]
$emails = $line_array[4]
$message = $line_array[5]
*/
echo"
<b>Sent on:</b> $line_array[0] <b>by</b> $line_array[2] ($line_array[3])<br>
<b>URL:</b> <a href=\"$line_array[1]\" target=_blank>$line_array[1]</a><br>
<b>Sent to:</b> $line_array[4]<br>
<b>Message</b>: $line_array[5]
<hr>";
}
}
echo "<center>";
$y=1;
$num=$perPage;
while($total_lines > ($num-($perPage))){
if($perPage < $total_lines){
if(($number-($perPage-1)) == $y && $number == $num){
echo "[$y-$num] ";
} else { echo "[<a href=\"?password=$password&number=$num\">$y-$num</a>]\n";
}
}
$num+=$perPage;
$y+=$perPage;
}
echo "</center>";
}
?>
<small>Refer Page by <a href=mailto:[email protected]>Blake McDonald</a>, ©2000</small>
</body></html>il y a aussi un fichier referrer.txt à mettre en CHMOD 666
Je vous précise que j'ai essayé de contacter l'auteur du script, mais sans résultat