PHP Full-Site Authorization code example:
- < html>
- < head>< title> e
- < /title >
- < /head >
- < body>
- < form action="login.php"
method="POST" >
User:
- < input type="text"
name="username">
- < br>
Password:
- < input type="password"
name="password">
- < input type ="Submit"
value = "OK" >
- < input type ="Reset"
value = "Cancel" >
- < /form >
- < /body >
- < /html >
----------------conn.php--------------------------
- < ? PHP
- $ Host = ' 127.0.0.1 ' ;
- $ Mysql_user = ' Root ' ;
- $ Mysql_password = ' qeephp ' ;
- $ MyDB = ' Learn ' ;
- $ Link = mysql_connect ($host,
$mysql _user, $mysql _password)
- Or Die ("Unable to connect to database:"
. Mysql_error ());
- mysql_select_db ($MYDB);
- ?>
----------------------------login.php------------------
- < ?
- $ username =$_post[' username '];
- $ Password =$_post[' password '];
- if ($username= = "") {
- echo " < script language=' javascript '>
Alert (' Illegal operation! '); location.href=
' index.php ' ; < /script > ";
- Exit
- }
- Require_once ("conn.php");
- $ SQL = "SELECT * from admin where
Username= ' $username ' ";
- $ result = mysql_query ($sql);
- $ Row = Mysql_fetch_array ($result);
- if ($row [' username ']== "") {
- echo " < script language=' javascript '>
Alert (' Wrong username! '); location.href=
' index.php ' ; < /script > ";
- Exit
- }else if ($row [' Password ']!= $password) {
- echo " < script language=' javascript '>
Alert (' Wrong password! '); location.href=' Index
. php '; < /script > ";
- echo "Wrong password";
- Exit
- }else{
- Session_Start ();
- $_session[' user ']= $username;
- echo " < script language=' javascript '>
Alert (' Landed successfully! '); location.href=
' list.php ' ; < /script > ";
- }
- ?>
------------------check.php--------------------
- < ?
- Session_Start ();
- if (! isset ($_session[' user '))
- {
- echo " < script language=' javascript '>
Alert (' Illegal operation! '); location.href=
' index.php ' ; < /script > ";
- Exit
- }else{
- echo "Welcome". $_session[' user '
." Login System ";
- }
- ?>
---------------------list.php-----------------
- < ?
- Include ' check.php ';
- ?>
- < html >
- < head >
- < script type="Text/javascript"
src = "Player/swfobject.js" > < /script >
- < /head >
- < body >
- < h3> Single file playback:< /h3>
- < p id="player1">< A href = "
http://www.macromedia.com/go/
Getflashplayer "> get player < /A> watch movies < / P >
- < script type="text/javascript">
- var S1 = New swfobject ("player/
Flvplayer.swf "," single "," 300 "," 170 "," 7 ");
- S1.addparam ("allowFullScreen", "true");
- S1.addvariable ("File", "player/ad.flv");
- S1.addvariable ("image", "player/preview.jpg");
- S1.addvariable ("width", "300");
- S1.addvariable ("height", "170");
- S1.write ("Player1");
- < /script >
- < h3>playlist file, with different
Colors:< /h3>
- < p id="player2">< a href="http:
Www.macromedia.com/go/getflashplayer ">
Get the Flash Player < /A > To see this player. < / P >
- < script type="text/javascript">
- var S2 = New swfobject ("Player/flvplayer
. swf "," playlist "," 300 "," 312 "," 7 ");
- S2.addparam ("allowFullScreen", "true");
- S2.addvariable ("File", "Player/playlist.xml");
- S2.addvariable ("Displayheight", "200");
- S2.addvariable ("BackColor", "0x000000");
- S2.addvariable ("Frontcolor", "0xCCCCCC");
- S2.addvariable ("Lightcolor", "0x557722");
- S2.addvariable ("width", "300");
- S2.addvariable ("height", "312");
- S2.write ("Player2");
- < /script >
- < /body >
- < /html >
--------------------logout.php-------------------------
- < ? PHP
- unset ($_session[' user ');
- unset ($_session[' password ');
- echo "Logout success";
- ?>
The above is the specific implementation of PHP full-site authorization verification.
http://www.bkjia.com/PHPjc/445984.html www.bkjia.com true http://www.bkjia.com/PHPjc/445984.html techarticle PHP Full-Site Authorization code example: HTML head title E/title/head body Form action = login.php method = POST User: input type = text Name = Username br Password: input type = ...