Jump to content
php.lv forumi

login


jauninjais

Recommended Posts

diezgan vienkaarshs kods, bet nevaru izdomaat kas jaadara. kaa var apsleept to logu, kur vajag ievadiit paroli peec pareizas paroles ievadiishanas?

<?
$password = "parole";
if ($action=="login"){
if ($pass==$password){
include '1.html';}
else {echo "Nepareiza parole";}}
?>
<html>
<head>
</head>
<body>
<table border=1 align=middle>
<form method="post" action="?action=login"><td>Parole:</td><td><input type="password" name="pass"><input type="submit" value="Ieiet"></td></form></table>
</body>
</html>

Link to comment
Share on other sites

shaadi???

 

<?
$password = "parole";
if ($action=="login"){
if ($pass==$password){
$notShow = 1;
include '1.html';}
else {echo "Nepareiza parole";}}

if(!isset($notShow)){
?>
<html>
<head>
</head>
<body>
<table border=1 align=middle>
<form method="post" action="?action=login"><td>Parole:</td><td><input type="password" name="pass"><input type="submit" value="Ieiet"></td></form></table>
</body>
</html>
<?php } ?>

Edited by Kristabs
Link to comment
Share on other sites

veel 1 jautaajums, kaa var atvieglinaat sho kodu, es domaaju tieshi to post metodi, es saprotu,ka stulbi uztaisiits, bet ...

<form method="post" action="jauna_zinja.php">
<table align="middle" bordercolor="#800000" border="1">
<tr>
<td><textarea name="zinja" onFocus="this.value=''" wrap="virtual" rows="10" cols="40">Pievienot jaunu ziņu</textarea></td></tr><tr align="center"><td>
<input type="submit" name="submit" value="Ierakstīt"> 
</font></form>
</td>
</tr></table>
<?
$zinja=$_POST['zinja'];
$konekcija=mysql_connect('127.0.0.1','useris','parole2') or die ("PHPMYADMINAM  pieslēgties neizdevās");
mysql_select_db('dbaaze',$konekcija);
$vaicajums=mysql_query("INSERT INTO `tabula`(`zinja`) VALUES ('$zinja')",$konekcija);
$rezultats=mysql_query($vaicajums2,$konekcija);
$rindas=mysql_num_rows($rezultats);
mysql_close($konekcija);
?>
</body>
</html>

 

veel probleema tajaa, ka vinsh izmet erroru Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/home/ftp/jauna_zinja.php on line 25

 

un iespeejams, ka deelj taa, man saak pievienot ieraxtus nevis tabulas augshaa, bet beigaas

Edited by jauninjais
Link to comment
Share on other sites

Sorry, nepamanīju..

Kļūdas iemesls: $vaicajums ir sintaktiski nekorekts.

un vienmēr pārbaudi mysql_query funkcijas atgriesto rezultātu!!! Ja tas ir false, tad izsauc mysql_error(). UZREIZ redzēsi, kas par kļudu

Link to comment
Share on other sites

×
×
  • Create New...