WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : phpRecommend v1.2 - UPDATED - recommend this page to a friend script - VERY easy install - now with data logging to text file
Categories : Complete Programs, PHP, Link to Article, URLs, Misc Click here to Update Your Picture
A. Gianotto
Date : Jul 31st 2000
Grade : 4 of 5 (graded 2 times)
Viewed : 8360
File : No file for this code example.
Images : No Images for this code example.
Search : More code by A. Gianotto
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/************* PHPRecommend v 1.2 ***************/
/************************************************/
/* written by A. Gianotto - 3/28/2000 */
/* To find out if this is the latest version */
/* of this script, email [email protected], or */
/* visit http://www.snipe.net */
/************************************************/
/************************************************/
/* PHPRecommend may be used freely for private */
/* or commercial use. All I ask is that you */
/* don't include it in any collections without */
/* my permission. */
/************************************************/
/************************************************/
/* DESCRIPTION: */
/* PHP "Recommend this page to a friend" script */
/* */
/************************************************/
/************************************************/
/* NEW IN VERSION 1.2 - LOGGING TO TEXT DATABASE*/
/* ADDED 7/31/00 */
/* */
/* If you wish to use this feature, the only */
/* additional step you must take is to upload */
/* a blank text file into the same directory as */
/* this script lives. For our purposes, we */
/* have named it "url-log.txt". You may name */
/* it whatever you like, but if you change the */
/* name, be sure to change it in the variable */
/* below, where it's marked */
/* */
/* Also BE SURE TO CHMOD THE TEXT FILE TO 666 */
/* so that the sever can open the file and */
/* write to it. */
/* ENJOY! */
/************************************************/
/************************************************/
/* INSTALLATION: */
/* There is no readme or install file with */
/* script, because it's so easy to install, */
/* you just have to follow the comments in the */
/* first part of the code */
/************************************************/
/************************************************/

// make this point to your header file. rename the file
// and the path to point to the correct file on your server
// If you do not use a header or footer file, simply replace
// the header and footer includes with the proper HTML code
// for your site

include("/usr/home/your-site.com/html/inc/header.inc");

// Change the variable below to "no" if you do not wish to write
// the data to a text log
$logging="yes";

// Enter the website administrators email address here
$adminaddress = "[email protected]";

// Enter the company name or site name here
$sitename = "your-site.com";

// Enter the address of your website here
$siteaddress ="http://www.your-site.com";


// Unless you are changing the verbage of the printed message,
// there are no further configurations that need to be done
// past this point, except editing the path to your footer includes

// If you do not use header and footer files, you can just replace
// the include calls with your HTML, but be sure to close the PHP tags
// before and after the HTML, so you don't get parse errors.


IF ($action==""):
?>

<H3>Recommend this page to a friend!</H3>
<?
$referer = getenv("HTTP_REFERER");
print "<B>$referer</B><BR><BR>";

?>
To send the URL of this page and a brief message to a friend who might like it, just fill out the
form below.
<BR>
<BR><B>NOTE:</B> We only request your name and email address so that the person you
are recommending the page to knows that you wanted them to see it, and that it is not junk
mail.
<BR><FORM METHOD=POST ACTION="<? echo "$PHP_SELF"; ?>">

<TABLE BORDER="0" CELLSPACING="3" CELLPADDING="3">
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Your Name:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="yname"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Your Email:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="yemail"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend's Name:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="fname"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend's Email:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="femail"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans
Serif" SIZE="-1">Additional Comments:</FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans
Serif" SIZE="3"><TEXTAREA NAME="comments" ROWS="3"
COLS="30"></TEXTAREA></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans
Serif" SIZE="3"><INPUT TYPE="hidden" NAME="url" VALUE="<? echo "$referer"; ?>"><INPUT
TYPE="submit" NAME="action" VALUE="Send"></FONT></TD>
</TR>
</TABLE>

</FORM>
<BR>
<BR>
<BR>
<BR>
<BR>


<?

// don't forget to change this path if you're using a footer file!
include("/usr/home/your-site.com/html/inc/footer.inc");


exit;
ELSEIF ($action="Send"):
mail("$femail","$yname went to $sitename and recommended you check this out","$yname
stopped by $sitename and thought you would find the following URL of interest:

URL: $url

Additional Comments:
------------------------------------
$comments
------------------------------------

Thank you!

$sitename
$adminaddress
$siteaddress","FROM:$yemail");
?>
<H3>Thank you!</H3>
Your recommendation has been sent!
<BR>
<BR>
<FONT SIZE="3"><B><A HREF="<? echo "$url"; ?>">GO BACK</A></B></FONT>
<BR>
<BR>
<?
// NEW IN VERSION 1.2 - LOGGING TO A TEXT FILE - 7/31/00
// this writes the url, comments, and email address
// to a text database so you can easily track which
// pages are being recommended most often

// Be sure to upload the blank text file that the
// data will write to. In this case, we named it url-log.txt
// If you name your blank file url-log.txt, no changes are needed here.
// If you decide to use a different filename, you must change the
// variable below.
        
        IF ($logging=="yes"):
        $fname="url-log.txt";

        // Nothing needs ot be changed here

        $fl=fopen($fname,"a+");
        // sets the pipe delimiters
        fwrite($fl,"'$url'|'$femail'|'$yemail'|'$comments'\n");
        fclose($fl);
        ENDIF;

ENDIF;

        // change this pathname to point to your footer file
        include("/usr/home/your-site.com/html/inc/footer.inc");



// end of script

// *********************************************
// Making it work on your page:
// Just put a link to phprecommend.php3 (or whatever you name
// the above file), and the script
// does the rest!

?>





This script allows people to add their favorite quotes to your website. This could easily be modified to be a guestbook script or comment page script.
Categories : PHP, Complete Programs, HTML and PHP, Misc
phpHoo2 (Xhoo using php3/MySQL) is a Yahoo-like link directory. Much like the Open Directory Project (dmoz.org).
Categories : PHP, Complete Programs, Directories, MySQL, URLs
PHPRecommend v1.0 - Recommend this page to a friend script written in PHP. Easy to install
Categories : PHP, URLs, Complete Programs, Email, Site Planning
PHPLinkRot v1.0 - program which allows users to report broken links on your website just by clicking a button. Works well on custom 404 pages
Categories : PHP, Complete Programs, Debugging, URLs, Site Planning
Complete NotePad application for Websites (Like Yahoo Notepad)
Categories : PHP, Web Applications, Filesystem, Java Script, Complete Programs
IPhider Obscure Any URL Anonymity connection lores obfuscation corporate survival.
Categories : PHP, Algorithms, Security, URLs
Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs.
Categories : Databases, PHP, MySQL, Complete Programs
Web Self Service Resource Scheduler Using php3 and MySQL
Categories : PHP, Complete Programs, MySQL
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
GuestBook Light - a plug and play application for any website.
Categories : PHP, Complete Programs, Filesystem, Sessions
Point and Click Interface ala MS Access for creating SQL statements.
Categories : MySQL, Complete Programs, General SQL, PHP, Databases
Browse a MySQL database & draw a tree view & load final items into a template page.
Categories : MySQL, Complete Programs, Algorithms, PHP, Databases
This is a simple photo gallery that reads the image files from multiple directories, and generates a web page styled with CSS1. It opens single auto window to view and print a given image.
Categories : Graphics, Filesystem, PHP, Complete Programs
Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases
Functions to access a NNTP/NNRP newsserver. Complete set with examples is at ftp://ftp.nederland.net/pub/nnrplib
Categories : Search, PHP, Complete Programs
 Polkan Garcia wrote : 852
the script doesnt detect the current url, the $referer var is null.
The solution in my case was:
1) Add in the line 83 and 84:
$machine = "$SERVER_NAME";
$rute = "$REQUEST_URI";
2) Modify the $referer value:
$referer = ("http://www.$machine$rute");

And Fun !


 
 A. Gianotto wrote :853
It did for the version is was made for - look at the date... it`s a 2 year old script.