Jump to content
php.lv forumi

Errors


reGative

Recommended Posts

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 by reGative
Link to comment
Share on other sites

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 by daGrevis
Link to comment
Share on other sites

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 ...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by reGative
Link to comment
Share on other sites

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 by reGative
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...