Server IP : 51.89.169.208 / Your IP : 18.222.164.159 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/staff/validation/ |
Upload File : |
<?php header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); header("Access-Control-Allow-Headers: Content-Type, Authorization"); ini_set('max_execution_time',600); ini_set('default_socket_timeout', 5); $path = $_SERVER['DOCUMENT_ROOT']; include_once $path . '/connect_db.php'; // $url = "http://www.audiovisdsdeomedic.co.uk/"; // $headers = @get_headers($url); // if ($headers && strpos($headers[0], '200 OK')) { // echo "Website exists <br>"; // } else { // echo "Website does not exist <br>"; // } // echo "<pre>"; // die(var_dump($headers)); // test // $sql = "SELECT * FROM `ads` WHERE `approval` = 1 and active= 0 ORDER BY RAND() DESC"; // $res_ads = $connect->query($sql); // echo "query: $sql<br>"; // echo "Total data found: $res_ads->num_rows <br>"; // die(); echo "<b>Step - 2 is running</b>"; // get * from ads table order by id desc and limit 20 // $sql = "SELECT * FROM `ads` WHERE `approval` = 1 and active= 0 ORDER BY `adid` DESC LIMIT 1"; $sql = "SELECT * FROM `ads` WHERE `approval` = 1 and active= 0 ORDER BY RAND() DESC LIMIT 1"; echo "Select sql: ".$sql."<br>"; // $sql = "SELECT * FROM `ads` WHERE `adid` = '1744' "; $res_ads = $connect->query($sql); echo "<br>we got total data: $res_ads->num_rows <br>"; if ($res_ads->num_rows > 0) { // echo "yes"; // die(); while ($row = $res_ads->fetch_array(MYSQLI_ASSOC)) { $adid = $row['adid']; $memberid = $row['memberid']; $memberemail = $row['email']; $url = trim($row['url']); if (!empty($url)) { echo "Checking url...<br>"; if (substr($url, 0, 7) != 'http://' && substr($url, 0, 8) != 'https://') { $url = 'https://'.$url; } $is_valid_web = 0; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $output = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 200) { $is_valid_web = 1; } else { if (substr($url, 0, 7) == 'http://') { // echo "on http <br>"; $url = str_replace('http://', 'https://', $url); }else if (substr($url, 0, 8) == 'https://') { // echo "on https <br>"; $url = str_replace('https://', 'http://', $url); } $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $output = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 200) { $is_valid_web = 1; } else if ($httpCode == 401 ) { $is_valid_web = 1; }else if ($httpCode == 400 ) { $is_valid_web = 1; } else if ($httpCode == 301 ) { $is_valid_web = 1; } else if ($httpCode == 403 ) { $is_valid_web = 1; } else { echo "<a href=\"$url\" target=\"_blank\">$httpCode - Click here to open $url in a new window.</a><br>"; // headers were not retrieved within 30 seconds // die("Error: Unable to retrieve headers within 30 seconds."); } } // echo "Is valid web: $is_valid_web <br>"; // echo $url."<br>"; // die(); if ($is_valid_web == 1) { $connect->query("UPDATE `ads` SET `approval` = 2, `active` = 1, `decline_reason` = '' WHERE `adid` = '$adid'") or die("Error: ".$connect->error); echo "<span style='color: green;'>Ad: $adid - Approved</span><br>"; } else { $decline_reason = $httpCode . " WEBSITE NOT EXIST"; $connect->query("UPDATE `ads` SET `approval` = -1, `active` = 0, `decline_reason` = '$decline_reason' WHERE `adid` = '$adid'") or die("Error: ".$connect->error); echo "Sql: "."UPDATE `ads` SET `approval` = -1, `decline_reason` = 'WEBSITE NOT EXIST' WHERE `adid` = '$adid' <br>"; // die(); $to = "samiahmed0f0@gmail.com"; // $to = $memberemail; $subject = "Your business submissions on Yellowleaf"; $message = "Hello, Thank you for submitting your business, {$row['companyname']}, to our directory. After reviewing your submission, we regret to inform you that it has been declined. Your login email is: $memberemail The reason for this decision is that your website: $url was invalid. We understand that this may be disappointing news, but we encourage you to continue to improve your website and resubmit it for consideration in the future. Thank you for your understanding and for your interest in our directory. Best regards, Yellowleaf Team"; $headers = "From: no-reply@yellowleaf.co.uk" . "\r\n"; //mail($to, $subject, $message, $headers); echo "In advert: $adid website is not valid.<br>"; // die(); } }else{ $connect->query("UPDATE `ads` SET `approval` = -1, `active` = 0, `decline_reason` = 'EMPTY WEBSITE' WHERE `adid` = '$adid'") or die("Error: ".$connect->error); // $to = "samiahmed0f0@gmail.com"; $to = $memberemail; $subject = "Your business submissions on Yellowleaf"; $message = "Hello, Thank you for submitting your business, {$row['companyname']}, to our directory. After reviewing your submission, we regret to inform you that it has been declined. Your login email is: $memberemail The reason for this decision is that your website was empty. We understand that this may be disappointing news, but we encourage you to continue to improve your website and resubmit it for consideration in the future. Thank you for your understanding and for your interest in our directory. Best regards, Yellowleaf Team";; $headers = "From: no-reply@yellowleaf.co.uk" . "\r\n"; //mail($to, $subject, $message, $headers); echo "In advert: $adid website url is empty.<br>"; } } echo ' <meta http-equiv="refresh" content="3">'; }else{ echo "No more ads to approve"; //echo ' <meta http-equiv="refresh" url="/staff/validation/3.whois_data.php" content="3">'; echo '<script>window.location.href = "/staff/validation/3.whois_data.php";</script>'; } ?>