Dede determines whether to log on

Source: Internet
Author: User

I found information on the Internet, which is more reliable,

JS Code:

Copy Co De

<Script language = "javasExport "src =" {Dede: Global name = 'cfg _ cmspath '/}/include/dedeajax2.js "> </SCRIPT>

<Script language = "javasOther ">

Function checkuser (){

VaR taget_obj = Document. getelementbyidx_x ('_ userboxform ');

Myajax = new dedeajax (taget_obj, false, false ,"","","");

Myajax. sendget2 ("{Dede: Global name =" cfg_memberurl "/}/userboxsta. php ");

Dedexhttp = NULL;

}

</SCRIPT>

Then we modify the code on the Content Page.
Find:
<Div>
<DL>
<Dd class = "MTop">
<Strong> User name: </strong> <input name = "username" class = "username" type = "text" maxlength = "20"/>
<Strong> password: </strong> <input name = "PWD" class = "password" type = "password" maxlength = "20"/>
</DD>
Modify it
<Div class = "userbox">
<DL>
<Dd class = "MTop">
<Span id = "_ userboxform">
<Strong> User name: </strong> <input name = "username" class = "username" type = "text" maxlength = "20"/>
<Strong> password: </strong> <input name = "PWD" class = "password" type = "password" maxlength = "20"/>
</Span>
</DD>
<Span id = "_ userboxform"> is added to determine whether the user has logged on.

Next we will write a PHP file. The user transfers the data and saves it as/member/userboxsta. php. The Code is as follows:

Copy Co De

<? PHP
Header ("Pragma: No-Cache \ r \ n ");
Header ("cache-control: No-Cache \ r \ n ");
Header ("expires: 0 \ r \ n ");
Header ("Content-Type: text/html; charset = gb2312 ");
// The system is set to maintenance and accessible.
$ Pai_iscanview = true;
Require_onCe (dirname (_ file _). "/../include/inc_memberlogin.php ");
$ Pai_ml = new memberlogin ();
If (empty ($ cmd_ml-> m_id) {echo ""; exit ();}
$ Uid = $ pai_ml-> m_loginid;
?>
<Strong> welcome </strong> [<? PHP echo $ cmd_ml-> m_username?>], Now you can publish messages directly.

Some silly programmers may find that they are not successful.

1. You need to call it when loading the body onload ..

2. The newly written page

Userboxsta. php does not load the configuration file to the page

Add require_once (dirname (_ file _). "/config. php ");

OK


Require_once (dedeinc. '/memberlogin. Class. php ');
$ Pai_ml = new memberlogin ();
If ($ logs _ml-> islogin ()){
Echo "logged in ";
} Else {
Echo "No Logon ";
}

Http://wenwen.soso.com/z/q453202582.htm

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.