PHP + session°ÝÃD
±z¬O²Ä
471ÓÂsÄýªÌ
¤p§Ì°µºòÓ´úÅçºô¶, ¦³¥H¤Uo¬Jerror,½Ð¦U¦ì¸Ñµª¤UÀ³¸ÓÂI¸Ñ¨M,thx!!!
¤@login´N·|¤J¥ªÓadd_quiz.php o¬Jºô¶¤W¤è´N¦³¥H¤Umsg..¦ý¥ò¥i¥H°µ³¥
Notice: A session had already been started - ignoring session_start() in
c:\Inetpub\wwwroot\intranet\chi_quiz\add_quiz.php on line
3
¦pªG¹Á¸Õupload file´N·|¥X¥H¤Uerror msg,¦A°µø¨ì³¥...
Warning: session_start() [
function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\Inetpub\wwwroot\intranet\chi_quiz\batch_add_quiz.php.php:1) in
c:\Inetpub\wwwroot\intranet\chi_quiz\connection.php on line
3
Warning: session_start() [
function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\Inetpub\wwwroot\intranet\chi_quiz\batch_add_quiz.php.php:1) in
c:\Inetpub\wwwroot\intranet\chi_quiz\connection.php on line
3
connection.php
<?php
session_start();
//load form database
$link = mysql_connect("localhost", "quiz_login", "quiz");
mysql_select_db("chi_quiz");
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
mysql_query("SET CHARACTER SET utf8", $link);
mysql_query("SET NAMES 'utf8'", $link);
?>
-----------------------------------------------------------------------------------------------------------------
index.php
<?php
include 'connection.php';
$err = 0;
if ($_POST)
{
$login = $_POST['login'];
$pwd = $_POST['password'];
$sql = "select `login`, `className` , `login_times` from `student` where `login`='$login' and `password` ='$pwd'";
$result = mysql_query($sql);
if (mysql_num_rows($result)==1)
{
$rowArray = mysql_fetch_row($result);
$class = $rowArray[1];
$login_times = $rowArray[2];
$_SESSION["logNm"]= $login;
$_SESSION["class"]= $class;
if ($login=="admin")
{
header('location: add_quiz.php');
.
.
.
?>
<html>
......
</html>
..........................................................................................................................................
add_quiz.php
<?php
require 'connection.php';
session_start();
if (!$_SESSION or $_SESSION["logNm"] != "admin")
{
header('location: index.php');
}
.
.
.
?>
<html>
......
</html>
-------------------------------------------------------------------------------------------------------------------------------
batch_add_quiz.php
<?php
include'connection.php';
require "../common/input/excel/reader.php";
// Retreive the file name, size and type
$q_id = $_POST['qid'];
$f_name = $_FILES['fname']['name'];
$f_size = $_FILES['fname']['size'];
$f_type = $_FILES['fname']['type'];
.
.
.
?>
[
¥»©«³Ì«á¥Ñ tinlok115 ©ó 2008-2-26 14:21 ½s¿è ]
¹ê¥Î¬ÛÃö·j´M: nds hp online cat it ati nec excel