toms42 Posted July 10, 2010 Report Share Posted July 10, 2010 Sveiki, nu tad beidzot iesāku, ko vēlejos, prezicāk sakot macīties php valodu ^^ Protams izvelejos macities tieši tā pat ka css un html, nelasot nekadus suņa murgus vnk veidojot kkadu projektu! Taka ceru nedusmosietis bet mani šeit sastapsiet bieži ar dažādiem muļķīgiem jautajumiem! Tā tad 1. problēma! Es izveidoju registraciju ar login <?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 users 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. { $a = mysql_fetch_assoc(mysql_query("SELECT * FROM users")); $_SESSION[username] = $row[username]; echo "Sveiks $_POST[username] ".$a['ip']." ! You've been successfully logged in."; exit(); } else // bad info. { echo "Error - Couldn't login user.<br /><br /> Please try again."; exit(); } } ?> <div id="login"> <form action="login.php" method="post" class="login"> <fieldset> <legend>Autorizācija</legend> <label>Lietotajvards</label><br /> <input type="text" name="username" value="<? echo $_POST[username]; ?>" class="username" /><br /> <p class="username_error" style="margin: 0; display: none;">That Username is unavailable</p> <label>Parole</label><br /> <input type="password" name="password" value="" /><br /> <input type="submit" name="submit" value="Ienakt" /> <u>Registreties</u> </fieldset> </form> </div> Kā panākt, lai pec autorizācijas apstiprināšanas viņš nevis iemet login.php lapā, bet gan paliek index.php un login vieta nolasa lietotaja datus? Quote Link to comment Share on other sites More sharing options...
mickys Posted July 10, 2010 Report Share Posted July 10, 2010 (edited) pāradresācija echo "Sveiks $_POST[username] ".$a['ip']." ! You've been successfully logged in."; Šī vietā liec header("Location: index.php"); un parādīs index.php pie tam "Sveiks $_POST[username] "; fragments nevar strādāt, nepareiza sintakse vai nu "Sveiks ".$_POST['username']; vai "Sveiks {$_POST['username']}"; Edited July 10, 2010 by mickys Quote Link to comment Share on other sites More sharing options...
briedis Posted July 10, 2010 Report Share Posted July 10, 2010 Varbūt derētu tomēr tos suņa murgus arī palasīt... Uzzināt vismaz, kas tā tāda sql injekcija ir... Quote Link to comment Share on other sites More sharing options...
mounkuls Posted July 10, 2010 Report Share Posted July 10, 2010 Protams izvelejos macities tieši tā pat ka css un html, nelasot nekadus suņa murgus vnk veidojot kkadu projektu! Ceru, ka mainīsi domas. Vai vismaz nekad nebūsi admins kādai vietnei, kur lietotāji akli uzticēs tev savus datus... Quote Link to comment Share on other sites More sharing options...
toms42 Posted July 13, 2010 Author Report Share Posted July 13, 2010 Intresanti kāpēc? Atvaino nezinaju, ka tavi pirmie scripti bija izcili! Quote Link to comment Share on other sites More sharing options...
Леший Posted July 13, 2010 Report Share Posted July 13, 2010 toms42, slima suņa murgi dažreiz tiek sauktī arī par zināšanam, kurus indivīds iegūst vai nu lasot suņa murgus, vai nu uzkrājot pieredzi; uzmini, kurš variants ir ātrāks un mazāk sāpigāks. 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.