js+php realization of static page real-time call User Login state method _php Tutorial

Source: Internet
Author: User

js+php realization of static page real-time call User Login state method


This article mainly introduces the js+php implementation of static page real-time call User Login state method, using the static page in the use of JS invoke PHP page to realize the user login status of real-time call function, the need for friends can refer to the next

In this paper, we describe the method of js+php implementing static page real-time call user login state. Share to everyone for your reference. The specific analysis is as follows:

In the program development, often the page into a static form of HTML, which can alleviate the server load, but there is also a problem is when the registered user login, in the HTML page to display the login success or need to login prompt, so we have to think of other ways to achieve, the following we are using js+ PHP to the instance, of course, Ajax can also be implemented, the code is as follows:

The code is as follows:





<title>Static page real-time call user login and Exit login program (Web effect call PHP code)</title>






loginajax.php file, because loginajax.php is called by the JS form of output, so the code inside the file due to the JS output can be displayed correctly, the code is as follows:

The code is as follows:

$id = isset ($_get[' fid ")? $_get[' FID ']:0;
if (!isset ($_cookie[' VVG ')) {
?>
document.write (' User name: ');
document.write (' ');
}
Else
{
Echo ' document.write (' ['. $_cookie[' realname '], ' speak out ');
}
?>

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/975896.html www.bkjia.com true http://www.bkjia.com/PHPjc/975896.html techarticle js+php Realization of static page real-time call the user login state method This article mainly introduced the js+php realization static page real-time calls the user login state method, uses in the static page to make ...

  • Related Article

    E-Commerce Solutions

    Leverage the same tools powering the Alibaba Ecosystem

    Learn more >

    Apsara Conference 2019

    The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

    Learn more >

    Alibaba Cloud Free Trial

    Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

    Learn more >

    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.