beryoza Posted June 20, 2010 Report Share Posted June 20, 2010 Sveiki. Lieta tāda pabeidzu šodien Login,logout,register. utt... Tad sāku taisīt sākuma lapu un taisot to lapu nonācu pie secinājuma ka kkas nav pareizi. jo kad tu ieraksti Username un Login tevi aizmet uz konkrētu lapu pienemsim 127.0.0.1/sakums.php bet ja es nēsmu reģistrējies tad ierakstot manaip/sakums.php ari tevi laiž tajā lapa vaj manaip/galerijas.php utt... Jautājums - ka lai uztaisa lai cilvēks ienākot manā weblapa bez login nevarētu iet piem uz 127.0.0.1/sākums.php kā draugiem.lv ja tu ieraksti draugiem.lv/galery tev tikuntā atverās logs kur ierakstīt username un pasword un tikai kad tu to esi izdarījis tev lauj iet tālāk. Ceru ka sapratāt ko es domāju. Quote Link to comment Share on other sites More sharing options...
waplet Posted June 20, 2010 Report Share Posted June 20, 2010 varbūt tav parādi savu funkcionējošo login skriptu? Quote Link to comment Share on other sites More sharing options...
beryoza Posted June 20, 2010 Author Report Share Posted June 20, 2010 varbūt tav parādi savu funkcionējošo login skriptu? <?php session_start(); // Check if he wants to login: if (!empty($_POST[username])) { require_once("connect.php"); // Check if he has the right info. $query = mysql_query("SELECT * FROM members WHERE username = '$_POST[username]' AND password = '$_POST[password]'") or die ("Error - Couldn't login user."); $row = mysql_fetch_array($query) or die ("Error - Couldn't login user."); if (!empty($row[username])) // he got it. { $_SESSION[username] = $row[username]; echo "Welcome $_POST[username]Dodieties uz sakumu <a href='sakums.php'><b>Sakums</b></a>."; exit(); } else // bad info. { echo "Error - Couldn't login user.<br /><br /> Please try again."; exit(); } } ?> <html> <head> <title>Login</title> </head> <body> <form action="login.php" method="post"> <br> <br> <br> <br> <center><tr> <br> <br> Usename<br/><input type="text" class="inp" name="username" size="30" value="" /><br /> </tr> <tr>password<br/><input type="password" onKeyPress="return capsLock(event)" class="inp" name="password" size="30" autocomplete="off" /><br /> <td width="100%"><input type="submit" value="Ienakt!"></td> </tr><center> </table> </form> </body> <a id="nav_main" href="register.php">Registracija</a šādi Quote Link to comment Share on other sites More sharing options...
waplet Posted June 20, 2010 Report Share Posted June 20, 2010 un kā izskatās sākums . php? vajag likt pārbaudi vai SESSION username nav tukš.. un vēl pie else vajag uzlikt, lai SESSION username = NULL, lai nekas nav saglabājies Quote Link to comment Share on other sites More sharing options...
codez Posted June 20, 2010 Report Share Posted June 20, 2010 (edited) un kas notiks, ja es logojoties paroles vietā ierakstīšu: ' or 'a'='a ? P.S. Sāc ar kaut ko vienkāršāku, lai mācītos PHP. Edited June 20, 2010 by codez Quote Link to comment Share on other sites More sharing options...
waplet Posted June 24, 2010 Report Share Posted June 24, 2010 tas ir , ja magic quotes ir ieslēgti ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.