Jump to content
php.lv forumi

Recommended Posts

Posted

<?
$hostname="localhost";
$mysql_login="root";
$mysql_password="";

if ($db = mysql_connect("$hostname", "$mysql_login" , "$mysql_password"))
{
echo "<br>";
}
else {
echo "<br>";
}

if (!(mysql_select_db("admin",$db)))
{
echo "nav kaartiibaa ar DB<br>";
}
else {
$q = "SELECT COUNT(*) FROM admini WHERE logins='$logins' AND parole=MD5('$parole')"
var $chek = 0;
if ($chek == 0) {
echo "nepareizi";
}
else {
header("Location: main.php");
}
}
?>

 

saka:

Parse error: parse error, unexpected T_VAR in D:\lapa\adm\php21D.tmp on line 28

 

28liinija: var $chek = 0;

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted (edited)

$chek="0"; a pasaka Parse error: parse error, unexpected T_VARIABLE in d:\lapa\adm\admin.php on line 28

Edited by SkyD
Posted

Nu es tak jau pateicu - nav nekāds "var" tur vajadzīgs!

$hostname="localhost";
$mysql_login="root";
$mysql_password="";

Te taču tu nekādu "var" neraksti!

Posted

aa nu tag ir... bet:

...
$q = "SELECT COUNT(*) FROM admini WHERE logins='$logins' AND parole=MD5('$parole')";
$chek=0;
if ($chek == 0) {
echo "nepareizi";
}
else {
header("Location: main.php");
}
....

 

Ierakstiju loginu un paroli pasaka "nepareizi" ... a kaa var paarliecināties ka logins un parole ir datu baazee?

Posted (edited)
$q = mysql_query("SELECT COUNT(*)...");
list($skaits) = mysql_fetch_ro($q);
if ($skaits==0) {
 echo 'tu esi ļaunais haxorz';
} else {
 echo 'welcome to mai page!';
}

Edited by bubu
Posted

pilniiigs vaaX... ir šita:

<?
$hostname="localhost";
$mysql_login="root";
$mysql_password="";

if ($db = mysql_connect("$hostname", "$mysql_login" , "$mysql_password"))
{
echo "<br>";
}
else {
echo "<br>";
}

if (!(mysql_select_db("admin",$db)))
{
echo "nav kaartiibaa ar DB<br>";
}
else {
$q = mysql_query("SELECT COUNT(*) FROM admini WHERE logins='$logins' AND parole=MD5('$parole')");
list($skaits) = mysql_fetch_row($q);
if ($skaits==0) {
echo 'tu esi launais haxorz ';
} else {
echo 'welcome to mai page!';
}
}
?>

neko neievadot abos laukos un nospiežot PIEVIENOTIES, man izmet nevis "welcome..." nevis "tu esi launais.." ... Lūdzu izlabojiet šito štelli un būs ok..

Posted

ja logins vai parole tuks, nemaz ij nevajag paarbaudit kaut ko ieks db, bet uzreiz teikt ka kaut kas nav labi. ja nu jaaraksta prieksaa tad

 

if(trim($logins) == '' || trim($parole) == '')
{
die('kaut kas nav labi'); // vai pareizak met atpakal uz login formu un radi paskaidrojumu
} else {
.. konektejies pie db
.. parbaudi
.. utt
}

Posted (edited)

Nu nekad, nekad nedariet šitā:

        $check = mysql_query('SELECT username FROM users WHERE username=\'' . $user . '\'');
        if(mysql_num_rows($check) == 0) {

Vai tad tik grūti to countu izselektēt?

        $check = mysql_query("SELECT COUNT(username) FROM users WHERE username='$user'");
        list($count) = mysql_fetch_row($check);
        if($count == 0) {

Edited by bubu
Posted (edited)

Jā, tas ir lēnāk. Padomā pats - vai mysql vajag skaitu (vienu skaitli) tikai dabūt un iedot php, vai arī vajag visus username datus izlasīt no db un pārsūtīt php.

Edited by bubu

×
×
  • Create New...