本文整理匯總了PHP中dbconnection::dbconnect方法的典型用法代碼示例。如果您正苦於以下問題:PHP dbconnection::dbconnect方法的具體用法?PHP dbconnection::dbconnect怎麽用?PHP dbconnection::dbconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dbconnection
的用法示例。
在下文中一共展示了dbconnection::dbconnect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: preload_lists
function preload_lists()
{
$db = new dbconnection();
$db->dbconnect();
$db->query = "select listid,listname from " . TABLE_LISTS . " where active=1";
$db->execute();
$rowcount = $db->rowcount();
if ($rowcount > 0) {
for ($x = 0; $x < $rowcount; $x++) {
$row = $db->fetchrow($x);
$list[$x] = $row;
}
}
return $list;
}
示例2: changepassword
function changepassword($userid, $oldpass, $newpass, $newpassrepeat)
{
if ($newpass == $newpassrepeat) {
$enc = new Encryption();
$db = new dbconnection();
$db->dbconnect();
//check oldpass, update password if ok, send message if not
$password = $enc->oneway_encode($oldpass);
$db->query = "select userid from " . TABLE_USERS . " where userid={$userid} and password='{$password}'";
$db->execute();
if ($db->rowcount() > 0) {
$newpass = $enc->oneway_encode($newpass);
$db->query = "update " . TABLE_USERS . " set password='{$newpass}' where userid={$userid}";
$db->execute();
$msg = 'Password updated.';
} else {
$msg = 'Incorrect old password.';
}
} else {
$msg = 'New password does not match.';
}
return $msg;
}
示例3: dbconnection
<?php
require_once '../../includes/dbase.php';
require_once '../../includes/settings.php';
$db = new dbconnection();
$db->dbconnect();
isset($_REQUEST['agent']) ? $agent = $_REQUEST['agent'] : exit;
isset($_REQUEST['leadid']) ? $leadid = $_REQUEST['leadid'] : exit;
$total = count($_FILES['upload']['name']);
// Loop through each file
for ($i = 0; $i < $total; $i++) {
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
if ($tmpFilePath != "") {
$filename = $leadid . ' - ' . $_FILES["upload"]['name'][$i];
$newFilePath = "../../uploads/{$filename}";
//Upload the file into the temp dir
if (move_uploaded_file($tmpFilePath, $newFilePath)) {
$db->query = "\n insert into " . TABLE_FILES . "\n (leadid,filename,dateuploaded,agent)\n values\n ({$leadid},'{$filename}',now(),{$agent})\n ";
$db->execute();
echo 'File <a href="uploads/' . $filename . '" target="_blank">' . $filename . ' uploaded.</a><br>';
} else {
echo 'Failed to upload file ' . $filename;
}
}
}