当前位置: 首页>>代码示例>>PHP>>正文


PHP SQL::getConnection方法代码示例

本文整理汇总了PHP中SQL::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::getConnection方法的具体用法?PHP SQL::getConnection怎么用?PHP SQL::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQL的用法示例。


在下文中一共展示了SQL::getConnection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStartables

 public static function getStartables()
 {
     if (is_null(self::$startables) || !is_array(self::$startables)) {
         self::$startables = array();
         QueryBuilder::create(SQL::getConnection())->withQuery("SELECT id, display_name, folder_name, executable FROM websites")->build()->forEachResult(function ($row) {
             self::$startables[] = new Startables($row['id'], $row['display_name'], $row['folder_name'], $row['executable']);
         });
         if (count(self::$startables) == 0) {
             throw new Exception("lol");
         }
     }
     return self::$startables;
 }
开发者ID:Naniap,项目名称:Updater,代码行数:13,代码来源:Startables.php

示例2: header

<?php

include_once "SQL.php";
if (!isset($_GET['username'], $_GET['token'])) {
    header('Location: index.php');
    exit;
}
$myUsername = $_GET['username'];
$mailToken = $_GET['token'];
$action = "reset_password.php?token={$mailToken}&username={$myUsername}";
if (isset($_POST['newPassword'], $_POST['confirmPassword'])) {
    if ($_POST['newPassword'] !== $_POST['confirmPassword']) {
        header("Location: {$action}");
        exit;
    }
    $sql = SQL::getConnection();
    $saltedPassword = $myUsername . strlen($myUsername) . $_POST['newPassword'];
    $hashedPassword = hash("sha512", $saltedPassword);
    $sql->query("UPDATE accounts SET password = '{$hashedPassword}', token = NULL WHERE token = '{$mailToken}' AND username = '{$myUsername}'");
    if ($sql->affected_rows == 1) {
        echo 'Password successfully reset!';
    } else {
        echo 'Invalid token.';
    }
}
?>
<style type="text/css">
	.shit {
		width: 300px;
		text-align: center;
		background-color: #CCC;
开发者ID:Naniap,项目名称:UO-Login,代码行数:31,代码来源:reset_password.php

示例3: ini_set

<?php

ini_set('display_errors', 'On');
spl_autoload_register(function ($className) {
    // Normal PHP path
    $path = $_SERVER['DOCUMENT_ROOT'] . "/php/" . $className . ".php";
    if (file_exists($path)) {
        /** @noinspection PhpIncludeInspection */
        include_once $path;
    }
});
if (!Security::hasPermission()) {
    echo ":(";
    die;
}
SQL::getConnection();
开发者ID:Naniap,项目名称:Updater,代码行数:16,代码来源:engine.php

示例4: foreach

    if ($webId == "-1") {
        // Update all
        foreach (Website::getAllWebsites() as $site) {
            echoSite($site);
        }
    } else {
        // Update single site
        QueryBuilder::create(SQL::getConnection())->withQuery("SELECT display_name, folder_name FROM websites WHERE id = ?")->withParam($webId, QueryBuilder::PARAM_TYPE_INT)->build()->forEachResult(function ($row) {
            $site = new Website(0, $row['display_name'], $row['folder_name']);
            echoSite($site);
        });
    }
} else {
    function echoStart(Startables $starter)
    {
        echo $starter->getName() . ":\r\n";
        echo $starter->start() . "\r\n";
    }
    $webId = $_GET['start-id'];
    /*if ($webId == "-1") {
    		// Update all
    		foreach (Website::getAllWebsites() as $site) {
    			echoSite($site);
    		}
    	} else {*/
    // Update single site
    QueryBuilder::create(SQL::getConnection())->withQuery("SELECT display_name, folder_name, executable FROM websites WHERE id = ?")->withParam($webId, QueryBuilder::PARAM_TYPE_INT)->build()->forEachResult(function ($row) {
        $starter = new Startables(0, $row['display_name'], $row['folder_name']);
        echoStart($starter);
    });
}
开发者ID:Naniap,项目名称:Updater,代码行数:31,代码来源:ajax.php


注:本文中的SQL::getConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。