Ejemplo n.º 1
0
 function add($product_id)
 {
     //Get the product using id
     $product = $this->database->getProductbyId($product_id);
     if ($product) {
         $size = $this->input->post('size');
         if ($size) {
             $cart_item = array('id' => $product_id, 'qty' => '1', 'price' => $product['product_price'], 'name' => $product['product_name'], 'options' => array('Size' => $size));
             $row_id = $this->cart->insert($cart_item);
         }
     }
     show_alert($product['add_to_cart_comment']);
     redirect('cart');
 }
Ejemplo n.º 2
0
    //获取表单提交的用户名与密码信息
    $userName = isset($_POST['username']) ? $_POST['username'] : '';
    $userPwd = isset($_POST['userpwd']) ? $_POST['userpwd'] : '';
    //判断用户名和密码是否为空
    if ($userName == '') {
        show_alert('用户名不能为空!', '/login.php');
    }
    if ($userPwd == '') {
        show_alert('密码不能为空!', '/login.php');
    }
    //生成SQL语句,执行
    $sql = "SELECT * FROM xw_users WHERE uname='{$userName}' AND pwd='{$userPwd}'";
    $query = $db->query($sql);
    $userInfo = $db->fetch_one($query);
    if (empty($userInfo)) {
        //没有查找到记录,说明用户名密码错误,提示
        show_alert('用户名或密码不正确!', '/login.php');
    }
    //登录成功,记录已登录标示,然后跳转到首页
    $_SESSION['isLogin'] = true;
    jump_url('/');
} else {
    if ($action == 'logout') {
        //执行退出操作
        $_SESSION['isLogin'] = false;
        jump_url('/');
    } else {
        //加载首页模版
        include APPPATH . '/tpl/login.tpl.php';
    }
}
Ejemplo n.º 3
0
            if (isset($_POST["cbxactive"])) {
                $i = 1;
            }
            if (isset($_POST["cbxadmin"])) {
                $j = 1;
            }
            $str = "insert into users(username,password,firstname,lastname,salutation,email,officeno,office,permission,active,deptid,sm)";
            $str .= "values('" . $_POST["username"] . "','" . $_POST["password"] . "','" . ucfirst(strtolower($_POST["firstname"])) . "','" . ucfirst(strtolower($_POST["lastname"])) . "','" . $_POST["ddlsal"];
            $str .= "','" . $_POST["email"] . "','" . $_POST["officeno"] . "','" . $_POST["office"];
            $str .= "',{$j},{$i},1,'" . $_POST["ddlsm"] . "')";
            echo $str;
            $cnt = ExecuteNonQuery($str);
            if ($cnt == 1) {
                redirect_to("viewusers.php");
            } else {
                show_alert("Error in adding record..Please verify values");
            }
        }
    } else {
        if (count($errors) == 1) {
            $message = "There was 1 error in the form.";
        } else {
            $message = "There were " . count($errors) . " errors in the form.";
        }
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
Ejemplo n.º 4
0
    $userName = $_POST['username'];
    $content = $_POST['content'];
    if (empty($userName)) {
        show_alert('昵称不能为空!');
    }
    if (empty($content)) {
        show_alert('内容不能为空!');
    }
    $sql = "INSERT INTO xw_comment (aid, username, comment, adddate) VALUES('{$aid}', '{$userName}', '{$content}', '" . time() . "')";
    if ($db->query($sql)) {
        show_alert('发表评论成功!', 'read.php?aid=' . $aid);
    } else {
        show_alert('发表评论失败!');
    }
}
$sql = "SELECT * FROM xw_article WHERE aid='{$aid}' LIMIT 1";
$query = $db->query($sql);
$articleInfo = $db->fetch_one($query);
if (empty($articleInfo)) {
    //没有查询到指定的AID的文章内容
    show_alert('文章查找失败!');
}
//更新此文章的点击量
$sql = "UPDATE xw_article SET clicks=clicks+1 WHERE aid='{$aid}'";
$db->query($sql);
//查找该文章的所有评论
$sql = "SELECT * FROM xw_comment WHERE aid='{$aid}'";
$query = $db->query($sql);
$commentInfo = $db->fetch_all($query);
//显示修改文件的模版文件
include APPPATH . '/tpl/read.tpl.php';
Ejemplo n.º 5
0
ini_set("display_errors", "off");
include "includes/connect/php";
include "includes/DataAccess.php";
include "includes/form_functions.php";
include "includes/functions.php";
include "includes/session.php";
if (!logged_in()) {
    redirect_to("index.php");
}
if (isset($_POST['Submit'])) {
    $errors = array();
    $required_fields = array('username', 'firstname', 'lastname', 'email', 'office');
    $errors = array_merge($errors, check_required_fields($required_fields, $_POST));
    if (empty($errors)) {
        if ($_POST["ddlsal"] == "") {
            show_alert("Please select dropdown");
        } else {
            $i = 0;
            $j = 0;
            if (isset($_POST["cbxactive"])) {
                $i = 1;
            }
            if (isset($_POST["cbxadmin"])) {
                $j = 1;
            }
            $str = "update users set username='******',firstname='" . $_POST["firstname"];
            $str .= "',lastname='" . $_POST["lastname"] . "',salutation='" . $_POST["ddlsal"] . "',email='" . $_POST["email"] . "',officeno='" . $_POST["officeno"] . "',office='" . $_POST["office"] . "',permission={$j},active={$i},sm='" . $_POST["ddlsm"] . "' where uid=" . $_GET["id"];
            echo $str;
            ExecuteNonQuery($str);
            redirect_to("viewusers.php");
        }
Ejemplo n.º 6
0
</h3>
                    <span><?php 
echo conf('app.desc');
?>
</span>
                </div>
                <nav id="site-nav" class="clearfix">
                    <?php 
echo app('main-menu')->nav('menu menu-h');
?>
                    <?php 
echo app('user-menu')->nav('menu menu-h menu-right');
?>
                </nav>
            </header>
            <div id="site-contents" class="clearfix">
                <header id="content-header" class="clearfix">
                    <h3 id="page-title"><?php 
echo $heading;
?>
</h3>
                    <?php 
if (isset($toolbar)) {
    echo '<nav id="page-tool" class="clearfix">' . $toolbar->nav('menu menu-h menu-tool') . '</nav>';
}
?>
                </header>
                <div id="content-main" class="clearfix">
                    <?php 
echo show_alert();
Ejemplo n.º 7
0
    }
    //有图片上传,则进行图片上传操作,保存图片到指定目录
    if ($image['name'] != '') {
        //上传并保存图片
        $imageType = substr($image['name'], strrpos($image['name'], '.') + 1);
        if (!in_array($imageType, $upload_type)) {
            show_alert('上传的文件类型不允许!', '');
        }
        $imageName = date('Y-m-dHis') . '.' . $imageType;
        $imageUrl = $img_upload . $imageName;
        if (!move_uploaded_file($image['tmp_name'], APPPATH . trim($imageUrl, '/'))) {
            show_alert('图片上传失败,请重试!', '');
        }
    } else {
        $imageUrl = '';
    }
    //将文章记录保存到数据库
    $title = addslashes($title);
    $content = addslashes($content);
    $sql = "INSERT INTO xw_article (`title`, `content`, `image`, adddate, editdate) VALUES(\n\t'{$title}', '{$content}', '{$imageUrl}', " . time() . ", " . time() . ")";
    if ($db->query($sql)) {
        //添加成功
        $aid = $db->insert_id();
        show_alert('文章添加成功!', '/read.php?aid=' . $aid);
    } else {
        //添加失败
        show_alert('文章添加失败,请重试', '');
    }
}
//显示添加文章的模版界面
include APPPATH . '/tpl/add_article.tpl.php';
ob_start();
ini_set('display_errors', 'off');
require_once "includes/session.php";
include_once "includes/form_functions.php";
require_once "includes/functions.php";
include_once "includes/DataAccess.php";
if (!logged_in()) {
    redirect_to("index.php");
}
if (isset($_POST["Submit"])) {
    if ($_POST["ddlsem1"] != "") {
        $_SESSION["statusincsem"] = $_POST["ddlsem1"];
        redirect_to("statusindicator.php");
    } else {
        show_alert("Please select semester");
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select Semester</title>
<link href="css/style.css" rel="stylesheet" type="text/css">

</head>

<body>

<div id="container">
                        ExecuteNonQuery($str);
                        $str = "delete from catelog_temp where id=" . $_GET["id"];
                        ExecuteNonQuery($str);
                        redirect_to("viewcourses.php");
                    } else {
                        echo "Error: " . $sql . "<br>" . mysqli_error($conn);
                    }
                } else {
                    $str = "delete from catelog_temp where id=" . $_GET["id"];
                    $cnt = ExecuteNonQuery($str);
                    if ($cnt == 1) {
                        redirect_to("viewuacourses.php");
                    }
                }
            } else {
                show_alert("Please select department");
            }
        } else {
        }
    } else {
        if (count($errors) == 1) {
            $message = "There was 1 error in the form.";
        } else {
            $message = "There were " . count($errors) . " errors in the form.";
        }
    }
}
?>


