SkyD Posted July 15, 2005 Author Report Posted July 15, 2005 <? $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;
bubu Posted July 15, 2005 Report Posted July 15, 2005 Tas nav javascript, nav nekāds "var" nepieciešams.
SkyD Posted July 15, 2005 Author Report Posted July 15, 2005 (edited) $chek="0"; a pasaka Parse error: parse error, unexpected T_VARIABLE in d:\lapa\adm\admin.php on line 28 Edited July 15, 2005 by SkyD
bubu Posted July 15, 2005 Report Posted July 15, 2005 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!
SkyD Posted July 15, 2005 Author Report Posted July 15, 2005 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?
bubu Posted July 15, 2005 Report Posted July 15, 2005 Es tak tev teicu: SELECT COUNT(*) ... un salīdzini vai atgriež 0 vai >0
SkyD Posted July 15, 2005 Author Report Posted July 15, 2005 plz paraadi kaa tur jasaliidzina un taa lieta buus galaa ! =]
bubu Posted July 15, 2005 Report Posted July 15, 2005 (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 July 15, 2005 by bubu
SkyD Posted July 15, 2005 Author Report Posted July 15, 2005 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..
bubu Posted July 15, 2005 Report Posted July 15, 2005 Varbūt tev iekš db ir pievienots ierkasts ar tukšu loginu un paroli? (99.99%, ka jā)
v3rb0 Posted July 15, 2005 Report Posted July 15, 2005 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 }
maxi Posted July 15, 2005 Report Posted July 15, 2005 Regjistraaciju es taisiitu shaadi -> http://paste.php.lv/2206
bubu Posted July 15, 2005 Report Posted July 15, 2005 (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 July 15, 2005 by bubu
bubu Posted July 15, 2005 Report Posted July 15, 2005 (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 July 15, 2005 by bubu
Recommended Posts