Seniors, help solve this problem

Source: Internet
Author: User
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 --------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.