reGative Posted August 22, 2010 Report Share Posted August 22, 2010 (edited) Sveiki! Kodējos atkal, nedaudz vairāk apguvu PHP un Mysql, bet laikam ne pietiekami... Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in B:\xampp\htdocs\cms\login.php on line 25 Kods: <?php session_start(); include('Blurry_Include/include.php'); $result = mysql_query("SELECT * FROM blurry_settings"); while($row = mysql_fetch_array($result)) { include('languages/'.$row['SiteLang'].'/general.php'); $page = LOGIN; include('styles/'.$row['SiteTheme'].'/header.php'); } echo '<h2>'. LOGIN .'</h2>'; if(isSet($_GET['reason']) and $_GET['reason'] == 'login') { $nick = htmlSpecialChars($_POST['nick']); $pass = htmlSpecialChars(sha1($_POST['pass'])); $query = 'SELECT * FROM blurry_users WHERE user_nick="'.mysql_real_escape_string($nick).'" AND user_pass="'.mysql_real_escape_string($pass).'"'; $final = mysql_query($query); if (mysql_num_rows($final) != 1) { echo LOGIN_ERROR; } else { $get_id = 'SELECT user_id FROM blurry_users'; $fetch = mysql_query($get_id); while($row = mysql_fetch_array($fetch)) { $id = $row['user_id']; } mysql_query('UPDATE blurry_users SET user_online = "Y" WHERE user_id = "'.$id.'"'); } echo '<form action="login.php?reason=login" method="post">' .NICK.'<input type="text" name="nick" /><br />' .PASSWORD.'<input type="password" name="pass" /><br /> <input type="submit" value="OK!" /> </form>'; $result = mysql_query("SELECT * FROM blurry_settings"); while($row = mysql_fetch_array($result)) { include('styles/'.$row['SiteTheme'].'/footer.php'); } ?> Nu kāpēc met ārā to Erroru? Un ja kas, to es atcerēšos uz visiem laikiem! :) Edited August 22, 2010 by reGative Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 22, 2010 Report Share Posted August 22, 2010 (edited) Pagaidi, kura rindiņa ir tā #25?? =) Bet skrienu pāri visam... '<h2>'. LOGIN .'</h2>'; Kur ir echo() vai vismaz print()?! xD P.S. Un vēl te... '<form action="login.php?reason=login" method="post">' .NICK.'<input type="text" name="nick" /><br />' .PASSWORD.'<input type="password" name="pass" /><br /> <input type="submit" value="OK!" /> </form>'; Ai, pietam... xD Es domāju, ka dara šādi... echo "<tag id='x' />"; ...nevis... echo '<tag id="x" />'; Edited August 22, 2010 by daGrevis Quote Link to comment Share on other sites More sharing options...
101111 Posted August 22, 2010 Report Share Posted August 22, 2010 kas tas tāds? $get_id 'SELECT user_id FROM blurry_users'; Quote Link to comment Share on other sites More sharing options...
reGative Posted August 22, 2010 Author Report Share Posted August 22, 2010 101111, tas ir lietotāja ID izvilcējs. Quote Link to comment Share on other sites More sharing options...
101111 Posted August 22, 2010 Report Share Posted August 22, 2010 katrā ziņā man ir aizdomas ka tur pietrūkst vienādības zīme $get_id = 'SELECT user_id FROM blurry_users'; Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 22, 2010 Report Share Posted August 22, 2010 Man ar' tā nez kāpēc liekas... xD Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted August 22, 2010 Report Share Posted August 22, 2010 Ai, pietam... xD Es domāju, ka dara šādi... echo "<tag id='x' />"; ...nevis... echo '<tag id="x" />'; tieshi otrais varjants ir optimalaks, jo izvada validu HTML kodu (id vertiba ir Dubultpedinajs) Piedevam mazak noslogo PHP dalju, jo netik parbaudits vai starp izvadamajam vertibam nav kaads PHP mainigais ... Quote Link to comment Share on other sites More sharing options...
reGative Posted August 22, 2010 Author Report Share Posted August 22, 2010 Bet tagad ielogoties nevar, rāda to kļūdu LOGIN_ERROR (Neizdevās ielogoties....). Vai sintakse ir nepareiza? Quote Link to comment Share on other sites More sharing options...
101111 Posted August 22, 2010 Report Share Posted August 22, 2010 Ja tev sintakses errorus neizmeta, tad acīmredzot sintakse ir pareiza Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 22, 2010 Report Share Posted August 22, 2010 tieshi otrais varjants ir optimalaks, jo izvada validu HTML kodu (id vertiba ir Dubultpedinajs) Piedevam mazak noslogo PHP dalju, jo netik parbaudits vai starp izvadamajam vertibam nav kaads PHP mainigais ... Vai tad ' ir nepareizi? Validātors met kļūdas? O.o Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted August 22, 2010 Report Share Posted August 22, 2010 Vai tad ' ir nepareizi? Validātors met kļūdas? O.o validators protams ka nebljaustaas, bet ja njem dziljak tad XML standarta izmanto dubultpedinajs, attieciigi XHTML jadara tapat .. Quote Link to comment Share on other sites More sharing options...
reGative Posted August 24, 2010 Author Report Share Posted August 24, 2010 (edited) Sveiki! Lai nebūtu jātaisa jauns posts, ierakstīšu šeit! Tātad, man ir if(isSet($_SESSION['id'])) { echo 'Esi sveicināts'.$row['user_nick'].'!'; } . Bet kā lai izvelk šobrīd ielogojošos lietotāja niku un visus pārējos lietotāja datus? Edited August 24, 2010 by reGative Quote Link to comment Share on other sites More sharing options...
101111 Posted August 24, 2010 Report Share Posted August 24, 2010 (edited) if(isSet($_SESSION['id'])) { $q = 'SELECT * FROM blurry_users WHERE user_id ='. $_SESSION['id']; $arr = mysql_fetch_assoc(mysql_query($q)); print_r($arr); } Edited August 24, 2010 by 101111 Quote Link to comment Share on other sites More sharing options...
reGative Posted August 24, 2010 Author Report Share Posted August 24, 2010 (edited) Nē, man vajadzētu tā, lai attēlojas : Esi sveicināts, reGative! reGative vietā būs $row['user_nick']. Jo katram lietotājam būs savs niks. kr4 tā lai var salikt visur nepieciešamos datus (piem. $row['user_email']). Edited August 24, 2010 by reGative Quote Link to comment Share on other sites More sharing options...
101111 Posted August 24, 2010 Report Share Posted August 24, 2010 saliec html kodā kādus datus gribi. masīvā $row ir atrodama visa informācija par lietotāju Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.