<? { // Skrypt sprawdzajacy prawdziwosc danych podczas logowania $user = $HTTP_POST_VARS['user']; $pass = $HTTP_POST_VARS['pass']; $zapytanie = 'select * from admins ' ."where user='$user' " ." and pass='$pass'"; { // Jezeli dane sa prawdziwe nastepuje zarejestrowanie identyfikatora usera $HTTP_SESSION_VARS['prawid_uzyt'] = $user; } } ?> <html> <head> <title>Portal Newsowy - v 1.0.</title> <link rel="stylesheet" href="style.css" type="text/css" /> <META name="keywords" content="Skrypt, BalonNews, Balon, News"> <META name="description" content="Skrypt, BalonNews, Balon, News"> <META name="author" content="Krzysztof Jagiello"> </head> <body> <table border="0" height="25" width="600" align="center" cellpadding="0" cellspacing="0"> <tr><td width="100%" height="100%"></td></tr> <table border="0" height="50" width="600" align="center" cellpadding="0" cellspacing="0"> <tr><td width="100%" height="100%"></td></tr> </table> <? // sprawdzanie istnienia sesji { // includowanie podstron if($co=="main") { include "inc/main.php"; } elseif($co=="add") { include "inc/add.php"; } elseif($co=="edit") { include "inc/edit.php"; } else { include "inc/main.php"; } //dalsza czesc uwierzytelniania } else { { // jezeli proba logowania nie powiodla sie echo '<tr><td bgcolor=505050 width=100% height=25 class=news valign="middle"><b>Panel Admina - NewsCenter</b></td></tr>'; } else { // Albo nastapilo wylogowanie albo nie bylo wogole proby logowania sie echo '<tr><td bgcolor=505050 width=100% height=25 class=news valign="middle"><b>Panel Admina - NewsCenter</b></td></tr>'; } // tworzenie formularza logowania echo '<tr><td bgcolor=505050 width=100% height=25 class=news valign="middle"><b>Panel Admina - NewsCenter</b></td></tr>'; echo '<tr><td>Login</td><td><input type="text" name="user" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"></td></tr>'; echo '<tr><td>Haslo</td><td><input type="text" name="pass" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"></td></tr>'; echo '<tr><td></td><td><input type="submit" value="Loguj" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"></td></tr>'; echo '<table border="0" width="600" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="news"> </td> </tr> </table> </table> </td></tr> </table><br>'; } ?> </body>
add.php
<tr><td bgcolor=3e3e3e width=100% class=news> <? $adm = $HTTP_SESSION_VARS['prawid_uzyt']; $title=$HTTP_POST_VARS['title']; $autor=$HTTP_POST_VARS['autor']; $tresc=$HTTP_POST_VARS['tresc']; if (!$title || !$autor || !$tresc) { } $zapytanie = "INSERT INTO `newsy` ( `id` , `title` , `autor` , `tresc` ) VALUES ('', '$title', '$autor', '$tresc');"; if ($wynik) { exit; } } ?> {?> <form action="index.php?co=add" method="post"> <table border="0" align="center" class="news"> <tr> <td>Tytul:</td> <td><input type="text" name="title" size="15" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"></td> </tr> <tr> <td>Tresc:</td><td><TEXTAREA name="tresc" rows="8" cols="70" wrap="virtual" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"></TEXTAREA><BR></td></tr> <tr> <td><input type="reset" value="Resetuj" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"></td> <td><input type="submit" value="Dodaj" style="font-family:verdana, tahoma, sans-serif; font-size:11px; color:#000066; border: 1px solid #000066"><input name="autor" value="<? $HTTP_SESSION_VARS['prawid_uzyt'] ?>" type="hidden"></td> </tr> </table> </form> <? } ?> </td></tr> </table><br>
I chce zeby do value
Kod
<input name="autor" value="<? $HTTP_SESSION_VARS['prawid_uzyt'] ?>" type="hidden">
zostal wrzucony identyfikator sesji ktorym jest nazwa usera... tylko ze nie dzieje sie tak jak bym chcial i value jest puste... prosze o pomoc...