1

(5 replies, posted in PHP)

butent, kad esu padares jau pries tai ir kazkodel po paspaudimo migtuko nieko neperduodama... dabar uzsakiau hosta perkeliau ten failus viskas idealiai veikia. kas su php nustatymais galetu buti blogai?

2

(5 replies, posted in PHP)

validateForm(); ispradziu kreipia i javascript kad butu patikrintos ivestis ir tik tada siuncia i kita php faila

3

(5 replies, posted in PHP)

Sveiki,

Susiduriau su tokia problema, suvedant username, password check login failas negauna perduodamu duomenu.

login.php

<?php include("validateform.inc"); ?>
<html>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="saveform" method="POST" action="check_login.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Prisijungimas</strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="button" name="Submit" ONCLICK="validateForm()" value="Prisijungti"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</html>

check_login.php

<?php
error_reporting (E_ALL ^ E_NOTICE);
$host="localhost:3306";
$username="root"; 
$password=""; 
$db_name="test"; 

$con=mysqli_connect("$host", "$username", "$password", "$db_name"); 

if (mysqli_connect_errno($con))
  {
  echo "Neimanima prisijungti prie MySQL: " . mysqli_connect_error();
  }
  
if (isset($_POST['username'], $_POST['password']))
{
$myusername=$_POST['username']; 
$mypassword=$_POST['password']; 


$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql=mysqli_query($con, "SELECT Vardas FROM vartotojai WHERE username='$myusername' and password='$mypassword'");
if (!$sql) {
    die('Klaida query: ' . mysqli_error());
}
else {
$count=mysqli_num_rows($sql);

if($count==1){
$_SESSION["username"]=$myusername;
$_SESSION["password"]=$mypassword; 
$_SESSION["name"]=$sql;
header("location:login_success.php");
}
else {
echo "Neteisingas username arba password";

}}}
else { echo "Nenustatytas username ir/arba password"; }
?>

P.S. Perziurejau dauguma forumu, taip ir neradau atsakymo. Gal problema ne kode, o mano kompe? Naudoju xamp