Search results for 'Redirection'. 2 post(s) found.

  1. 2007/10/16 How to redirect browser in PHP ?
  2. 2007/08/30 Cookie Redirect (1)
2007/10/16 09:38

How to redirect browser in PHP ?


Using the php header function, a browser can be Redirected to another page.

<?php
// Redirect Browser
header("Location: http://www.example.com/");

// stop executing this script
exit;
?> 
Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/28 22:59 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 07:14 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:42 delete

    moneyideas

2007/08/30 08:29

Cookie Redirect


When a page has performed it's purpose,a Cookie can be set to redirect the browser to a different page on subsequent visits. Easily implemented. (Because it will redirect after one visit,the example is not shown on this site.)

CookieRedirect.js
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: William Bontrager | http://www.bontragerconnection.com/ */
// Copyright 2006 Bontrager Connection,LLC
// This version of the script redirects automatically.
// The Web site has a few other methods for directing also:
// http://www.bontragerconnection.com/library/redirect_with_a_Cookie.shtml

// Three items can be customized (values between quotation marks):
//
// 1. What URL shall the browser be redirected
//    to if a Cookie was previously set?

var RedirectURL = "http://shamar.org";

// 2. How many days shall the Cookie live in
//    the visitor's browser (0 means remove
//    Cookie whenever browser closes)?

var DaysToLive = "365";

// 3. What name shall the Cookie have (any
//    sequence of alphabetical characters
//    is okay,so long as the name doesn't
//    conflict with any other Cookies that
//    this web page might be setting.)?

var CookieName = "HasVisited";

// No other customization is required.

function Action() {
location.href = RedirectURL;
}

DaysToLive = parseInt(DaysToLive);
var Value = 'bypass page next time';

function GetCookie() {
var Cookiecontent = '';
if(document.Cookie.length > 0) {
   var Cookiename = CookieName   '=';
   var Cookiebegin = document.Cookie.indexOf(Cookiename);
   var Cookieend = 0;
   if(Cookiebegin > -1) {
      Cookiebegin  = Cookiename.length;
      Cookieend = document.Cookie.indexOf(";",Cookiebegin);
      if(Cookieend < Cookiebegin) { Cookieend = document.Cookie.length; }
      Cookiecontent = document.Cookie.substring(Cookiebegin,Cookieend);
      }
   }
if(Cookiecontent.length > 0) { return true; }
return false;
}

function SetCookie() {
var exp = '';
if(DaysToLive > 0) {
   var now = new Date();
   then = now.getTime()   (DaysToLive * 24 * 60 * 60 * 1000);
   now.setTime(then);
   exp = '; expires='   now.toGMTString();
   }
document.Cookie = CookieName   '='   Value   exp;
return true;
}

if(GetCookie() == true) { Action(); }

SetCookie();

test.html
<script type="text/javascript" src="CookieRedirect.js"></script>

Trackback 3 1

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 01:20 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 09:38 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:44 delete

    moneyideas