SkyD Posted July 15, 2005 Author Report Share 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; Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share Posted July 15, 2005 Tas nav javascript, nav nekāds "var" nepieciešams. Link to comment Share on other sites More sharing options...
SkyD Posted July 15, 2005 Author Report Share 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 Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share 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! Link to comment Share on other sites More sharing options...
SkyD Posted July 15, 2005 Author Report Share 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? Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share Posted July 15, 2005 Es tak tev teicu: SELECT COUNT(*) ... un salīdzini vai atgriež 0 vai >0 Link to comment Share on other sites More sharing options...
SkyD Posted July 15, 2005 Author Report Share Posted July 15, 2005 plz paraadi kaa tur jasaliidzina un taa lieta buus galaa ! =] Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share 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 Link to comment Share on other sites More sharing options...
SkyD Posted July 15, 2005 Author Report Share 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.. Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share Posted July 15, 2005 Varbūt tev iekš db ir pievienots ierkasts ar tukšu loginu un paroli? (99.99%, ka jā) Link to comment Share on other sites More sharing options...
v3rb0 Posted July 15, 2005 Report Share 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 } Link to comment Share on other sites More sharing options...
maxi Posted July 15, 2005 Report Share Posted July 15, 2005 Regjistraaciju es taisiitu shaadi -> http://paste.php.lv/2206 Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share 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 Link to comment Share on other sites More sharing options...
maxi Posted July 15, 2005 Report Share Posted July 15, 2005 Tas ir slikti, zuud aatrums vai kaa? Hmm.. Link to comment Share on other sites More sharing options...
bubu Posted July 15, 2005 Report Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts