Jump to content
php.lv forumi

Pec formas Submit'a fails netiek atrasts ( kaut gan vins tur ir )


nevidimka

Recommended Posts

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 by nevidimka
Link to comment
Share on other sites

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

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 by nevidimka
Link to comment
Share on other sites

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

[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 by nevidimka
Link to comment
Share on other sites

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 :

zx0silsxmzz07ji5w4m.jpg

 

Rezultats pec linka ievades bez submita :

hla2gy7ln0p03k1277fi.jpg

 

Apache direktorijs :

rtipa64f8gjwdbs1sx.jpg

 

NOTE : uz doto bridi main.php parsaucu par game.php, protams ar atbilstosiem labojumiem parejos failos ..

Edited by nevidimka
Link to comment
Share on other sites

×
×
  • Create New...