anonīms Posted February 3, 2010 Report Share Posted February 3, 2010 1.kārt jau tam postam vajag escape stringu uzmest. un 2kārt. $_POST["nick"] ar $niks=$_POST["nick"] nav nekāda atšķirība. Quote Link to comment Share on other sites More sharing options...
briedis Posted February 3, 2010 Report Share Posted February 3, 2010 (edited) 1.kārt jau tam postam vajag escape stringu uzmest. un 2kārt. $_POST["nick"] ar $niks=$_POST["nick"] nav nekāda atšķirība. Ir, tikai atkarīgas kādās pēdiņās lieto iekļaujot stringā :) Kvērijā bija single quote, tas ir, apostrofs. Notestējiet: <?php $a = 123; echo 'Mainigais satur: $a'; ?> Edited February 3, 2010 by briedis Quote Link to comment Share on other sites More sharing options...
2easy Posted February 3, 2010 Report Share Posted February 3, 2010 (edited) haha, to laikam neviens pat nepamanīja :D izņemot bobsteri kr4 vispirms mācāmies pamatu pamatus, kas ir strings, un pēc tam tikai login skriptus bliežam augšā :P Edited February 3, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
bobsters Posted February 3, 2010 Report Share Posted February 3, 2010 haha, to laikam neviens pat nepamanīja :Dizņemot bobsteri kr4 vispirms mācāmies pamatu pamatus, kas ir strings, un pēc tam tikai login skriptus bliežam augšā :P es tak teicu ka kluda ir tur Quote Link to comment Share on other sites More sharing options...
bobsters Posted February 5, 2010 Report Share Posted February 5, 2010 if ($newnick == $newpass) { setcookie("user", $newnick, time()+3600); echo "Ieeja veiksmīga!"; } paskaidro ka var but jaunais niks == jauno paroli! ta tu nekad neielogosies! piemeram niks = janis parole = saule Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted February 5, 2010 Report Share Posted February 5, 2010 <? session_start(); mysql_connect("host","user","pass") or die(mysql_error()); mysql_select_db("database"); $key = md5("mykey"); if(isset($_COOKIE[$key])){ $user_id = $_COOKIE[$key]; } if(!isset($user_id)){ if(is_array($_POST["login"])){ if(count($_POST["login"])==3){ $user = stripslashes(strip_tags($_POST["login"][0])); $pass = stripslashes(strip_tags($_POST["login"][1])); $query = mysql_query("select id from users where nick='{$user}' and pass='{$pass}'"); if(@mysql_num_rows($query)){ $id = mysql_fetch_array($query); setcookie($key,$id["id"],3600); Header("Location: ?"); }else $error = 'login neizdevās'; }else $error = 'aizpildi visus laucinjus'; } ?> <html> <body> <?=($error?"<br><center>{$error}</center><br>":"")?> <form method="post"> Lietotajvards<br> <input type="text" name="login[]"><br> Parole<br> <input type="password" name="login[]"><br> <input type="subnit" name="login[]"> </form> </body> </html> <?}else{ $user = mysql_fetch_array(myqsl_query("select * from users where id='{$user_id}'")); ?> <html> <body> Čau <?=$user["nick"]?>!! </body> </html> <?}?> Quote Link to comment Share on other sites More sharing options...
2easy Posted February 5, 2010 Report Share Posted February 5, 2010 paskaidro ka var but jaunais niks == jauno paroli! ta tu nekad neielogosies! haha, tik daudz veidi kā šis skripts nestrādā! :D:D:D Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted February 5, 2010 Report Share Posted February 5, 2010 kautka tak jadzivo 2easy ;) 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.