![]() |
|
Random Image PHP - Printable Version +- HN-Community (https://hacker-newbie.org) +-- Forum: Miscellaneous (https://hacker-newbie.org/forum-86.html) +--- Forum: Coding/Programing (https://hacker-newbie.org/forum-19.html) +---- Forum: Web Programing (https://hacker-newbie.org/forum-38.html) +---- Thread: Random Image PHP (/thread-2121.html) |
RE: Random Image PHP - Arusar - 03-07-2010 Laporan Script Saya Dulu Ah.... Jangan Di Ejek Yah.... ![]() Untuk Yang "sesuatu" Saya Pakai File batas.txt... PHP Code: <?php
$code = $_GET['codename'];
$batas = file_get_contents('batas.txt', true);
do //kalau numb sama dgn batas akan diacak terus
{
$numb = rand(1,4);
}
while ($numb==$batas);
$batas=$numb;
//simpen value batas
$file = "batas.txt";
$handle = fopen($file, 'w');
fwrite($handle, "$batas");
fclose($handle);
//image file
$image[1] = "1.jpg";
$image[2] = "2.jpg";
$image[3] = "3.jpg";
$image[4] = "4.jpg";
if ($code=='HN-Community')
{
$random = imagecreatefromjpeg($image[$numb]);
header('Content-type: image/jpeg');
imagejpeg($random);
}
else
{
die('Hayooooooo...!!!!</br>Mau Ngapain....????');
}
?>Tapi Kenapa Link-nya Gak Bisa Dijadiin Avatar... ![]() Image Sudah Pake Yg Kecil" [utk jadi avatar max 120 x 120 px] ![]() Tapi URL Gak Valid Katanya...
|