Kali ini saya akan membagikan cara membuat web random image yang sangat cocok untuk ngereff cashtree/money locker untuk menambah penghasilan anda.
Jika link di ketik di komentar facebook akan tampil seperti gambar ini
Copy paste script php random image di bawah ini di index.php :
<?php
/////////////////////////////////////////////////////////////////////
// This is the only portion of the code you may need to change.
// Indicate the location of your images
$root = '';
// use if specifying path from root
//$root = $_SERVER['DOCUMENT_ROOT'];
$path = 'images/';
// End of user modified section
/////////////////////////////////////////////////////////////////////
function getImagesFromDir($path) {
$images = array();
if ( $img_dir = @opendir($path) ) {
while ( false !== ($img_file = readdir($img_dir)) ) {
// checks for gif, jpg, png
if ( preg_match("/(\.gif|\.jpg|\.png)$/", $img_file) ) {
$images[] = $img_file;
}
}
closedir($img_dir);
}
return $images;
}
function getRandomFromArray($ar) {
mt_srand( (double)microtime() * 1000000 ); // php 4.2+ not needed
$num = array_rand($ar);
return $ar[$num];
}
// Obtain list of images from directory
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
?>
/////////////////////////////////////////////////////////////////////
// This is the only portion of the code you may need to change.
// Indicate the location of your images
$root = '';
// use if specifying path from root
//$root = $_SERVER['DOCUMENT_ROOT'];
$path = 'images/';
// End of user modified section
/////////////////////////////////////////////////////////////////////
function getImagesFromDir($path) {
$images = array();
if ( $img_dir = @opendir($path) ) {
while ( false !== ($img_file = readdir($img_dir)) ) {
// checks for gif, jpg, png
if ( preg_match("/(\.gif|\.jpg|\.png)$/", $img_file) ) {
$images[] = $img_file;
}
}
closedir($img_dir);
}
return $images;
}
function getRandomFromArray($ar) {
mt_srand( (double)microtime() * 1000000 ); // php 4.2+ not needed
$num = array_rand($ar);
return $ar[$num];
}
// Obtain list of images from directory
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
?>
Keterangan : $path =images/ adalah folder untuk menyimpan gambar ,bisa kalian ganti sesuai nama folder kalian.
Jangan lupa untuk memanggil script php nya dengan menyisipkan kode ini didalam html kalian
<img src="<?php echo $path . $img ?>
Agar URL tidak error ketika diketik URL/Namakamu, kita membutuhkan kode htaccess nya.
Buat file dengan nama seperti ini .htaccess kemudian masukkan kode dibawah di dalam ny
ErrorDocument 400 /index.php
ErrorDocument 403 /index.php
ErrorDocument 404 /index.php
ErrorDocument 500 /index.php
ErrorDocument 403 /index.php
ErrorDocument 404 /index.php
ErrorDocument 500 /index.php
Kemudian kalian uploud file nya di hosting.
Disini saya juga membagikan script web random image secara gratis.
Untuk itu kita Siapkan terlebih dahulu bahan bahannya di bawah ini:
- Siapkan Hosting/Cpanel sudah ber domain(berbayar optional)
- Script nya comot disini
- Kalian bisa simak tutorial video nya di bawah
Jika sudah siap semua, simak langkah selanjutnya :
- Login ke hosting/Cpanel kalian.
- Uploud file yang sudah kalian comot diatas.
- Kemudian edit file validating.php ganti link yang ada di dalam nya dengan link reff kalian.
- Save, dan ketik domain kalian di komentar facebook dengan cara " domain/Namakamu "
- Selesai
Simak video tutorial nya disini
Untuk password script nya, silahkan tinggalkan jejak di komentar, trimakasih.