Home >Backend Development >PHP Tutorial >Static page calls user login and logout procedures in real time (js calls php code)_PHP tutorial
In program development, the page is often made into a static form of HTML, which can reduce the server load. However, there is also a problem that when a registered user logs in, a prompt that the login is successful or requires login must be displayed on the HTML page, so that we We have to think of other ways to achieve it. Below we will use js+php to implement the example. Of course, ajax can also be implemented
The static page calls the user login and logout program in real time (the web page special effects call the php tutorial code)
The static page calls the user login and logout procedures in real time (webpage special effects call php code)
body>
loginajax.php file code
$id = isset( $_get['fid'] )?$_get['fid']:0;
if( !isset($_cookie['vvg']) ){
?>
document.write('Username:');
document.write('');
}
else
{
echo 'document.write('['.$_cookie['realname'],']SpeakExit ');';
}
?>
This article was originally reproduced from http://www.bkjia.com/phper/php.html Please indicate the source, thank you for your cooperation.