Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- $dbhost = 'x.x.x';
- $dbuser = 'x';
- $dbpass = 'x*';
- $conn = mysql_connect($dbhost, $dbuser, $dbpass);
- if(! $conn )
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db('1737892_root') or trigger_error("Unable to switch to the database: " . mysql_error());
- function arr($num,$part){
- $ch = curl_init();
- $r= rand (1,90);
- $partt=intval($part);
- if($partt==1){
- $url="https://www.googleapis.com/customsearch/v1?q=G&num=10&start=".$r."&safe=off&cx=x:2hdsc4__avm&filter=0&c2coff=disable&alt=json&key=x";
- }elseif($partt==2){
- $url="https://www.googleapis.com/customsearch/v1?q=G&num=10&start=".$r."&safe=off&cx=xx:gxhaza__iwg&filter=0&c2coff=disable&alt=json&key=xx";
- }elseif($partt==3){
- $url="https://www.googleapis.com/customsearch/v1?q=G&num=10&start=".$r."&safe=off&cx=xxx:yzy968__ofi&filter=0&c2coff=disable&alt=json&key=xxx-K-uxTnbXtEI";
- }elseif($partt==4){
- $url="https://www.googleapis.com/customsearch/v1?q=G&num=10&start=".$r."&safe=off&cx=xxxx%3Anbwg77___eg&filter=0&c2coff=disable&alt=json&key=xxxx";
- }else{
- return '00';
- exit;
- }
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $output = curl_exec($ch);
- curl_close($ch);
- $a=intval($num);
- $data = json_decode($output, true);
- $se= $data['items'][$a]['pagemap']['cse_image'][0]['src'];
- // till here $se = "blah"
- if($se='' || $se=""||$se=NULL || !(isset($se))){
- $p=$part+1;
- arr($rr,$p);
- }
- $query = mysql_query("SELECT `url` FROM `url` WHERE `url`='".$se."'");
- if (mysql_num_rows($query) === 0)
- {
- $rr= rand (1,10);
- // return back
- mysql_query("INSERT INTO `url`(`url`) VALUES ('".$se."')");
- return $se;
- }else{
- // Url already exists fetch another
- arr($rr,$part);
- }
- $rr= rand (1,10);
- $randed= arr($rr,'1');
- echo $randed;
- exit;
- ?>
- </body>
- </html>
- This page takes forever to load!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement