Php link script

Php link script

Php Programe About Us Links Downloads Contact Us Terms of use SiteMap
Php link script
Php link script

 

You are here: Php Programe >>Php link script

Php link script article lists.

Php link script

Controlling Pop-Ups




Use cookies to make sure your visitors see only the pop-ups you want them to see.

Pop-up windows are one of the most annoying aspects of Web surfing. So as a Web page developer, should you employ them? Certainly they have their uses, ranging from banner ads that pay the bills and discount coupons for visitors to surveys. It's probably the sheer mindlessness of typical pop-up deployments, however, that most people find so irritating. Do you really need to bombard your site's repeat visitors with the same pop-ups over and over? As a matter of fact, you don't.

In "Random Pop-Ups", we introduced the element of randomness to pop-up windows. By using a combination of JavaScript and PHP, you can have pop-ups that both randomly select what content appears and randomly decide whether to appear at all. Visit www.pcmag.com/randompopups to see how it is done and to download the easy-to-modify files.

Though total randomness is good, targeted randomness is even better. Here, we'll show you how to keep track of your site's visitors and only make a pop-up window appear once per session.

Our new example uses only JavaScript and is completely embedded within a single HTML file. Download Index.zip by clicking on the download link at the top of this page. If the file looks familiar, that's because it is based on last issue's Index.php file. Since there's no PHP code this time, the file is named Index.htm. The new file also runs without a Web server, so you can just double-click on it to see it in action.

The random URLs that appear within the pop-up window use virtually the same JavaScript as before, but the trigger that sets off the pop-up is completely different. In this case, a JavaScript routine creates a simple cookie to keep track of your viewer's browser sessions, and when another JavaScript routine sees that Index.htm has not been viewed during the current session (as determined by the cookie), it "pulls the trigger" and the pop-up appears.

As before, all the code is completely commented for easy alteration, and you don't need to know a thing about JavaScript to use it. The Index.htm file works with Internet Explorer, Mozilla, Netscape, Opera, and Safari browsers running in Linux, Mac OS, and Windows.

Cookies and Sessions

Cookies, in the context of Web surfing and browsers, have received a lot of negative publicity that is not really justified. A cookie is nothing more than a small file that a Web page puts on a user's computer to store some data. Its most common use is for holding user names and passwords, shopping cart contents, and site preferences. A cookie file is especially useful because it survives even after you shut down your browser and your computer. In other words, it helps your Web browser remember certain data between sessions. Two things cookies cannot do is read data in other areas of your hard drive and read data from the cookies of other sites.

A session is simply the period of time in which a browser is running continuously. While a browser is running, it stores some temporary information in memory. When you shut down your browser, the information disappears. Minimizing the browser window does not terminate the session, since the program is still running in the background. If you have multiple browser windows open at the same time, they are all using the same session. When you shut down your computer, any open sessions close, because, of course, the browser isn't running when the computer is off.

Our JavaScript writes a simple cookie file to users' computers every time they view Index.htm. Session identification occurs when the cookie is written. If the script sees that a cookie is being written more than once in a single session, it won't pull the trigger on a pop-up window. When a new session begins before the next time Index.htm is viewed, the script pulls the trigger.

Working With the File

First, download and unzip the Index.zip file and open Index.htm in a text editor (Notepad is fine). Follow the directions cited in our issue of April 22, replacing the default settings for pop-up window size, window features, and random URLs if you like.

About halfway through the <SCRIPT> section is the line var once_per_browser_session=1. This enables the cookie trigger. By default, the script will pull the pop-up trigger once per browser session, but you can make the pop-up window always appear by changing the 1 to 0. That's all there is to it.

Your Web site content goes beneath the <BODY> tag, but since the entire script is self-contained, you can also simply copy everything between (and including) the <SCRIPT> and </SCRIPT> tags and paste it into your own HTML file between the <HEAD> and </HEAD> tags.

With a little care, you can make sure your visitors see only the pop-ups you want them to see.

Copyright ?? 2004 Ziff Davis Media Inc. All Rights Reserved. Originally appearing in PC Magazine.

Php link script Related Links
Php photo scriptEngine php script search
User online php scriptFree php calendar script
Php database scriptGame php script
Php redirect scriptPhp mailing list script
Sharing variable between php and java scriptPhp script post card free
Cgi php scriptPhp free issue tracking script
Clan php scriptPhp newsletter script
Passing variable php java scriptPhp formmail script
Free php forum scriptPhp classified script
Resource php script perl script source codeFree php mailing list script
Affiliate php scriptForm mail php script
Script php rating picturePhp program and script
Bug tracking php script freeScript php shopping cart tutorial
Free sample php mysql scriptClassifieds script php
Php comment scriptBook free guest php script
Php counter scriptFree php dating script software
Php tournament scriptCountdown php script
Free php form scriptPhp ftp script
Php quiz scriptPhp spider script
Bar code free php script wareFaq php script
Free mp3 php scriptAffiliate free php script
Free php email scriptMembership php script
Cool php scriptPhp web mail script
Php script site webPhp business directory script
Classifieds free php scriptPhp wysiwyg editor
 
©2005 All Rights Reserved   Php Programe