eT` Posted March 19, 2011 Report Posted March 19, 2011 Tātad mans mod_rewrite bojā manu jQuery login formu mani pārmet uz lapu, kas izpildās no gadījumā. ar alert pārbaudīju, kādi ir dati, ko atgriež. data satur veselas lapas DOM. index.php <script language="javascript"> $(document).ready(function() { $("#login_form").submit(function() { $.post("../pages/login.php",{ user:$('#user').val(),pass:$('#pass').val(),rand:Math.random() } ,function(data) { if(data=='yes') { document.location='video'; } else { alert(data); document.location='pokers'; } }); return false; }); $("#pass").blur(function() { $("#login_form").trigger('submit'); }); }); </script> <?php $p=explode('/',$_SERVER['REQUEST_URI']); if ($p[1]=='' || $p[1] == 'home') $p[1]='index'; if (file_exists($m = 'pages/'.$p[1].'.php')) { include('pages/'.$p[1].'.php'); } else { echo '<h2>Lapa nav atrasta!</h2>'; } ?> <form method="post" id="login_form"> </form> un login.php <?php if(isset($_POST["user"]) && $_POST["user"] != '' && isset($_POST["pass"]) && $_POST["pass"] != '') { $user = escape($_POST["user"]); $pass = escape($_POST["pass"]); $pass = md5(sha1($pass)); $q = query("SELECT * FROM users WHERE username='".$user."' AND pass='".$pass."'"); if(mysql_num_rows($q) > 0) { echo 'yes'; $_SESSION["logged"] = $user; } else { echo 'no'; } } ?> un mans .htaccess Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !^(.+)\.(css|js|jpg|gif|png|ico|pdf)$ RewriteRule ^(.*) index.php [QSA,L] Quote
eT` Posted March 19, 2011 Author Report Posted March 19, 2011 it kā logina formu sataisīju šādi: <script language="javascript"> $(document).ready(function() { $("#login_form").submit(function() { $.post("login",{ user:$('#user').val(),pass:$('#pass').val(),rand:Math.random() } ,function(data) { document.location='home'; }); return false; }); }); </script> bet vai tā ir forši darīt? Quote
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.