I want my code when someone clicks the link then a link will open random of 3 posts between */android.html
,*/samsung.html
and */xiaomi.html
.
My code is like this
<?php
$YuuClass->update_dls($file['downloads'], $file_id);
echo '<script type="text/javascript">
var x=Math.floor((Math.random()*3)+ 1);
var xxx=null;
if(x=="1"){xxx="android.html"}
if(x=="2"){xxx="samsung.html"}
if(x=="3"){xxx="xiaomi.html"}
</script>';
redirect('https://safelink-ainodorama.blogspot.com/2017/02/"+xxx+"?url='.base64_encode($copy['webContentLink']));
exit();
?>
Where "+xxx+"
will change random between */android.html
,*/samsung.html
and */xiaomi.html
when I click it.
I tried to click it with code like that only showing base64code.
Ex-link when I click
http://myweb.web.id/0aHR0cHM6Ly9kcml2ZS5nb29nbGUuY29tL2Evc2RuMTgzcGVrYW5iYXJ1LnNjaC5pZC91Yz9pZD0xMUNoa0JpS3lvWkRMMGIxTWxYek4yeUt2NGRQcnJoMG8mZXhwb3J0PWRvd25sb2Fk
I want when I click it the URL will be like this https://safelink-ainodorama.blogspot.com/2017/02/android.html?url=base64_code_here
where android.html can change randomly from 2 another page android, Samsung and Xiaomi.
Because javascript is client-side and php is server-side the javascript wont change xxx
.
Instead have an array of your pages, then use array_rand to pick a random one.
Something like:
<?php
$YuuClass->update_dls($file['downloads'], $file_id);
$page = [
'android.html',
'samsung.html',
'xiaomi.html'
];
$url = 'https://safelink-ainodorama.blogspot.com/2017/02/'.$page[array_rand($page)].'?url='.base64_encode($copy['webContentLink']);
redirect($url);
exit;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments