PHP image link rotation

The script is for my vbulletin forum in PHP which we can stick our affiliate banners with their links so that they rotate on refresh.

The code is as follows:

$total = "6"; //6 - change to how many images you have
$file_type = ".jpg"; //change to file type
$image_folder = "random"; //location of folder
$start = "1"; //which image you want to load first
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
echo "\";

Posted in Php Code. Comments Off on PHP image link rotation »

.htaccess redirect ALL traffic to another domain

.htaccess code:
redirect 302 / http://www.mynewdomain.com

you can also redirect access via PHP, using the header() function:

// Permanent redirect:
header('HTTP/1.1 301 Moved Permanently', true);
header('Location: http://www.location.com/');
// Temporary redirect (note that sending the 'Location' header automatically sends a 302 redirect unless it is explicitly overwritten, as it is above):
header('Location: http://www.location.com/');

Posted in Apache, Php Code. Comments Off on .htaccess redirect ALL traffic to another domain »

How to detect the numbers of used nodes in php web host?

It is very simple, only one sentence:

print system(“find . -printf \”%i\n\” | sort -u | wc -l”);

Posted in Php Code. Comments Off on How to detect the numbers of used nodes in php web host? »

Redirect by PC or mobile access

php code as follows:

$iswap = isset($_SERVER[‘HTTP_ACCEPT’])? $_SERVER[‘HTTP_ACCEPT’]:”;
if(strpos($iswap,”wap”)>0)
{
@header(“Location: /wap/”);
}

Posted in Php Code. Comments Off on Redirect by PC or mobile access »

Add php code into html for lunarpage.com

Add php code into html for lunarpage.com linux host.

try this line in a blank .htaccess

AddType application/x-httpd-php php html

Posted in Php Code, Php Skills. Comments Off on Add php code into html for lunarpage.com »

Add php code into html for php5

AddType application/x-httpd-php5 .html .htm .php
AddHandler application/x-httpd-php5 .html .htm .php

Posted in Php Code, Php Skills. Comments Off on Add php code into html for php5 »

PHP to detect mobile phones

The most efficient way to detect mobile phones with PHP, this simply queries the accept headers, the user agent and checks for any tell tale signs that the browser we’re sniffing is a mobile device. (more…)

Posted in Php Code. Comments Off on PHP to detect mobile phones »

Get current url

<?php
//get the current page URL that is shown in the browser URL window

function curPageURL() {
 $pageURL = ‘http’;
 if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;}
 $pageURL .= “://”;
 if ($_SERVER[“SERVER_PORT”] != “80”) {
  $pageURL .= $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”]; (more…)

Posted in Php Code. Comments Off on Get current url »

Php test Navigation engine laguage, and Syetem language

Php test Navigation engine laguage

< ?php echo $_SERVER["HTTP_USER_AGENT"]; ?>

Php test Syetem lang

< ?php echo $_SERVER["HTTP_ACCEPT_LANGUAGE"]; ?>

(more…)

Posted in Php Code, Php Skills. Comments Off on Php test Navigation engine laguage, and Syetem language »

Show random ads at phpld

If you’re looking for a simple static solution (an not an entire ad manager) use this
add in your init.php after the $tpl = get_tpl(… line (more…)

Posted in Php Code, Php Learning. Comments Off on Show random ads at phpld »
King Php Science Welcome, you are from: 23.20.157.174