Beispiel #1
0
                    $hidx = 0;
                }
                $c--;
                if ($c < 1) {
                    $c = 1;
                }
            }
            $hash_index += 1;
            if ($hash_index >= strlen($hash)) {
                $hash_index = 0;
            }
        }
    }
    return $hash;
}
$con = loaddb();
$Message = '';
$Submited = false;
if (isset($_GET['submit'])) {
    $Name = $_GET['name'];
    $Level = $_GET['level'];
    $Time = $_GET['time'];
    $Code = $_GET['code'];
    if ($Code == generate_hash($Name . $Level . $Time)) {
        $Message = submittime($Name, $Level, $Time);
        $Submited = true;
    } else {
        $Message = '<p class="fail">Invalid token code recieved!</p>';
    }
}
$result0 = gettime(0);
Beispiel #2
0
function loadScan($record = '')
{
    global $db;
    if ($record == '') {
        $record = $_SESSION['scan']['record'];
    } else {
        $record = str_replace('/', '', $record);
        $record = str_replace('\\', '', $record);
        $record = str_replace('.', '', $record);
    }
    if (DATASTORE == 'db') {
        // add database version
        loaddb();
        $sql = "SELECT * FROM scans WHERE record = '" . mysql_escape_string($record) . "'";
        $rs = mysql_query($sql, $db);
        if (!$rs) {
            return false;
        }
        $scan = mysql_fetch_assoc($rs);
        $sql = "SELECT * FROM pageVisits WHERE record = '" . mysql_escape_string($record) . "'";
        $rs = mysql_query($sql, $db);
        $result = array();
        while ($row = mysql_fetch_assoc($rs)) {
            $k = $row['testcase'];
            $scan['pageVisits'][$k] = $row;
        }
        //mysql_free_result($rs);
        return $scan;
    } else {
        // using temp files
        $filename = $_SESSION['statisticsdir'] . $record . ".dat";
        $scan = array();
        if (is_file($filename)) {
            $scan = file_get_contents($filename);
            $scan = unserialize($scan);
            return $scan;
        } else {
            return false;
        }
    }
    //html_print_r($scan, '$scan');
}