}
    //echo 'Found NS for '.$domain.PHP_EOL;
    //print_r($output);
    return $output;
}
//Script
//------------------------------------------------------------------------------------------------------
foreach ($records as $record) {
    if (!empty($record)) {
        $record2 = explode('|', $record);
        $server = $record2[0];
        $tld = $record2[1];
        $registerabledomain = $record2[2];
        $ip4 = checkExists($server, false);
        //Query for A record (possibly following a CNAME record to get to the A record)
        $ip6 = checkExists($server, true);
        ////Query for AAAA record (possibly following a CNAME record to get to the AAAA record)
        if ($ip4 || $ip6) {
            $nameservers = checkNS($registerabledomain);
            if (!$nameservers) {
                //The server is orphan
                $ip4addresses = '';
                if ($ip4) {
                    foreach ($ip4 as $ip4address) {
                        if (!filter_var($ip4address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
                            //Valid IPv4 address
                            $ip4addresses .= $ip4address . ',';
                        } else {
                            //Invalid IPv4 address (CNAME?)
                        }
                    }
示例#2
0
if (isset($_POST['winner'], $_POST['looser'], $_POST['wScore'], $_POST['lScore'])) {
    function checkExists($mysqli, $token, $score)
    {
        $qExists = $mysqli->query('
                   SELECT id
                   FROM photosboy
                   WHERE token = "' . $mysqli->real_escape_string($token) . '"
                   AND score = ' . (int) $score);
        if ($qExists->num_rows >= 1) {
            return true;
        } else {
            return false;
        }
    }
    if (checkExists($mysqli, $_POST['winner'], $_POST['wScore']) == true && checkExists($mysqli, $_POST['looser'], $_POST['lScore']) == true) {
        if ($_POST['wScore'] >= $_POST['lScore']) {
            $highScorePeople = $_POST['winner'];
            $lowScorePeople = $_POST['looser'];
            $highScore = $_POST['wScore'];
            $lowScore = $_POST['lScore'];
        } else {
            $highScorePeople = $_POST['looser'];
            $lowScorePeople = $_POST['winner'];
            $highScore = $_POST['lScore'];
            $lowScore = $_POST['wScore'];
        }
        $winnerUpResult = ($highScore - $lowScore) / 100 * 2 + 20;
        $winnerDownResult = ($highScore - $lowScore) / 100 + 20;
        if ($highScorePeople == $_POST['winner']) {
            $mysqli->query('
示例#3
0
function performPreinstallChecks($qubitWebRoot, $qubitDataRoot, $qubitDbType, $qubitDbName, $qubitDbUser, $qubitDbPassword, $qubitDbHost, $qubitDbPort)
{
    global $fileSystemPathToTarball;
    printStatusReportTop();
    /*
     * Set the $error variable to FALSE to keep track of whether any errors are reported by
     * the various check_x functions. If $error is false at the end of performPreinstallChecks,
     * we can procede to the installQubit().
     */
    $error = false;
    $error = checkPHPversion($error);
    $error = checkAllowUrlFopen($error);
    $error = checkXMLEnabled($error);
    $error = checkXSLEnabled($error);
    $error = checkOS($error);
    $error = checkExists($error, $qubitWebRoot, 'web root');
    $error = checkExists($error, $qubitDataRoot, 'data directory');
    $error = checkDbType($error, $qubitDbType);
    // This parameter list should work for mysql and pgsql, but not for sqlite
    $error = checkDbConnection($error, $qubitDbType, $qubitDbName, $qubitDbUser, $qubitDbPassword, $qubitDbHost, $qubitDbPort);
    /*
     * If everything is OK (i.e., no $error = true returned from the check_x functions),
     * actually install the distribution.
     */
    if ($error) {
        // Exit and report that errors reported above need to be fixed.
        print '<p>Sorry, the installer can\'t procede until all the <span class="problem">problems</span> identified below have been fixed.</p>';
        printStatusReportBottom();
    } else {
        global $distro;
        // Get the web path of this script by removing the server's web root path from $qubitWebRoot.
        $documentRootPattern = '#' . $_SERVER['DOCUMENT_ROOT'] . '#';
        $pathToWebsite = preg_replace($documentRootPattern, '', $qubitWebRoot);
        $pathToWebsite .= 'index.php';
        $urlToWebsite = '<a target="_blank" title="Opens your new ' . $distro . ' site in new browser/tab" href="http://' . $_SERVER['SERVER_NAME'] . $pathToWebsite . '/search/buildIndex">' . $distro . '</a>';
        installQubit($qubitWebRoot, $qubitDataRoot);
        printStatusReportBottom();
        print "<p>Congratulations, the installation is complete. Before you leave this page, please perform the following\n          post-installation security tasks:</p>";
        print "<ul>";
        print "<li>Remove the installation files at {$fileSystemPathToTarball}</li>";
        print "<li>Change permissions on {$qubitWebRoot} so that directory is not writable by your web server</li>";
        print "</ul>";
        print "<p>Test your new instance of the {$urlToWebsite} (with email admin@qubit-toolkit.org and password admin), and\n          if everything looks good, complete the above security tasks. <strong>It is very important that you do not forget\n          to do these things!</strong> Not doing them puts your\n          website at a high security risk.</p>";
    }
}
示例#4
0
function checkExists($filenameTmp, $ext)
{
    $filename = str_replace(' ', '-', JFile::stripExt($filenameTmp)) . '_' . rand(12, 89) . '.' . $ext;
    $dest = $path . $filename;
    if (JFile::exists($dest)) {
        checkExists($filenameTmp, $ext);
    }
    return $dest;
}