本文整理汇总了PHP中check_admin_user函数的典型用法代码示例。如果您正苦于以下问题:PHP check_admin_user函数的具体用法?PHP check_admin_user怎么用?PHP check_admin_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_admin_user函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_menu
function display_menu()
{
echo "\r\n <div id = 'top_menu'>\r\n <a href = 'index.php'>Home</a> | \r\n <a href = 'about.php'>About</a> | \r\n <a href = 'officers.php'>Officers</a> | \r\n\t\t\t<a href = 'contact.php'>Contact</a> ";
if (logged_in()) {
if (check_admin_user()) {
echo " <a href = 'admin.php'>(Admin)</a> ";
}
echo " <a href = 'nightcrews.php'>Night Crews</a> ";
echo " <a href = 'events.php'>Games & Events</a> ";
echo " |<a id='top_menu' href = 'profile.php'>Profile</a> | \r\n\t\t<a href = 'logout.php'>Log Out</a>";
} else {
echo "| <a href = 'login.php'>Login</a> ";
}
echo "</div><br /><br />";
}
示例2: session_start
<?php
require_once 'book_sc_fns.php';
session_start();
do_html_header('Changing password');
check_admin_user();
if (!filled_out($HTTP_POST_VARS)) {
echo 'You have not filled out the form completely.
Please try again.';
do_html_url('admin.php', 'Back to administration menu');
do_html_footer();
exit;
} else {
$new_passwd = $HTTP_POST_VARS['new_passwd'];
$new_passwd2 = $HTTP_POST_VARS['new_passwd2'];
$old_passwd = $HTTP_POST_VARS['old_passwd'];
if ($new_passwd != $new_passwd2) {
echo 'Passwords entered were not the same. Not changed.';
} else {
if (strlen($new_passwd) > 16 || strlen($new_passwd) < 6) {
echo 'New password must be between 6 and 16 characters. Try again.';
} else {
// attempt update
if (change_password($HTTP_SESSION_VARS['admin_user'], $old_passwd, $new_passwd)) {
echo 'Password changed.';
} else {
echo 'Password could not be changed.';
}
}
}
}
示例3: session_start
<?php
// include function files for this application
require_once 'book_sc_fns.php';
session_start();
do_html_header("Add a book");
if (check_admin_user()) {
display_book_form();
do_html_url("admin.php", "Back to administration menu");
} else {
echo "<p>You are not authorized to enter the administration area.</p>";
}
do_html_footer();
示例4: session_start
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include_once 'user.php';
include_once 'cred.php';
include_once 'config.php';
if (!isset($_SESSION)) {
session_start();
}
$op = "";
if (isset($_POST['op'])) {
$op = $_POST['op'];
} elseif (isset($_GET['op'])) {
$op = $_GET['op'];
}
if ($op != "register" && (!check_session_user() || !check_admin_user())) {
header('Location: index.php?error=Invalid User' . $op);
} else {
if (strlen($op) > 0) {
if ($op == "delete") {
if (isset($_GET['id'])) {
$username = $_GET['id'];
$err = delete_user($username);
if (strlen($err) > 0) {
header('Location: error.php?msg=' . urlencode($err));
} else {
header('Location: user_list.php');
}
} else {
header('Location: error.php?msg=No id');
}
示例5: send
function send($mailid, $admin_user)
{
if (!check_admin_user($admin_user)) {
return false;
}
if (!($info = load_mail_info($mailid))) {
echo "Cannot load list information for message {$mailid}";
return false;
}
$subject = $info[0];
$listid = $info[1];
$status = $info[2];
$sent = $info[3];
$from_name = 'Pyramid MLM';
$from_address = 'return@address';
$query = "select email from sub_lists where listid = {$listid}";
$result = mysql_query($query);
if (!$result) {
echo $query;
return false;
} else {
if (mysql_num_rows($result) == 0) {
echo "There is nobody subscribed to list number {$listid}";
return false;
} else {
// include PEAR mail classes
include 'Mail.php';
include 'Mail/mime.php';
// instantiate MIME class and pass it the carriage return/line feed
// character used on this system
$message = new Mail_mime("\r\n");
// read in the text version of the newsletter
$textfilename = "archive/{$listid}/{$mailid}/text.txt";
$tfp = fopen($textfilename, "r");
$text = fread($tfp, filesize($textfilename));
fclose($tfp);
// read in the HTML version of the newsletter
$htmlfilename = "archive/{$listid}/{$mailid}/index.html";
$hfp = fopen($htmlfilename, "r");
$html = fread($hfp, filesize($htmlfilename));
fclose($hfp);
// add HTML and text to the mimemail object
$message->setTXTBody($text);
$message->setHTMLBody($html);
// get the list of images that relate to this message
$query = "select path, mimetype from images where mailid = {$mailid}";
if (db_connect()) {
$result = mysql_query($query);
if (!$result) {
echo '<p>Unable to get image list from database.';
return false;
}
$num = mysql_numrows($result);
for ($i = 0; $i < $num; $i++) {
//load each image from disk
$imgfilename = "archive/{$listid}/{$mailid}/" . mysql_result($result, $i, 0);
$imgtype = mysql_result($result, $i, 1);
// add each image to the object
$message->addHTMLImage($imgfilename, $imgtype, $imgfilename, true);
}
}
// create message body
$body = $message->get();
// create message headers
$from = '"' . get_real_name($admin_user) . '" <' . $admin_user . '>';
$hdrarray = array('From' => $from, 'Subject' => $subject);
$hdrs = $message->headers($hdrarray);
// create the actual sending object
$sender =& Mail::factory('mail');
if ($status == 'STORED') {
// send the HTML message to the administrator
$sender->send($admin_user, $hdrs, $body);
// send the plain text version of the message to administrator
mail($admin_user, $subject, $text, 'From: "' . get_real_name($admin_user) . '" <' . $admin_user . ">");
echo "Mail sent to {$admin_user}";
// mark newsletter as tested
$query = "update mail set status = 'TESTED' where mailid = {$mailid}";
if (db_connect()) {
$result = mysql_query($query);
}
echo '<p>Press send again to send mail to whole list.<center>';
display_button('send', "&id={$mailid}");
echo '</center>';
} else {
if ($status == 'TESTED') {
//send to whole list
$query = "select subscribers.realname, sub_lists.email, \r\n subscribers.mimetype \r\n from sub_lists, subscribers \r\n where listid = {$listid} and \r\n sub_lists.email = subscribers.email";
if (!db_connect()) {
return false;
}
$result = mysql_query($query);
if (!$result) {
echo '<p>Error getting subscriber list';
}
$count = 0;
// for each subscriber
while ($subscriber = mysql_fetch_row($result)) {
if ($subscriber[2] == 'H') {
//send HTML version to people who want it
$sender->send($subscriber[1], $hdrs, $body);
//.........这里部分代码省略.........
示例6: session_start
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!isset($_SESSION)) {
session_start();
}
include_once 'user.php';
if (!check_session_user() || !check_admin_user()) {
header('Location: index.php?error=Invalid User');
} else {
$users = get_users();
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" >
<title>Infrastructure Manager | GRyCAP | UPV</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>
<link href="css/datatable.css" rel="stylesheet" type="text/css" media="all"/>
<link rel="stylesheet" href="css/style_login2.css">
<link rel="stylesheet" href="css/style_intro2.css">
<link rel="stylesheet" href="css/style_menu2.css">
示例7: session_start
<?php
// this functionality is in a separate file to allow us to be
// more paranoid with it
// if anything goes wrong, we will exit
$max_size = 50000;
include 'include_fns.php';
session_start();
// only admin users can upload files
if (!check_admin_user()) {
echo 'You do not seem to be authorized to use this page.';
exit;
}
// set up the admin toolbar buttons
$buttons = array();
$buttons[0] = 'change-password';
$buttons[1] = 'create-list';
$buttons[2] = 'create-mail';
$buttons[3] = 'view-mail';
$buttons[4] = 'log-out';
$buttons[5] = 'show-all-lists';
$buttons[6] = 'show-my-lists';
$buttons[7] = 'show-other-lists';
do_html_header('Pyramid-MLM - Upload Files');
display_toolbar($buttons);
// check that the page is being called with the required data
if (!$HTTP_POST_FILES['userfile']['name'][0] || !$HTTP_POST_FILES['userfile']['name'][1] || !$HTTP_POST_VARS['subject'] || !$HTTP_POST_VARS['list']) {
echo 'Problem: You did not fill out the form fully. The images are the
only optional fields. Each message needs a subject, text version
and an HTML version.';
do_html_footer();
示例8: check_logged_in
function check_logged_in()
{
return check_normal_user() || check_admin_user();
}
示例9: send
function send($mailid, $admin_user, $emailAddr)
{
if (!check_admin_user($admin_user)) {
return false;
}
if (!($info = load_mail_info($mailid))) {
echo "Cannot load list information for message {$mailid}";
return false;
}
$subject = $info['subject'];
//$CI->email->subject($subject);
$listid = $info['listid'];
$status = $info['status'];
$sent = $info['sent'];
$from_name = 'Trimart';
$from_address = 'jamalbutcher@gmail.com';
//$CI->email->from($from_address,$from_name);
$query = "select email from sub_lists where listid =" . $listid;
$conn = db_connect();
$result = $conn->query($query);
if (!$result) {
echo "No result";
return false;
} else {
if ($result->num_rows == 0) {
echo "There is nobody subscribed to list number {$listid}";
return false;
}
}
$mail = new PHPMailer();
$mail->IsSMTP();
// we are going to use SMTP
$mail->SMTPAuth = true;
// enabled SMTP authentication
$mail->SMTPSecure = "ssl";
// prefix for secure protocol to connect to the server
$mail->Host = "smtp.gmail.com";
//"";192.168.20.202 // setting GMail as our SMTP server
$mail->Port = 465;
//;8089 // SMTP port to connect to GMail
$mail->Username = "jamalbutcher@gmail.com";
//"andre.campbell#mcalbds"; // user email address
$mail->Password = "P4m266a-mlx";
//"AC#220991"; // password in GMail
// read in the text version of the newsletter
$textfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\text.txt";
if (file_exists($textfilename)) {
$tfp = fopen($textfilename, "r");
$text = fread($tfp, filesize($textfilename));
fclose($tfp);
}
// read in the HTML version of the newsletter
$htmlfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\index.html";
if (file_exists($htmlfilename)) {
$hfp = fopen($htmlfilename, "r");
$html = fread($hfp, filesize($htmlfilename));
fclose($hfp);
}
// get the list of images that relate to this message
$query = "select path, mimetype from images where mailid = {$mailid}";
$result = $conn->query($query);
if (!$result) {
echo '<p>Unable to get image list from database.</p>';
return false;
}
$num = $result->num_rows;
for ($i = 0; $i < $num; $i++) {
//load each image from disk
$row = $result->fetch_array();
$imgfilename = APPPATH . "archive\\{$listid}\\{$mailid}\\" . $row[0];
$imgtype = $row[1];
// add each image to the object
//$message->addHTMLImage($imgfilename, $imgtype, $imgfilename, true);
$mail->AddEmbeddedImage($imgfilename);
// some attached files
//$mail->AddAttachment("images/phpmailer_mini.gif"); // as many as you want
}
// create message body
//$body = $message->get();
// create message headers
$from = '"' . get_real_name($admin_user) . '" <' . $admin_user . '>';
$hdrarray = array('From' => $from, 'Subject' => $subject);
//$hdrs = $message->headers($hdrarray);
if ($status == 'STORED') {
$mail->isHTML(true);
$mail->Subject = $subjectf;
$mail->AddAddress($_POST['emailAddr'], $admin_user);
$sent = FALSE;
// send the HTML message to the administrator
//$sender->send($admin_user, $hdrs, $body);
if ($html) {
$mail->Body = $html;
if (!$mail->Send()) {
echo "Error sending html version: " . $mail->ErrorInfo;
}
} else {
$sent = TRUE;
}
if ($sent) {
echo "Mail sent to {$admin_user} with email address " . $_POST['emailAddr'];
//.........这里部分代码省略.........
示例10: send
function send($mailid, $admin_user, $emailAddr)
{
$CI =& get_instance();
$CI->load->library('email');
/*$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
//$config['smpt_timeout'] = '5';
//$config['smtp_user'] = "jamalbutcher@gmail.com";
//$config['smtp_pass'] = "P4m266a-mlx";
$config['smtp_port'] = 465;//"8089";
$config['charset'] = 'iso-8859-1';
$config['mailtype'] = "text";
$config['newline'] = "\r\n";
//$config['validation'] = TRUE;*/
//$config['protocol'] = 'smtp';
//$config['smtp_host'] = 'aspmx.l.google.com'; //change this
//$config['smtp_port'] = '25';
//$config['smtp_user'] = 'jamalbutcher@gmail.com'; //change this
//$config['smtp_pass'] = 'P4m266a-mlx'; //change this
//$config['mailtype'] = 'text';
//$config['charset'] = 'iso-8859-1';
//$config['wordwrap'] = TRUE;
//$config['newline'] = "\r\n";
//$CI->email->initialize($config);
/*$CI->email->from('jamalbutcher@gmail', 'sender name');
$CI->email->to('jamalbutcher@gmail');
//$CI->email->cc('test2@gmail.com');
$CI->email->subject('Your Subject');
$CI->email->message('Your Message');
//$CI->email->attach('/path/to/file1.png'); // attach file
//$CI->email->attach('/path/to/file2.pdf');
if ($CI->email->send())
echo "Mail Sent!";
else
echo "There is error in sending mail!";*/
ini_set('SMTP', 'smtp.gmail.com');
//192.168.20.202
ini_set('smtp_port', 25);
//25
ini_set('sendmail_from', 'jamalbutcher@gmail');
//ini_set('smtp_user','jamalbutcher@gmail');
//ini_set('smptp_pass','P4m266a-mlx');
//ini_set('SMTP', '192.168.20.202'); //
//ini_set('smtp_port', 8089); //25
if (!check_admin_user($admin_user)) {
return false;
}
if (!($info = load_mail_info($mailid))) {
echo "Cannot load list information for message {$mailid}";
return false;
}
$subject = $info['subject'];
$CI->email->subject($subject);
$listid = $info['listid'];
$status = $info['status'];
$sent = $info['sent'];
$from_name = 'Trimart';
$from_address = 'jamalbutcher@gmail.com';
$CI->email->from($from_address, $from_name);
$query = "select email from sub_lists where listid =" . $listid;
$conn = db_connect();
$result = $conn->query($query);
if (!$result) {
echo "No result";
return false;
} else {
if ($result->num_rows == 0) {
echo "There is nobody subscribed to list number {$listid}";
return false;
}
}
// include PEAR mail classes
//include('Mail.php');
//include('Mail/Mime.php');
// instantiate MIME class and pass it the carriage return/line feed
// character used on this system
//$message = new Mail_mime("\r\n");
// read in the text version of the newsletter
$textfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\text.txt";
//$tfp = fopen($textfilename, "r");
//$text = fread($tfp, filesize($textfilename));
//fclose($tfp);
// read in the HTML version of the newsletter
$htmlfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\index.html";
//$hfp = fopen($htmlfilename, "r");
//$html = fread($hfp, filesize($htmlfilename));
//fclose($hfp);
// add HTML and text to the mimuser object
//$message->setTXTBody($text);
//$message->setHTMLBody($html);
// get the list of images that relate to this message
$query = "select path, mimetype from images where mailid = {$mailid}";
$result = $conn->query($query);
if (!$result) {
echo '<p>Unable to get image list from database.</p>';
return false;
}
$num = $result->num_rows;
for ($i = 0; $i < $num; $i++) {
//load each image from disk
//.........这里部分代码省略.........