My predecessors helped me solve this problem by creating a login user page. after completing the page, I gave it a login user verification. Then the code & lt ;? Phprequire_once (... ConnectionsboardConn. php );? & Gt; & lt ;? Phpif (! Function_exists (& quot; GetSQLValueString & qu predecessors, help solve this problem
I made a login user page, and after completing the page, I gave it a login user verification. Then the code is generated
If (! Function_exists ("GetSQLValueString ")){
Function GetSQLValueString ($ theValue, $ theType, $ theDefinedValue = "", $ theNotDefinedValue = "")
{
If (PHP_VERSION <6 ){
$ TheValue = get_magic_quotes_gpc ()? Stripslashes ($ theValue): $ theValue;
}
$ TheValue = function_exists ("mysql_real_escape_string ")? Mysql_real_escape_string ($ theValue): mysql_escape_string ($ theValue );
Switch ($ theType ){
Case "text ":
$ TheValue = ($ theValue! = "")? "'". $ TheValue. "'": "NULL ";
Break;
Case "long ":
Case "int ":
$ TheValue = ($ theValue! = "")? Intval ($ theValue): "NULL ";
Break;
Case "double ":
$ TheValue = ($ theValue! = "")? Doubleval ($ theValue): "NULL ";
Break;
Case "date ":
$ TheValue = ($ theValue! = "")? "'". $ TheValue. "'": "NULL ";
Break;
Case "defined ":
$ TheValue = ($ theValue! = "")? $ TheDefinedValue: $ theNotDefinedValue;
Break;
}
Return $ theValue;
}
}
?>
// *** Validate request to login to this site.
If (! Isset ($ _ SESSION )){
Session_start ();
}
$ LoginFormAction = $ _ SERVER ['php _ SELF '];
If (isset ($ _ GET ['accessscheck ']) {
$ _ SESSION ['prevurl'] = $ _ GET ['accessscheck '];
}
If (isset ($ _ POST ['username']) {
$ LoginUsername = $ _ POST ['username'];
$ Password = $ _ POST ['userpsw'];
$ MM_fldUserAuthorization = "";
$ MM_redirectLoginSuccess = "admin. php ";
$ MM_redirectLoginFailed = "index. php ";
$ MM_redirecttoReferrer = true;
Mysql_select_db ($ database_boardConn, $ boardConn );
$ LoginRS _ query = sprintf ("SELECT username, userpsw FROM board_admin WHERE username = % s AND userpsw = % s ",
GetSQLValueString ($ loginUsername, "text"), GetSQLValueString ($ password, "text "));
$ LoginRS = mysql_query ($ LoginRS _ query, $ boardConn) or die (mysql_error ());
$ LoginFoundUser = mysql_num_rows ($ LoginRS );
If ($ loginFoundUser ){
$ Logtailgroup = "";
If (PHP_VERSION> = 5.1) {session_regenerate_id (true);} else {session_regenerate_id ();}
// Declare two session variables and assign them
$ _ SESSION ['Mm _ username'] = $ loginUsername;
$ _ SESSION ['Mm _ usergroup'] = $ logtailgroup;
If (isset ($ _ SESSION ['prevurl']) & true ){
$ MM_redirectLoginSuccess =$ _ SESSION ['prevurl'];
}
Header ("Location:". $ MM_redirectLoginSuccess );
}
Else {
Header ("Location:". $ MM_redirectLoginFailed );
}
}
?>
But when I browse
The following error occurs on the page:
Warning: session_start () [function. session-start]: Cannot send session cache limiter-headers already sent (output started at E: \ AppServ \ www \ webBoard2 \ login. php: 2) in E: \ AppServ \ www \ webBoard2 \ login. php on line 5
This problem was foreseen in the past. // *** Validate request to login to this site.
If (! Isset ($ _ SESSION )){
Session_start ();
}
This section of PHP code can be put on it. I don't know how to solve it this time. please help me solve it. thank you.
------ Solution --------------------