Tuesday, April 28, 2015

PHP each visit redirects to next page in a sequence

Redirects to a random URL from a array of URLs.

<?php 
$urls = array("url01", 
          "url02", 
          "url03"); 
$url = $urls[array_rand($urls)]; 
header("Location: http://$url"); 
?>

 Redirect sequentially on each visit

<?php

session_start();
$curr = array_key_exists('curr', $_SESSION) ? $_SESSION['curr'] : 0;

$urls = array("url01", "url02", "url03");
$curr = $curr >= sizeof($urls) ? 0 : $curr;

$_SESSION['curr'] = $curr + 1;
header('Location: http://' . $urls[$curr]); 

?>

How to backup and download Database using PHP

< ?php $mysqlUserName = 'databaseusername' ; $mysqlPassword = 'databasepassword' ; $mysqlHostNa...