403Webshell
Server IP : 51.89.169.208  /  Your IP : 3.148.107.92
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/all_scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/yellowleaf/public_html/all_scripts/fix_opening_hour.php
<?php
header('Content-Type: text/html; charset=utf-8');
ini_set('max_execution_time', 300);
$path  = $_SERVER['DOCUMENT_ROOT'];
include_once $path.'/connect_db.php';


// $res_listing_query = $connect->query("SELECT * FROM `opening_hours` WHERE `done`=0 ORDER BY `id` ASC LIMIT 300");
$res_listing_query = $connect->query("SELECT * FROM `opening_hours` WHERE `done`=0 ORDER BY `opid` ASC LIMIT 500");
// $res_listing_query = $connect->query("UPDATE `opening_hours` SET `done`=0");
// echo "done";
// die();

if($res_listing_query->num_rows > 0){
    echo '<pre>';
    while($row_opening = $res_listing_query->fetch_array(MYSQLI_ASSOC)){
        $id = $row_opening['opid'];
        $adid = $row_opening['opadid'];
        echo "<b>adid</b>: ".$adid.PHP_EOL;

        for($i=0; $i<7; $i++){

            $future_day = strtolower(date("l", strtotime("+{$i} days")));

            echo $future_day.": ";

            $time_range = $row_opening["$future_day"];

            $check_valid_time = preg_match("/^[^\d]/i", $time_range);

            if($check_valid_time){
                echo $time_range.PHP_EOL;
                $time = "Closed";

            } else {
                $time_range = explode(" - ", $row_opening["$future_day"]);

                $rand_time = rand(1, 12);
                $start_time_check = $time_range[0];
                $end_time_check = $time_range[1];
                $check_start_time_valid = preg_match("/(am)?(pm)?/i", $start_time_check);
                $check_end_time_valid = preg_match("/(am)?(pm)?/i", $end_time_check);

                $am_check_start = preg_match("/(am)/i", $start_time_check);
                $pm_check_start = preg_match("/(pm)/i", $start_time_check);
                $am_check_end = preg_match("/(am)/i", $end_time_check);
                $pm_check_end = preg_match("/(pm)/i", $end_time_check);

                /** start time fix */
                if($check_start_time_valid){
                    $st = intval(str_ireplace("am", "",$start_time_check));

                    if($am_check_start){
                        $am_pm = "AM";
                    } elseif($pm_check_start) {
                        $am_pm = "PM";
                    } else{
                        $am_pm = "AM";
                    }
                    
                    if($st>=1 && $st<=12){
                        $start = $st.".00$am_pm";
                    } else {
                        $start = $rand_time.".00$am_pm";
                    }

                } else{
                    $start = $rand_time.".00$am_pm";
                }


                /** end time fix */
                if($check_end_time_valid){
                    $et = intval(str_ireplace("am", "",$end_time_check));

                    if($am_check_end){
                        $am_pm = "AM";
                    } elseif ($pm_check_end) {
                        $am_pm = "PM";
                    } else {
                        $am_pm = "PM";
                    }
                    
                    if($et>=1 && $et<=12){
                        $end = $et.".00$am_pm";
                    } else {
                        $end = $rand_time.".00$am_pm";
                    }

                } else{
                    $end = $rand_time.".00$am_pm";
                }
                
                echo $start.' - '.$end.PHP_EOL;

                $time = $start.' - '.$end;

            }

            $connect->query("UPDATE `opening_hours` SET `$future_day`='{$time}', `done`=1 WHERE `opid`='{$id}'") || die('Update error: '.$connect->error);
            
        }

        echo PHP_EOL;


        echo '<meta http-equiv="refresh" content="3">';

    }
} else{
    echo "All completed";
}

Youez - 2016 - github.com/yon3zu
LinuXploit