nevidimka Posted November 26, 2008 Report Share Posted November 26, 2008 (edited) So .. Ir izveidota forma ar POST uz process.php ! Formu submitojot sanemu /The webpage cannot be found/ erroru .. Ja panemu un vnk so process.php atveru bez formas - viss atveras ok. So - where is the problem ? Nesaprotu kadelj fails netiek atrasts ja redirectojos caur formu .. Kadas idejas ? Edited November 26, 2008 by nevidimka Link to comment Share on other sites More sharing options...
Aleksejs Posted November 26, 2008 Report Share Posted November 26, 2008 (edited) Sveiks! Parādi kodu. P.S. Kodu vēlams rādīt caur paste.php.lv Edited November 26, 2008 by Aleksejs Link to comment Share on other sites More sharing options...
nevidimka Posted November 26, 2008 Author Report Share Posted November 26, 2008 Forma ( index.php ) : <form name="lgn" action="process.php" method="POST"> <input type="text" name="user"> <br> <input type="password" name="psw"> <input type="submit" value="Ielogoties"> </form> Parbaude ( process.php ) : <?php include ("includes/dbconnect.php"); $user= $_POST['user']; $query = "SELECT * FROM chars WHERE username='$user'"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($_POST['psw'] == $row['password']) { session_start(); $_SESSION['user'] = $user; header( 'Location: main.php' ); } else { header( 'Location: index.php' ); } } ?> Reali process.php fails pats par sevi strada, bet kolidz tas tiek izsaukts caur formu - Not found .. Link to comment Share on other sites More sharing options...
Aleksejs Posted November 26, 2008 Report Share Posted November 26, 2008 Vai gadījumā nav tā, ka abi šie faili ir dažādos katalogos? Link to comment Share on other sites More sharing options...
nevidimka Posted November 26, 2008 Author Report Share Posted November 26, 2008 Ne, visi faili ir tur kur viniem vajadzetu but - viss viena mape lai nejauktu gaisu .. Link to comment Share on other sites More sharing options...
Aleksejs Posted November 26, 2008 Report Share Posted November 26, 2008 Šķiet atradu: kad norādi header(); Location parametram ir jābūt pilnai adresei, neder tikai main.php vai index.php Tātad pamēģini pārrakstīt: header('Location: http://tavs.mega.saits/main.php'); Link to comment Share on other sites More sharing options...
nevidimka Posted November 26, 2008 Author Report Share Posted November 26, 2008 (edited) header( 'Location: http://localhost/index.php' ); Paldies par ideju, bet ari sis neko nemaina .. Joprojam /The webpage cannot be found/. Un isti header redirectam seit manuprat nav nozimes jo tas tiek izpildits tikai ja formas submits ir veiksmigs .. bet pec submita fails process.php vienkarsi "neeksiste" :( Edited November 26, 2008 by nevidimka Link to comment Share on other sites More sharing options...
andrisp Posted November 26, 2008 Report Share Posted November 26, 2008 Aleksej, nē, varbūt arī nepilna adrese. Link to comment Share on other sites More sharing options...
Klez Posted November 26, 2008 Report Share Posted November 26, 2008 nevidimka, varbuut paskaties apache access.log failaa ? tur buus paraadiits kas no kurienies tiek mekleets un kur mekleets ... Link to comment Share on other sites More sharing options...
Aleksejs Posted November 26, 2008 Report Share Posted November 26, 2008 Andri, hmm, bet standartā rakstīts, ka: The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI. Link to comment Share on other sites More sharing options...
nevidimka Posted November 26, 2008 Author Report Share Posted November 26, 2008 (edited) [Wed Nov 26 12:31:03 2008] [error] [client 127.0.0.1] script 'C:/wamp/www/main.php' not found or unable to stat, referer: http://localhost/ Mans pedejais meginajums tikt klat process failam .. main.php fails ir tiesi taja pasa directorija ( C:/wamp/www/main.php ) kur process.php .. Un ja netiek atrasts main.php ( kaut gan vins tur ir ), kadel vins man neparada ka nav atrasts main.php nevis process.php ( ka tas ir sobrid ) ? Vel viena nianse - pie paroles parbaudes tiek izskirsts uz kuru lapu doties .. Tatad sobrid pie pareizas paroles vins man neatrod process.php failu ( ka tas var but ja vins ir parbaudijis paroles pareizibu ? ), bet - ja ierakstu nepareizu paroli, redirects uz index.php nostrada momentali .. Edited November 26, 2008 by nevidimka Link to comment Share on other sites More sharing options...
Aleksejs Posted November 26, 2008 Report Share Posted November 26, 2008 Viņš neatrod main.php nevis process.php Link to comment Share on other sites More sharing options...
rpr Posted November 26, 2008 Report Share Posted November 26, 2008 peec header location veel veelams ielikt exit, lai kods, kas aiz taa seko netiktu izpildiits. a tu pats nejauc main.php ar process.php? Link to comment Share on other sites More sharing options...
andrisp Posted November 26, 2008 Report Share Posted November 26, 2008 Aleksej, pēc standartiem jā, bet cik esmu novērojis, tad "visi" (cik nu man ir sanācis viņus visādus lietot) pārlūki atbalsta relatīvos ceļus arī. Link to comment Share on other sites More sharing options...
nevidimka Posted November 26, 2008 Author Report Share Posted November 26, 2008 (edited) Aleksejs : vins varbut neatrod ari localhost, bet kadelj tad izpilde apstajas process.php nevis taja main.php ? Kadelj tad vins neatver adresi main.php un neparada Not Found, bet paliek pie process.php ? rpr : Nejaucu .. jau 30x esmu visu parbaudijis un drosibas labad nochekojis .. Visi faili ir viena mape www ( faili index.php, process.php un main.php ) ! Kaa vinsh vinus var neatrast ? Luuk .. Rezultats pec formas submita : Rezultats pec linka ievades bez submita : Apache direktorijs : NOTE : uz doto bridi main.php parsaucu par game.php, protams ar atbilstosiem labojumiem parejos failos .. Edited November 26, 2008 by nevidimka Link to comment Share on other sites More sharing options...
Recommended Posts