Ahojte tak opat potrebujem poradit.... Mam stranku pokec.inc tu je kod
Kód:
<div class="center">
<div class="center_inner">Pokec</div>
<p></p>
<script src="../javascript.js" type="text/javascript"></script>
<form id="prispevok" action="sprac_pokec.php" method="POST">
Tvoja správa:<br />
<center>
<textarea id="obsah" name="text" wrap="off" cols="40" rows="8"></textarea><br /><br />
<p>
<a href="javascript:add('[blink]')" title="Blink"><img src="../obr/smiles/blink.gif" title="Žmurknutie" /></a>
<a href="javascript:add('[dance]')" title="Dance"><img src="../obr/smiles/dance.gif" title="Tanec" /></a>
<a href="javascript:add('[friends]')" title="Friends"><img src="../obr/smiles/friends.gif" title="Priatelia" /></a>
<a href="javascript:add('[hello]')" title="Hello"><img src="../obr/smiles/hello.gif" title="Ahoj" /></a>
<a href="javascript:add('[hockey_0]')" title="Hockey_0"><img src="../obr/smiles/hockey_0.gif" title="Hráč" /></a>
<a href="javascript:add('[hockey_1]')" title="Hockey_1"><img src="../obr/smiles/hockey_1.gif" title="Hráč" /></a>
<a href="javascript:add('[hockey_2]')" title="Hockey_2"><img src="../obr/smiles/hockey_2.gif" title="Hráč" /></a>
<a href="javascript:add('[hockey_3]')" title="Hockey_3"><img src="../obr/smiles/hockey_3.gif" title="Hráč" /></a>
<a href="javascript:add('[hockey_4]')" title="Hockey_4"><img src="../obr/smiles/hockey_4.gif" title="Hráč" /></a><br />
<a href="javascript:add('[hockey_5]')" title="Hockey_5"><img src="../obr/smiles/hockey_5.gif" title="Hráč" /></a>
<a href="javascript:add('[hockey_6]')" title="Hockey_6"><img src="../obr/smiles/hockey_6.gif" title="Hráč" /></a>
<a href="javascript:add('[hockey_7]')" title="Hockey_7"><img src="../obr/smiles/hockey_7.gif" title="Hráč" /></a>
<a href="javascript:add('[incite]')" title="Incite"><img src="../obr/smiles/incite.gif" title="Povzbudzovanie" /></a>
<a href="javascript:add('[peace]')" title="Peace"><img src="../obr/smiles/peace.gif" title="Mier" /></a>
<a href="javascript:add('[winner]')" title="Winner"><img src="../obr/smiles/winner.gif" title="Víťaz" /></a>
</p>
<br />
<input type="hidden" value="" name="sent" />
<input type="submit" name="send" value="Poslať" />
<br />
</center>
</form>
<br />
<br />
<center>
<?php
require "db.php";
$vysledok = mysql_query("SELECT * FROM Diskusia") or die("Nepodarilo sa spojiť s databázou.");
$mes_all = mysql_num_rows($vysledok);
if ($_GET['messages_page']<>1)
{
$page_num = 1;
}
$limit_page = 8;
$all_pages = $mes_all;
$page_num_all = ceil($all_pages/$limit_page);
$start_page = ($page_num*$limit_page)-$limit_page;
for ($i=1; $i<=$page_num_all; $i++){
if ($i<>$page_num){
echo "<a href='index_prihlaseny.php?id=pokec&messages_page=1&page_num=".$i."' class='menu_after'>".$i."</a> | ";
}else{echo "<font color='#98c6e8'>".$i."</font> | ";}
}
$query = "SELECT * FROM Diskusia ORDER BY datum desc LIMIT $start_page , $limit_page ";
$result = mysql_query($query) or die ("Nepodarilo sa spojiť s databázou.");
$num=mysql_num_rows($result);
while ($row=mysql_fetch_array($result))
{
echo "</center><br />-----------------------------------------------------------------------------------------------------<br />";
echo "<span class='message'>Autor: ".$row['meno'].", Dátum: ".$row['datum']."</span>";
echo "<br />-----------------------------------------------------------------------------------------------------<br />";
echo stripslashes($row['sprava'])."<br /><br />";
}
mysql_free_result($result);
?>
</div>
a stranku sprac_pokec.php
Kód:
<?php
function changeSmile($text)
{
$nameSmile = array('[blink]','[dance]','[friends]','[hello]','[hockey_0]','[hockey_1]','[hockey_2]','[hockey_3]','[hockey_4]','[hockey_5]','[hockey_6]','[hockey_7]','[incite]','[peace]','[winner]',);
$urlsmile = array('<img src="../obr/smiles/blink.gif" title="Žmurknutie" />','<img src="../obr/smiles/dance.gif" title="Tanec" />','<img src="../obr/smiles/friends.gif" title="Priatelia" />','<img src="../obr/smiles/hello.gif" title="Ahoj" />','<img src="../obr/smiles/hockey_0.gif" title="Hráč" />','<img src="../obr/smiles/hockey_1.gif" title="Hráč" />','<img src="../obr/smiles/hockey_2.gif" title="Hráč" />','<img src="../obr/smiles/hockey_3.gif" title="Hráč" />','<img src="../obr/smiles/hockey_4.gif" title="Hráč" />','<img src="../obr/smiles/hockey_5.gif" title="Hráč" />','<img src="../obr/smiles/hockey_6.gif" title="Hráč" />','<img src="../obr/smiles/hockey_7.gif" title="Hráč" />','<img src="../obr/smiles/incite.gif" title="Povzbudzovanie" />','<img src="../obr/smiles/peace.gif" title="Mier" />','<img src="../obr/smiles/winner.gif" title="Víťaz" />');
return str_replace($nameSmile, $urlsmile, $text);
}
if (isset($_POST['sent'])){
$text = changeSmile(addslashes($_POST['text']));
if ($text==""){echo "Nepodarilo sa odoslať.";
}else{
require_once "db.php";
$query = "INSERT INTO Diskusia (meno,sprava) VALUES ('".$_SESSION['login']."','".$text."')";
$datab = mysql_query($query) or die (mysql_error());
mysql_free_result($datab);
}
}else{}
header("Location: index_prihlaseny.php?id=pokec");
?>
A mam takyto problem na stranke pokec.inc je len formular na spravu cize tam autor nemusi zadavat meno lebo to by sa malo zapisat zo Session ked je prihlaseny ale ked dam zapisat Session autora v sprac_pokec.php tak my do databazi nic nezapise. Ked vsak dam napr v subore pokec.inc echo $_SESSION['login'] tak mi vypise pekne meno uzivatela.... Takze v skratke moj problem je ze ako vlastne mam dostat to session aj do sprac_pokec.php lebo mne sa zda ze sa neprenesia tak ako by som ho mohol tam preniest? Vopred dakujem za radu