本文整理汇总了PHP中user::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP user::insert方法的具体用法?PHP user::insert怎么用?PHP user::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::insert方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
private static function save($user_id, $username, $password)
{
if ($user_id * 1 === -1) {
$user = new user();
$user->username = $username;
$user->password = md5($password);
$user->insert();
} else {
$user = new user();
$user->id = $user_id;
$user->username = $username;
$user->password = md5($password);
$user->update();
}
}
示例2: createuser
function createuser($obj)
{
try {
$user = new user();
$name = isset($obj->name) ? $obj->name : '';
$password = isset($obj->password) ? $obj->password : '';
$group_id = isset($obj->group_id) ? $obj->group_id : 0;
$id = $user->insert($name, $password, $group_id);
if (isset($id)) {
return array("status" => "success", "msg" => "Create Successful");
} else {
return array("status" => "warning", "msg" => "Create Fail");
}
} catch (Exception $e) {
return array("status" => "warning", "msg" => $e->getMessage());
}
}
示例3: add
public function add($_GET, $_POST)
{
$result = 0;
switch ($_GET['p']) {
case 'user':
$user = new user();
$result = $user->insert($_POST);
break;
default:
$obj = new $_GET['p']();
$result = $obj->insert($_POST);
break;
}
if ($result) {
$arr = array('statusCode' => 200, 'message' => "添加成功", 'navTabId' => "", 'rel' => "", 'callbackType' => "closeCurrent", "forwardUrl" => "");
} else {
$arr = array('statusCode' => 300, 'message' => "操作失败", 'navTabId' => "", 'rel' => "", 'callbackType' => "closeCurrent", "forwardUrl" => "");
}
return $arr;
}
示例4: add
public function add($GET, $POST)
{
$result = 0;
switch ($GET['p']) {
case 'user':
$user = new user();
$result = $user->insert($POST);
break;
case 'test':
$test = new test();
$result = $test->insert($POST);
break;
default:
//$this->common_add($_POST,$thepage);
break;
}
if ($result) {
$arr = array('statusCode' => 200, 'message' => "添加成功", 'navTabId' => "", 'rel' => "", 'callbackType' => "closeCurrent", "forwardUrl" => "");
} else {
$arr = array('statusCode' => 300, 'message' => "操作失败", 'navTabId' => "", 'rel' => "", 'callbackType' => "closeCurrent", "forwardUrl" => "");
}
return $arr;
}
示例5: index
public function index($name = '')
{
// $user = $this->model('User');
// $user->name = $name;
if (empty($name)) {
echo 'sex';
//$this->view('help/index');
print_r($_POST);
} else {
require_once '../app/models/user.php';
$db = new user();
//print_r($_POST);
foreach ($_POST as $key => $value) {
$dane = explode(' ', $value);
//print_r($dane);
if ($dane[1] == 'NULL') {
$dane[1] = NULL;
}
$db->insert("INSERT INTO klienci (name,email,system) VALUES ('" . $dane[0] . "','" . $dane[1] . "','" . $dane[2] . "')");
}
header('Location: http://localhost/wwwv2.0/mvcbeta/public/');
//$this->view('help/index',$name);
}
}
示例6: user
<?php
include "../Code/MongoHelper.php";
/**
* Define user class, MongoHelper will fallback to defaults if no configurations is given
* This will use "user" collection by default
* @author juhatauriainen
*/
class user extends MongoHelper
{
}
$user = new user();
// insert some rows
$user->insert(array("username" => "Pekka", "city" => "Helsinki", "sex" => "Yes please"));
$user->insert(array("username" => "Simo", "city" => "Helsinki"));
$user->insert(array("username" => "Jaana", "city" => "Tampere"));
$user->insert(array("username" => "Bill", "city" => "Seattle"));
// find single row
$pekka = $user->findOne(array("username" => "Pekka"));
echo '<p>Found ' . $pekka['username'] . ' from ' . $pekka['city'] . '</p>';
// fetch all rows
$rows = $user->getAll();
echo '<p>Found ' . $rows->count() . ' rows</p>';
foreach ($rows as $row) {
echo '<p>Found ' . $row['username'] . ' from ' . $row['city'] . '</p>';
}
// sort users by username
$rows->sort(array("username" => -1));
echo '<p>Sorting users</p>';
foreach ($rows as $row) {
echo '<p>Found ' . $row['username'] . ' from ' . $row['city'] . '</p>';
示例7: user
echo $language['save'];
?>
</button>
<button type="reset" name="cancel"><?php
echo $language['cancel'];
?>
</button>
</div>
</form>
<?php
} else {
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$user = new user();
$user->setUsername($_POST['username']);
$user->setPassword($_POST['password']);
$user->setEmail($_POST['email']);
$user->setRank($_POST['rank']);
if ($user->existUserByName() == 0) {
if ($user->insert()) {
print 'sucess';
} else {
print 'failure';
}
} else {
print 'O username ja existe';
}
} else {
print 'Email invalido';
print '<script type="text/javascript">setTimeout(goBack(),2000);</script>';
}
}
示例8: user
<?php
require 'db-connect.php';
require 'user.php';
if (isset($_POST['userName'])) {
// echo " inside the insert function";
$user = new user();
// echo $_POST['userName'];
$user->userName = $db->escape_string($_POST['userName']);
$user->password = $db->escape_string($_POST['password']);
$user->email = $db->escape_string($_POST['email']);
// $user->photo = $db->escape_string($_POST['photo']);
// $product->photo = ($_FILES['photo']['name']);
// $photo_tmp = $_FILES['photo']['tmp_name'];
// move_uploaded_file($photo_tmp, "../images/$user->photo");
// Form Validation Requiered in advance.
$user->insert();
header('location:../login/index.php');
}
示例9: process
//.........这里部分代码省略.........
} catch (Exception $e) {
$error = $e->getMessage();
}
if (!empty($error) && false) {
echo json_encode(array('error' => $error));
} else {
echo json_encode(array('ok' => $lang['done']));
}
exit;
break;
case 'create_account':
// create admin
try {
$DB = new database();
if (!$DB->connect()) {
die(json_encode(array('error' => $DB->get_last_error())));
}
$user = new user();
$user->id = 0;
$user->username = $_SESSION['NAVIGATE-SETUP']['ADMIN_USERNAME'];
$user->set_password($_SESSION['NAVIGATE-SETUP']['ADMIN_PASSWORD']);
$user->email = $_SESSION['NAVIGATE-SETUP']['ADMIN_EMAIL'];
$user->profile = 1;
$user->skin = 'cupertino';
$user->language = $_SESSION['navigate_install_lang'];
$user->blocked = 0;
$user->timezone = 'UTC';
$user->date_format = 'Y-m-d H:i';
$user->decimal_separator = ',';
$user->thousands_separator = '';
$user->attempts = 0;
$user->cookie_hash = '';
$user->activation_key = '';
$ok = $user->insert();
if (!$ok) {
throw new Exception($lang['error']);
}
// create default website details
$website = new website();
$website->create_default();
$_SESSION['NAVIGATE-SETUP']['WEBSITE_DEFAULT'] = $website->id;
echo json_encode(array('ok' => $lang['done']));
} catch (Exception $e) {
echo json_encode(array('error' => $e->getMessage()));
}
exit;
break;
case 'install_default_theme':
try {
$DB = new database();
if (!$DB->connect()) {
die(json_encode(array('error' => $DB->get_last_error())));
}
if (@$_SESSION['NAVIGATE-SETUP']['DEFAULT_THEME'] == 'theme_kit') {
$website = new website();
$website->load($_SESSION['NAVIGATE-SETUP']['WEBSITE_DEFAULT']);
$website->theme = 'theme_kit';
$website->languages = array('en' => array('language' => 'en', 'variant' => '', 'code' => 'en', 'system_locale' => 'en_US.utf8'), 'es' => array('language' => 'es', 'variant' => '', 'code' => 'es', 'system_locale' => 'es_ES.utf8'));
$website->languages_published = array('en', 'es');
$website->save();
// default objects (first user, no events bound...)
$user = new user();
$user->load(1);
$events = new events();
$zip = new ZipArchive();
$zip_open_status = $zip->open(NAVIGATE_PATH . '/themes/theme_kit.zip');
示例10: user
$userInst = new user();
#######################################################################
## perform action
$status = 1;
if (tool::securePost('action') && tool::securePost('action') == "save" && tool::securePost('id') && tool::securePost('id') != "") {
# fill user with submitted data
$userInst->id = tool::securePost('id');
$userInst->fill(tool::securePostAll());
if (!DEMO_MODE) {
$status = $userInst->update();
} else {
$toolInst->errorStatus("not allowed in this demo. Sorry ;)");
}
} elseif (tool::securePost('action') && tool::securePost('action') == "save") {
$userInst->fill(tool::securePostAll());
$status = $userInst->insert();
}
if (tool::securePost('action') && tool::securePost('action') == "delete" && tool::securePost('id') && tool::securePost('id') != "") {
$userInst->id = tool::securePost('id');
if (!DEMO_MODE) {
$userInst->delete();
} else {
$toolInst->errorStatus("not allowed in this demo. Sorry ;)");
}
}
if (tool::securePost('action') && tool::securePost('action') == "edit" && tool::securePost('id') && tool::securePost('id') != "") {
$status = 0;
$userInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form