Array Random – dremi.INFO https://www.dremi.info Software Development, Digital Marketing and News Wed, 09 Jul 2008 05:39:25 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 https://www.dremi.info/wp-content/uploads/2020/12/cropped-icon-32x32.png Array Random – dremi.INFO https://www.dremi.info 32 32 Membuat Auto Surf dengan PHP https://www.dremi.info/tutorials/php/membuat-auto-surf-dengan-php.html https://www.dremi.info/tutorials/php/membuat-auto-surf-dengan-php.html#comments Wed, 09 Jul 2008 05:39:25 +0000 https://www.dremi.info/?p=775 […]]]> Pernah denger autosurf kan ? nyang kaya web ini ni:
http://www.trafficracer.com/auto-surf.php?user=31251
nah ntu bisa dibikin sederhana pake META REFRESH, tapi kali in igw gabungin make PHP untuk merandom halaman na…
Simak yak.

 

Kita ga pake Database, langsung make Array untuk halaman yang bersangkutan ajah. Disini gw pake Frame bwatmenampilkan halaman hasil random na:
ni bwat index.html na
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Tutorial Photoshop, SEO, CSS</title>
</head>
<frameset rows="120,*" frameborder="yes" border="0" framespacing="0">
<frame src="top.php" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="target.html" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>

tros bikin masing masing source bwat frame top dan target.
File top.php
Code:

<html>
<?
function recoverPass($length)
{
$temp_recpass="";
srand ((float) microtime() * 10000000);
$input = array (
"http://dremi468.blogspot.com",
"http://www.csslovers.co.cc",
"https://www.dremi.info/tutorial/photoshop/merancang-website-full-abis.html",
"https://www.dremi.info/tutorial/photoshop/sony-ericsson-logo.html"
);
$rand_keys = array_rand ($input, 24);
for ($i=0; $i<$length; $i++)
{
$temp_recpass = $temp_recpass . $input[$rand_keys[$i]];
}
return $temp_recpass;
}
$temp_recpass = recoverPass(1);
if($temp_recpass=='') { $pageLoad = "http://dremi468.blogspot.com"; } else  { $pageLoad = $temp_recpass; }
$randRefreshTop = rand(60, 120);
$randRefreshBot = rand(30, 60);
?>
<head>
<title>Refresh JavaScript Example</title>
<META HTTP-EQUIV="refresh" CONTENT="<? echo $randRefreshTop; ?>">
<SCRIPT LANGUAGE="JavaScript">
<!--
function refreshFrame() {
parent.mainFrame.location.href = '<? echo $pageLoad; ?>';
setTimeout('refreshFrame()',1000*<? echo $randRefreshBot; ?>);
}
refreshFrame();
//-->
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
}
body {
background-color: #FFFFFF;
margin-left: 0px;
margin-top: 11px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<!--
Use the "onload" event to start the refresh process.
-->
<body>
<center>
Page Load: <strong style="color:#0099FF"><? echo $pageLoad; ?></strong> Top: <strong style="color:#0099FF"><? echo $randRefreshTop; ?></strong> & Bottom: <strong style="color:#0099FF"><? echo $randRefreshBot; ?></strong>
<br>
<?
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){
// for proxy
$IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);
}else{
// for normal user
$IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);
}
echo "IP: $IP | PROXY: $proxy | HOST: $host <BR>";
?>
<br>
<a href="http://dremi468.blogspot.com/2008/06/creating-corporate-writing-style.html" target="_blank"><img src="http://i175.photobucket.com/albums/w126/hairulazami/banner%20468/seo-articles468.gif" border="0" alt="Photobucket"></a>
</center>
</body>
</html>

contoh diatas array halaman URL lu bisa tambahin sendiri.
nah ni bwat target.html
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>

kalo lu liat target.html halaman na kosong melompong, nah itu memang tugasnya hanya bwat nerima hasil load halaman yang ditampung dalam array pada Top Frame.
Cobain yak… asik kok.. 😀

]]>
https://www.dremi.info/tutorials/php/membuat-auto-surf-dengan-php.html/feed 3