<!doctype html>
}
if (isset($_POST["submit"])) {
    if ($_POST["slctver"] != "") {
        if ($_GET["flag"] == "1") {
            $sql = "update fileinfo set active=0 where ftype='gmatrix'";
            ExecuteNonQuery($sql);
            $sql = "update fileinfo set active=1 where ftype='gmatrix' and version='" . $_POST["slctver"] . "'";
            ExecuteNonQuery($sql);
        } else {
            $sql = "update fileinfo set active=0 where ftype='matrix'";
            ExecuteNonQuery($sql);
            $sql = "update fileinfo set active=1 where ftype='matrix' and version='" . $_POST["slctver"] . "'";
            ExecuteNonQuery($sql);
        }
        $msg = "Version Activated";
        show_alert($msg);
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select Version</title>
<link href="css/style.css" rel="stylesheet" type="text/css">

</head>

<body>

<div id="container">
            $uploads_dir = getcwd() . '/csfu';
            if (file_exists($uploads_dir . "/" . $filename)) {
                unlink($uploads_dir . "/" . $filename);
            }
            $tmp_name = $_FILES["matrixfile"]["tmp_name"];
            $name = $_FILES["matrixfile"]["name"];
            $moveResult = copy($tmp_name, "{$uploads_dir}/" . $name);
            if ($moveResult == true) {
                //					echo "File has been moved from " . $tmp_name . " to" . $name;
                redirect_to("insertcsassigns.php");
            } else {
                echo "ERROR: File not moved correctly";
            }
        }
    } else {
        show_alert("Please select filename");
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Upload Live Excel File</title>
<link href="css/style.css" rel="stylesheet" type="text/css">

</head>

<body>

<div id="container">
Ejemplo n.º 12
0
    echo htmlspecialchars($str);
    echo '");</script></body></html>';
}
session_start();
if (!isset($_SESSION['user'])) {
    show_alert('Not logged in.');
    exit;
}
require 'inc/database.php';
require 'inc/preferences.php';
require 'inc/lang_conf.php';
require 'inc/tgz.lib.php';
$pref = unserialize($_SESSION['pref']);
$now = time();
if ($now - $pref->backuptime < 604800) {
    show_alert('You can only do this once a week!');
    exit;
}
$archive = "backup-{$now}";
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $archive . '.tar.gz"');
$fout = fopen('php://output', 'wb');
if ($fout === FALSE) {
    exit;
}
$tar = new TGZfile($fout);
$pref->backuptime = $now;
$_SESSION['pref'] = serialize($pref);
$user = mysql_real_escape_string($_SESSION['user']);
mysql_query("insert into preferences(user_id,property,value) values ('{$user}','backuptime','{$now}') ON DUPLICATE KEY UPDATE value='{$now}'");
$res = mysql_query("SELECT problem_id,language,source FROM source_code , (SELECT max_sol,problem_id,language FROM solution,  (SELECT max(solution_id) AS max_sol FROM solution WHERE user_id='{$user}' AND result=0 GROUP BY problem_id) last WHERE solution_id=max_sol) tmp  WHERE source_code.solution_id=max_sol");
                    //			echo $query;
                    if ($cnt > 0) {
                        redirect_to("retrivesurvey.php?msg=Survey updated successfully?flag=1");
                    } else {
                        redirect_to("retrivesurvey.php?msg=Error in updating survey?flag=2");
                    }
                }
            } else {
                $name = GetSingleField("select subname from subject where subid=" . $subid, "subname");
                show_alert("Please enter objective of '" . $name . "\\'");
            }
        } else {
            show_alert("Subject selection same on both side");
        }
    } else {
        show_alert("please select subject from both list");
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Course Assesment Survey</title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
<script src="js/jquery-latest.min.js"></script>
<script type='text/javascript' src='js/menu_jquery.js'></script>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script>
function showUser(str)
{
Ejemplo n.º 14
0
include_once 'linkstart.php';
if (!is_login()) {
    header("location: login.php?action=err&mes=你需要登录才能查看用户信息!");
    exit;
}
show_head('状态信息');
echo '<!-- 导航条 -->';
show_bar();
echo '<!-- 导航条结束 -->
<!-- 主体部分 -->';
//print_r($user);
?>
    <?php 
echo '<div class="container">';
show_alert();
echo '</div>';
global $message;
if (!@$_GET['messageid']) {
    header("location: messagelist.php?action=err&mes=信息不存在!");
    exit;
}
$message = get_message_by_id($_GET['messageid']);
show_message($message);
?>





<!-- Bootstrap core JavaScript
Ejemplo n.º 15
0
function show_form_error()
{
    $string = validation_errors();
    return show_alert($string);
}
Ejemplo n.º 16
0
require_once "includes/functions.php";
include_once "includes/DataAccess.php";
if (!logged_in()) {
    redirect_to("index.php");
}
if (isset($_POST["Submit"])) {
    if (isset($_POST["rdbdegree"])) {
        //	$_SESSION["ddlsem"]=$_POST["ddlsem"];
        $_SESSION["rdbdeg"] = $_POST["rdbdegree"];
        if ($_POST["rdbdegree"] == "1") {
            redirect_to("uploadmatrix.php?flag=1");
        } else {
            redirect_to("uploadmatrix.php?flag=0");
        }
    } else {
        show_alert("Please select degree");
    }
    //	}
    //	else
    //	{
    //		show_alert("Please select Degree");
    //	}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select Degree</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
Ejemplo n.º 17
0
    echo htmlspecialchars($str);
    echo '");</script></body></html>';
}
if (!isset($_SESSION['user'])) {
    $info = _('Please login first...');
    show_alert($info);
    exit;
}
require __DIR__ . '/conf/database.php';
require __DIR__ . '/lib/lang.php';
require __DIR__ . '/lib/tgz.lib.php';
$pref = unserialize($_SESSION['pref']);
$now = time();
if ($now - $pref->backuptime < 604800) {
    $info = _('You can only backup your code not more than once a month...');
    show_alert($info);
    exit;
}
$archive = "backup-{$now}";
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $archive . '.tar.gz"');
$fout = fopen('php://output', 'wb');
if ($fout === FALSE) {
    exit;
}
$tar = new TGZfile($fout);
$pref->backuptime = $now;
$_SESSION['pref'] = serialize($pref);
$user = mysql_real_escape_string($_SESSION['user']);
mysql_query("insert into preferences(user_id,property,value) values ('{$user}','backuptime','{$now}') ON DUPLICATE KEY UPDATE value='{$now}'");
$res = mysql_query("SELECT problem_id,language,source FROM source_code , (SELECT max_sol,problem_id,language FROM solution,  (SELECT max(solution_id) AS max_sol FROM solution WHERE user_id='{$user}' AND result=0 GROUP BY problem_id) last WHERE solution_id=max_sol) tmp  WHERE source_code.solution_id=max_sol");
Ejemplo n.º 18
0
  
  <form method="post" enctype="multipart/form-data">

    <div class="subnav">
      <div class="container clearfix">
        <h1><span class="glyphicon glyphicon-home"></span> &nbsp; Home</h1>
        <div class="btn-placeholder">
          <input type="submit" class="btn btn-success btn-sm" value="Save Changes" name="btn-pages-home">
        </div>
      </div>
    </div>

    <?php 
/* --- IMPORTANT --- */
echo '<span id="id-alert-image"></span>';
show_alert($_SESSION['alert']['type'], $_SESSION['alert']['msg']);
?>

    <div class="container main">
      <div class="box row" id="pages_banner">
        <div class="desc col-xs-3">
          <h3>Banners</h3>
          <p>Edit home page banners.</p>
        </div>
        <div class="content col-xs-9">
          <ul class="field-set">
            <li class="form-group row img-placeholder underlined">
              <label class="control-label col-xs-3">Main Banners</label>
              <div class="col-xs-9">
                <div class="row row-5" id="row_slide">
Ejemplo n.º 19
0
')"><i class="glyphicon glyphicon-trash"></i></button>
											</td>
										</tr>
									<?php 
}
?>
							    </tbody>
							</table>
						</div>
						 <div class="tab-pane fade in active" id="que">
						 <?php 
if (isset($_SESSION['alert'])) {
    echo '<br />';
    $type = $_SESSION['type'];
    $msg = $_SESSION['alert'];
    echo show_alert($type, $msg);
    unset($_SESSION['type']);
    unset($_SESSION['alert']);
}
?>
						 <hr />
						 <!-- <div class="pull-left">
						 <button class="btn btn-info" onclick="send_btn('all')"><i class="glyphicon glyphicon-envelope"></i> Send All</button>
						 <br /><br />
						 </div> -->
						 	<table id="example" class="display" cellspacing="0" width="100%" style="font-size:13px;table-layout:fixed;">
							    <thead>
							        <tr>
							        	<!-- <th>No.</th> -->
							            <th>Sender</th>
							        	<th style="width:100px;">Message</th>