<?php

$id = $_GET['id'];
date_default_timezone_set('Europe/London');
$sysdate = date("Y-m-d H:i:s", time());
$db = mysqli_connect("<INSERT IP HERE>", "<INSERT USERNAME HERE>", "<INSERT PASSWORD HERE>", "<INSERT DATABASE HERE>") or print "<p style='text-align: center;'>" . "Connection failed: " . mysqli_connect_errno() . "</p>";
$query = mysqli_query($db, "SELECT * FROM SEMINARS");
$x = 0;
foreach ($query as $row) {
    if ($row['start_date'] > $sysdate && $row['SPOKESPERSONS_spokespersonID'] == $id) {
        $row['attendees'] = attendees($db, $row['seminarID']);
        //convert start/end time
        $row['start_date'] = timeConvert($row, 'start_date');
        $row['end_date'] = timeConvert($row, 'end_date');
        //convert and add date
        $date = dateConvert($row, 'start_date');
        //add date in readable format
        $row['date'] = $date;
        $obj[$x] = $row;
        $x++;
    }
}
print json_encode($obj);
function dateConvert($obj, $value)
{
    $time = strtotime($obj[$value]);
    $format = date('l, F jS, Y', $time);
    return $format;
}
function timeConvert($obj, $value)
{
Example #2
0
/**
* Title
*
* Description
*
* @access public
*/
function timeBetween($tm1, $tm2)
{
    $trueTime1 = timeConvert($tm1);
    $trueTime2 = timeConvert($tm2);
    if ($trueTime1 > $trueTime2) {
        //$trueTime1-=24*60*60;
        if ($trueTime2 < time()) {
            $trueTime2 += 24 * 60 * 60;
        } else {
            $trueTime1 -= 24 * 60 * 60;
        }
    }
    /*
    echo date('Y-m-d H:i:s', $trueTime1);
    echo " - ";
    echo date('Y-m-d H:i:s', $trueTime2);
    echo "<br>";
    */
    if (time() >= $trueTime1 && time() <= $trueTime2) {
        return true;
    } else {
        return false;
    }
}
Example #3
0
/**
 * Summary of timeBetween
 * @param mixed $tm1 Time 1
 * @param mixed $tm2 Time 2
 * @return bool
 */
function timeBetween($tm1, $tm2)
{
    $trueTime1 = timeConvert($tm1);
    $trueTime2 = timeConvert($tm2);
    if ($trueTime1 > $trueTime2) {
        if ($trueTime2 < time()) {
            $trueTime2 += 24 * 60 * 60;
        } else {
            $trueTime1 -= 24 * 60 * 60;
        }
    }
    if (time() >= $trueTime1 && time() <= $trueTime2) {
        return true;
    }
    return false;
}
 /**
  * 审计报告输出
  * @access public
  * @param string $_GET['md5']
  * @return void
  */
 public function show()
 {
     $md5 = I('get.md5');
     $model = M('file');
     $condition['md5'] = $md5;
     $info = $model->where($condition)->find();
     $savePath = $info['savepath'];
     if ($info == NULL) {
         die("No record.");
     }
     if ($info['status'] != 2) {
         die("The Application hasn't Done. Please waiting for few minutes.");
     }
     //转换测试时间
     $info = array_merge($info, timeConvert($info['totaltime']));
     $this->assign('info', $info);
     // 赋值数据集
     $file_id = $info['id'];
     $risk = M('Risk');
     $analysis = M('Analysis');
     //查询漏洞个数
     unset($conn);
     $conn['fileid'] = $info['id'];
     $conn['verdict'] = 2;
     $riskCount = $analysis->where($conn)->count();
     $this->assign('riskNumber', $riskCount);
     //查询安全漏洞与风险评估结果
     unset($conn);
     $conn['assessid'] = 2;
     $conn['ischeck'] = 1;
     $vulInfo = $risk->where($conn)->order('risklevel desc')->select();
     for ($i = 0; $i < sizeof($vulInfo); $i++) {
         unset($conn);
         $conn['riskid'] = $vulInfo[$i]['id'];
         $conn['fileid'] = $file_id;
         $rst = $analysis->where($conn)->find();
         if ($rst != FALSE) {
             $vulInfo[$i]['result'] = $rst['result'];
             $vulInfo[$i]['verdict'] = $rst['verdict'];
         } else {
             $vulInfo[$i]['result'] = NULL;
             $vulInfo[$i]['verdict'] = NULL;
         }
     }
     $this->assign('vul', $vulInfo);
     #查询Drozer安全审计结果
     unset($conn);
     $conn['assessid'] = 1;
     $conn['ischeck'] = 1;
     $riskInfo = $risk->where($conn)->order('risklevel desc')->select();
     for ($i = 0; $i < sizeof($riskInfo); $i++) {
         unset($conn);
         $conn['riskid'] = $riskInfo[$i]['id'];
         $conn['fileid'] = $file_id;
         $rst = $analysis->where($conn)->find();
         if ($rst != FALSE) {
             $riskInfo[$i]['result'] = $rst['result'];
             $riskInfo[$i]['verdict'] = $rst['verdict'];
         } else {
             $riskInfo[$i]['result'] = NULL;
             $riskInfo[$i]['verdict'] = NULL;
         }
     }
     $this->assign('risk', $riskInfo);
     #查询敏感信息与权限审计结果
     unset($conn);
     $conn['assessid'] = 3;
     $conn['ischeck'] = 1;
     $tipsInfo = $risk->where($conn)->order('risklevel desc')->select();
     for ($i = 0; $i < sizeof($tipsInfo); $i++) {
         unset($conn);
         $conn['riskid'] = $tipsInfo[$i]['id'];
         $conn['fileid'] = $file_id;
         $rst = $analysis->where($conn)->find();
         if ($rst != FALSE) {
             $tipsInfo[$i]['result'] = $rst['result'];
             $tipsInfo[$i]['verdict'] = $rst['verdict'];
         } else {
             $tipsInfo[$i]['result'] = NULL;
             $tipsInfo[$i]['verdict'] = NULL;
         }
     }
     $this->assign('tips', $tipsInfo);
     //显示截图
     $picPath = BASE_PATH . $savePath;
     $picPath = dirname($picPath) . '/' . $md5;
     $picList = getDirPicture($picPath);
     $this->assign('picture', $picList);
     //$this->assign('empty','<span class="empty">没有数据</span>');
     $this->display();
 }
Example #5
0
}
$pvalue9 = SQLSelectOne("SELECT * FROM pvalues WHERE PROPERTY_ID='" . $prop_id9 . "' AND OBJECT_ID='" . $obj9->id . "'");
if (!$pvalue9['ID']) {
    $p9 = '';
}
//---------------------------- end_tme
$end_time = time();
//$end_time=$end_time + 3600; //time correction (1 hour)
//---------------------------- today
if ($_GET['today'] == 1) {
    $today = 1;
} else {
    $today = 0;
}
if ($today) {
    $end_time = timeConvert("23:59") + 59;
    //-3600
}
//---------------------------- Precision
if ($_GET['px']) {
    $px_per_point = (int) $_GET['px'];
} else {
    $px_per_point = 10;
    //precision
}
//---------------------------- start_time (end_time) & period def
if (preg_match('/(\\d+)d/', $type, $m)) {
    //days (86400) &type=1d
    $total = (int) $m[1];
    $period = round($total * 24 * 60 * 60 / (($w - 80) / $px_per_point));
    $start_time = $end_time - $total * 24 * 60 * 60;
Example #6
0
                        ?>
<div class="container">
<h4 class="text-center">
<?php 
                        echo $Getir['sarki_sarkici'];
                        ?>
 - <?php 
                        echo $Getir['sarki_adi'];
                        ?>
</h4>
<h5 class="text-center">
<small><b><?php 
                        echo $Getir['sarki_ekleyen'];
                        ?>
</b> tarafından <b><?php 
                        echo timeConvert($Getir['sarki_tarih']);
                        ?>
</b> oluşturuldu</small>
</h5>
<div class="col-md-3" style="display: block;"></div>
<div class="col-md-8" style="display: block;">

            <?php 
                        if ($Getir['sarki_link']) {
                            YoutubeResim($Getir['sarki_link']);
                            ?>
              <br> <br>
              <?php 
                            YoutubeVideo($Getir['sarki_link']);
                            ?>
<br>
Example #7
0
File: php.php Project: piiskop/pstk
<label for="numberDay">Sisesta</label>
<input type="text" class="numberDay" id="numberDay" name="numberDay"/>
<input type="color" name="color"/>
<input type="submit" value="edasi"/>
</form>
<?php 
exit;
function timeConvert($mysqlTime)
{
    date_default_timezone_set('Europe/Helsinki');
    $date = date_create($mysqlTime);
    $timestamp = date_timestamp_get($date);
    echo $timestamp;
}
$mysqlTime = "2006-12-24 10:12:00";
timeConvert($mysqlTime);
?>
<style type="text/css">
input:invalid
{
	background-color: red;
}
input:valid
{
	background-color: green;
}
</style>
<form>
<input type="checkbox" id="checkbox"/>
<input type="text" spellcheck="true"/>
<input required="required" x-moz-errormessage="katakana" type="url" pattern="https?://.+" step="0.1" onchange="console.log('color: '+this.value);"/>
Example #8
0
 $ttx = $tt1 / $ttp;
 if ($ttn - $tt0 > 86400) {
     $ttx = $ttx - $width;
 }
 $d1on_ = timeConvert("00:00") - 3600;
 $d1off_ = timeConvert("07:00") - 3600;
 $d2on_ = timeConvert("07:00") - 3600;
 $d2off_ = timeConvert("10:00") - 3600;
 $d3on_ = timeConvert("10:00") - 3600;
 $d3off_ = timeConvert("17:00") - 3600;
 $d4on_ = timeConvert("17:00") - 3600;
 $d4off_ = timeConvert("21:00") - 3600;
 $d5on_ = timeConvert("21:00") - 3600;
 $d5off_ = timeConvert("23:00") - 3600;
 $d6on_ = timeConvert("23:00") - 3600;
 $d6off_ = timeConvert("23:59") - 3600;
 $d1on = $d1on_ - $tt0;
 $d1off = $d1off_ - $tt0;
 $d2on = $d2on_ - $tt0;
 $d2off = $d2off_ - $tt0;
 $d3on = $d3on_ - $tt0;
 $d3off = $d3off_ - $tt0;
 $d4on = $d4on_ - $tt0;
 $d4off = $d4off_ - $tt0;
 $d5on = $d5on_ - $tt0;
 $d5off = $d5off_ - $tt0;
 $d6on = $d6on_ - $tt0;
 $d6off = $d6off_ - $tt0;
 $d1onx = $d1on / $ttp;
 $d1offx = $d1off / $ttp;
 $d2onx = $d2on / $ttp;
if (mysqli_fetch_assoc(mysqli_query($db, "SELECT * FROM BOOKINGS WHERE email='{$email}' AND SEMINARS_seminarID={$seminar}"))['email']) {
    $response = "<h1>You have already registered for this seminar!</h1>";
    echo $response;
} else {
    mysqli_query($db, "INSERT INTO BOOKINGS (email,bookID,SEMINARS_seminarID,SEMINARS_ROOMS_roomsID,fname,lname) VALUES ('{$email}',{$numID},{$seminar},{$room},'{$fName}','{$lName}')");
    mysqli_query($db, "UPDATE SEMINARS SET attendees=(SELECT count(*) FROM BOOKINGS WHERE SEMINARS_seminarID={$seminar}) WHERE seminarID={$seminar}");
    $spokesperson = mysqli_fetch_assoc(mysqli_query($db, "SELECT name FROM SPOKESPERSONS WHERE spokespersonID=(SELECT SPOKESPERSONS_spokespersonID FROM SEMINARS WHERE seminarID={$seminar})"))['name'];
    $email_spokesperson = mysqli_fetch_assoc(mysqli_query($db, "SELECT email FROM SPOKESPERSONS WHERE spokespersonID=(SELECT SPOKESPERSONS_spokespersonID FROM SEMINARS WHERE seminarID={$seminar})"))['email'];
    $title = mysqli_fetch_assoc(mysqli_query($db, "SELECT title FROM SEMINARS WHERE seminarID={$seminar}"))['title'];
    $booking = mysqli_fetch_assoc(mysqli_query($db, "SELECT bookID FROM BOOKINGS WHERE email='{$email}' AND SEMINARS_seminarID={$seminar}"))['bookID'];
    $start_date = mysqli_fetch_assoc(mysqli_query($db, "SELECT start_date FROM SEMINARS WHERE seminarID=" . $seminar))['start_date'];
    $end_date = mysqli_fetch_assoc(mysqli_query($db, "SELECT end_date FROM SEMINARS WHERE seminarID=" . $seminar))['end_date'];
    $link = base_url() . 'index.php/withdraw/' . $booking;
    $date = dateConvert($start_date, ['start_date']);
    $start_time = timeConvert($start_date, ['start_date']);
    $end_time = timeConvert($end_date, ['end_date']);
    $response = "<h2>Congratulations!</h2><p>You have successfully registered for the {$title} seminar.\n                Don not forget that the seminar starts on {$date} at {$start_time} and ends at {$end_time}.\n                Should you wish to unregister, please click on the button below or send an email to {$spokesperson} at <a href='mailto:{$email_spokesperson}?Subject=Withdrawal%20{$title}%20 seminar'>{$email_spokesperson}</a>.\n                </p><a href='{$link}'>Withdraw</a>";
    echo $response;
    $db->close();
}
function dateConvert($obj)
{
    $time = strtotime($obj);
    $format = date('l, F jS, Y', $time);
    return $format;
}
function timeConvert($obj, $value)
{
    $time = strtotime($obj);
    $format = date('g:i a', $time);
    return $format;