Witam Wszystkich!Potrzebowałem skryptu który by po wpisaniu przez usera id i passów pobierał z bazy jego dane.
Próbowałem to zrobić za pomocą 2 plików, i chyba trochę bardzo to pogmatwałem
1 Plik
[wpisywanie loginu i passów przez użytkownika]
<?php include "header.php"; ?>
<div id="right">
<div id="middle"></div>
<div id="middle1">
<h2>
<?php echo "$NS"; ?> - Informacje o Koncie</h2>
<table>
<tr><td>
<form action="log2.php" method="post" id="login"> <span>
<font color="#A8031E" size="2"><b>Login</font>: </b><input name="userid" type="text" id="userid2" size="20" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"/>
</td></tr>
<tr><td>
<font color="#A8031E" size="2"><b>Hasło</font>: </b><input name="password" type="password" autocomplete="off" id="password2" size="20" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"/>
</td></tr>
<tr><td align="right">
<input type="submit" name="Submit" value="Zaloguj" class="button">
<input type="hidden" name="shop_login" value="login" />
</form>
</td></tr>
</table>
?>
</div>
<div id="middle2"></div>
</div>
<?php include "footer.php"; ?>
2 Plik
[pobieranie danych uzytownika z bazy na podstawie wpisanych danych]
<?php include "header.php"; ?>
<div id="right">
<div id="middle"></div>
<div id="middle1">
<h2>
<?php echo "$NS"; ?> - Informacje o Koncie</h2>
<table border="0" align="center">
<tr>
<th width="100"> E-mail </th>
<th width="100"> Imię </th>
<th width="100"> Kod usunięcia postaci </th>
<th width="100"> Telefon </th>
<th width="100"> Pytanie </th>
<th width="100"> Odpowiedz </th>
</tr>
</table>
<?php
include ('config.php');
select_db(account');
$nazwa= $_POST('user_id'); //pobranie nazwy z formularza
$ID= "SELECT email,real_name,social_id,phone1,question1,answer1 FROM account WHERE [login] = '$user_id'";
$numrows = mysql_num_rows($sql);
for($x=2; $x<$numrows+2; $x++){
$resrow = mysql_fetch_row($sql);
$e_mail = $resrow[0];
$imie = $resrow[1];
$kod_postaci = $resrow[2];
$telefon = $resrow[3];
$pytanie = $resrow[4];
$odpowiedz = $resrow[5];
echo "
<table border=\"0\" align=\"center\">
<tr>
<th width=\"100\"><p id='p'> $e_mail </p></th>
<th width=\"100\"><p id='p'> $imie </p></th>
<th width=\"100\"><p id='p'> $kod_postaci </p></th>
<th width=\"100\"><p id='p'> $telefon </p></th>
<th width=\"100\"><p id='p'> $pytanie </p></th>
<th width=\"100\"><p id='p'> $odpowiedz </p></th>
</tr>
</table>
";
}
?>
</div>
<div id="middle2"></div>
</div>
<?php include "footer.php"; ?>
Plik 1 działa chyba poprawnie, Plik 2 wyrzuca błąd;
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/jacekarw/domains/strona/public_html/test/log2.php on line 20
Bardzo proszę o pomoc. (IMG:
style_emoticons/default/worriedsmiley.gif)