neviete preco mi nejdu smajlovia..? .
mozno bude problem v tom ze som kod bude prepisal do zlej casti kodu alebo som nieco zle prepisal... totiz kod zo smajlikmi som prepisoval z jedneho skriptu... diky za kazdu pomoc...
---------------------------------------------
guestbook.php
---------------------------------------------
<?php
$titul = '...:::Guestbook!:::...';
include('sablony/head.inc');
include('sablony/menu.inc');
include('sablony/replacesmileys.php');
require "mysql_spojit.php";
if ($send && $text != ""):
$text = HTMLSpecialChars($text);
$text = nl2br($text);
$cas = date("d-m-Y H:i:s");
?>
<script type="text/javascript">
function Smile(what)
{
document.forms.comment.text.focus();
document.forms.comment.text.value=document.forms.comment.text.value+what;
}
</script>
<?php
@$f = mysql_query ("INSERT INTO guestbook VALUES('','$meno_pr','$nazov','$text','$cas')");
endif;
?>
<div align="center"><center>
<h1>Guestbook</h1>
<table border="0" width="570">
<tr>
<td><div align="center"><center>
<table border="0">
<form name="comment" action="guestbook.php" method="post">
<input type="hidden" name="send" value="true">
<tr>
<td bgcolor="#c8c8c8"><strong>Nick:</strong></font></td>
<td bgcolor="#000000"><strong><input type="meno_pr" size="20" name="meno_pr"></strong></font></td>
</tr>
<tr>
<td bgcolor="#c8c8c8"><strong>Názov:</strong></font></td>
<td bgcolor="#000000"><strong><input type="nazov" size="40" name="nazov"></strong></font></td>
</tr>
<tr>
<td bgcolor="#c8c8c8"><strong>Text:</strong></font></td>
<td bgcolor="#000000"><strong><textarea name="text" rows="3" cols="45"></textarea></strong></font></td>
</tr>
<tr>
<td colspan="2" bgcolor="#c8c8c8">
<img onclick="Smile(':-D ')" src="smileys/1.gif" width="15" height="15" align="middle">
<img onclick="Smile(':oD ')" src="smileys/15.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-)) ')" src="smileys/2.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-) ')" src="smileys/3.gif" width="15" height="15" align="middle">
<img onclick="Smile(';-) ')" src="smileys/4.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-P ')" src="smileys/5.gif" width="15" height="15" align="middle">
<img onclick="Smile(':oP ')" src="smileys/16.gif" width="15" height="15" align="middle">
<img onclick="Smile('%-) ')" src="smileys/17.gif" width="16" height="16" align="middle">
<img onclick="Smile(':-| ')" src="smileys/6.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-/ ')" src="smileys/7.gif" width="15" height="15" align="middle">
<img onclick="Smile(':( ')" src="smileys/8.gif" width="15" height="15" align="middle">
<img onclick="Smile('X[] ')" src="smileys/12.gif" width="15" height="15" align="middle">
<img onclick="Smile(':´-( ')" src="smileys/9.gif" width="15" height="15" align="middle">
<img onclick="Smile(':´o( ')" src="smileys/19.gif" width="21" height="16" align="middle">
<img onclick="Smile(':-O ')" src="smileys/10.gif" width="15" height="15" align="middle">
<img onclick="Smile('B-] ')" src="smileys/11.gif" width="21" height="15" align="middle">
<img onclick="Smile(':_) ')" src="smileys/13.gif" width="50" height="15" align="middle">
<img onclick="Smile(':-! ')" src="smileys/18.gif" width="22" height="19" align="middle">
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#c8c8c8"><center><input type="submit" value="Odoslať -->"></center></td></form>
</tr>
</table>
</center></div></td>
</tr>
</table>
<hr size="3" noshade width="600">
</center>
</div>
<?php
$query="select * from guestbook order by id_pr";
$result=mysql_query($query, $dbc) or die ("spojenie s databázou bolo neúspešné");
$num=mysql_num_rows($result);
//$ctrl je pomocná premenná
if ($ctrl1<>1)
{
$strana=1;
}//endif
$limit=10;
$celkovy_pocet=$num;
$pocet_stran=ceil($celkovy_pocet/$limit);
$pociatok=($strana*$limit)-$limit;
echo "<div align=center>";
for ($i=1; $i<=$pocet_stran; $i++)
{
if ($i<>$strana)
{
echo "<a href=\"guestbook.php?ctrl=1&strana=",$i,"\">",$i,"</a> | ";
}
else
{
echo "<font color=\"#ff0000\">",$i,"</font> | ";
}//endif
}//endfor
if ($strana<>$pocet_stran)
{
echo "<a href=\"guestbook.php?ctrl=1&strana=",$strana+1,"\">nasledujúca strana</a>";
}//endif
echo "</div></p>";
//výpis danej množiny prvkov
$query="select * from guestbook order by id_pr desc limit $pociatok, $limit";
$result=mysql_query($query, $dbc) or die ("spojenie s databázou bolo neúspešné");
$num=mysql_num_rows($result);
$row["text"] = replace_smile($row["text"]);
while ($row=mysql_fetch_array($result))
{
echo "<div align=center><center><table border=0 width=600>";
echo "<tr><td bgcolor=#000000 width=200 height=18><strong>";
echo "<font color=\"white\">",$row["meno_pr"],"</font></td><td bgcolor=#000000 width=200 height=18>";
echo "</strong><font color=white>",$row["nazov"],"</font></td><td bgcolor=#000000 width=200 height=18><p align=center><font color=white>",$row["cas"],"</font></p></td></tr><tr><td bgcolor=#C8C8C8 colspan=3><strong>",$row["text"],"</strong></td></tr><tr><td height=18 colspan=2></td></tr>";
echo "</table>\n
";
}//end while
mysql_free_result($result);
?>
<?
include('sablony/bottom.inc');
?>
-----------------------------------------------
replacesmileys.php
-------------------------------------------------
<?php
$replace = array();
$replace[':-D']='<img src="smileys/1.gif">';
$replace[':oD']='<img src="smileys/15.gif">';
$replace[':-))']='<img src="smileys/2.gif">';
$replace[':))']='<img src="smileys/2.gif">';
$replace[':)))']='<img src="smileys/2.gif">';
$replace[':-)))']='<img src="smileys/2.gif">';
$replace[':)']='<img src="smileys/3.gif">';
$replace[':-)']='<img src="smileys/3.gif">';
$replace[':o)']='<img src="smileys/3.gif">';
$replace[';-)']='<img src="smileys/4.gif">';
$replace[':-P']='<img src="smileys/5.gif">';
$replace[':oP']='<img src="smileys/16.gif">';
$replace[':-|']='<img src="smileys/6.gif">';
$replace[':-/']='<img src="smileys/7.gif">';
$replace[':-(']='<img src="smileys/8.gif">';
$replace[':´-(']='<img src="smileys/9.gif">';
$replace[':´o(']='<img src="smileys/19.gif">';
$replace[':-O']='<img src="smileys/10.gif">';
$replace['B-]']='<img src="smileys/11.gif">';
$replace['X[]']='<img src="smileys/12.gif">';
$replace[':_)']='<img src="smileys/13.gif">';
$replace['%-)']='<img src="smileys/17.gif">';
$replace[':-!']='<img src="smileys/18.gif">';
$replace[':~O']='<img src="smileys/20.gif">';
function replace_smile ($text)
{
global $replace;
reset($replace);
while(list($key,$val) = each($replace))
$text = str_replace($key,$val,$text);
return $text;
}
?>
no takže už mi skoro idú.. ale neviem kam mám vložiť toto:
$trans = array (
"<" => "<",
">" => ">",
":-D" => "<img src=\"smileys/1.gif\" alt=\"smile\">",
":-))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":)))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":-)))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":)" => "<img src=\"smileys/3.gif\" alt=\"smile\">",
":-)" => "<img src=\"smileys/3.gif\" alt=\"smile\">",
":o)" => "<img src=\"smileys/3.gif\" alt=\"smile\">",
";-)" => "<img src=\"smileys/4.gif\" alt=\"smile\">",
":-P" => "<img src=\"smileys/5.gif\" alt=\"smile\">",
":-|" => "<img src=\"smileys/6.gif\" alt=\"smile\">",
":-/" => "<img src=\"smileys/7.gif\" alt=\"smile\">",
":-(" => "<img src=\"smileys/8.gif\" alt=\"smile\">",
":´-(" => "<img src=\"smileys/9.gif\" alt=\"smile\">",
":-O" => "<img src=\"smileys/10.gif\" alt=\"smile\">",
"B-]" => "<img src=\"smileys/11.gif\" alt=\"smile\">",
"X[]" => "<img src=\"smileys/12.gif\" alt=\"smile\">",
":_)" => "<img src=\"smileys/13.gif\" alt=\"smile\">",
":oD" => "<img src=\"smileys/15.gif\" alt=\"smile\">",
":oP" => "<img src=\"smileys/16.gif\" alt=\"smile\">",
"%-)" => "<img src=\"smileys/17.gif\" alt=\"smile\">",
":-!" => "<img src=\"smileys/18.gif\" alt=\"smile\">",
":´o(" => "<img src=\"smileys/19.gif\" alt=\"smile\">",
":~O" => "<img src=\"smileys/20.gif\" alt=\"smile\">"
);
$_POST['text'] = strtr($_POST['text'], $trans);
$_POST['meno_pr'] = strtr($_POST['meno_pr'], $trans);
$_POST['nazov'] = strtr($_POST['nazov'], $trans);
-----------------------------------------------------------------------------
guestbook.php
------------------------------------------------------------------------------
<?php
$titul = '...:::Guestbook!:::...';
include('sablony/head.inc');
include('sablony/menu.inc');
include('sablony/replacesmileys.php');
require "mysql_spojit.php";
if ($send && $text != ""):
$text = HTMLSpecialChars($text);
$text = nl2br($text);
$cas = date("d-m-Y H:i:s");
$trans = array (
"<" => "<",
">" => ">",
":-D" => "<img src=\"smileys/1.gif\" alt=\"smile\">",
":-))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":)))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":-)))" => "<img src=\"smileys/2.gif\" alt=\"smile\">",
":)" => "<img src=\"smileys/3.gif\" alt=\"smile\">",
":-)" => "<img src=\"smileys/3.gif\" alt=\"smile\">",
":o)" => "<img src=\"smileys/3.gif\" alt=\"smile\">",
";-)" => "<img src=\"smileys/4.gif\" alt=\"smile\">",
":-P" => "<img src=\"smileys/5.gif\" alt=\"smile\">",
":-|" => "<img src=\"smileys/6.gif\" alt=\"smile\">",
":-/" => "<img src=\"smileys/7.gif\" alt=\"smile\">",
":-(" => "<img src=\"smileys/8.gif\" alt=\"smile\">",
":´-(" => "<img src=\"smileys/9.gif\" alt=\"smile\">",
":-O" => "<img src=\"smileys/10.gif\" alt=\"smile\">",
"B-]" => "<img src=\"smileys/11.gif\" alt=\"smile\">",
"X[]" => "<img src=\"smileys/12.gif\" alt=\"smile\">",
":_)" => "<img src=\"smileys/13.gif\" alt=\"smile\">",
":oD" => "<img src=\"smileys/15.gif\" alt=\"smile\">",
":oP" => "<img src=\"smileys/16.gif\" alt=\"smile\">",
"%-)" => "<img src=\"smileys/17.gif\" alt=\"smile\">",
":-!" => "<img src=\"smileys/18.gif\" alt=\"smile\">",
":´o(" => "<img src=\"smileys/19.gif\" alt=\"smile\">",
":~O" => "<img src=\"smileys/20.gif\" alt=\"smile\">"
);
$_POST['text'] = strtr($_POST['text'], $trans);
$_POST['meno_pr'] = strtr($_POST['meno_pr'], $trans);
$_POST['nazov'] = strtr($_POST['nazov'], $trans);
@$f = mysql_query ("INSERT INTO guestbook VALUES('','$meno_pr','$nazov','$text','$cas')");
endif;
?>
<script type="text/javascript">
function Smile(addsmile) {
document.comment.text.value += (addsmile);
}
</script>
<div align="center"><center>
<h1>Guestbook</h1>
<table border="0" width="570">
<tr>
<td><div align="center"><center>
<table border="0">
<form name="comment" action="guestbook.php" method="post">
<input type="hidden" name="send" value="true">
<tr>
<td bgcolor="#c8c8c8"><strong>Nick:</strong></font></td>
<td bgcolor="#000000"><strong><input type="meno_pr" size="20" name="meno_pr"></strong></font></td>
</tr>
<tr>
<td bgcolor="#c8c8c8"><strong>Názov:</strong></font></td>
<td bgcolor="#000000"><strong><input type="nazov" size="40" name="nazov"></strong></font></td>
</tr>
<tr>
<td bgcolor="#c8c8c8"><strong>Text:</strong></font></td>
<td bgcolor="#000000"><strong><textarea name="text" rows="3" cols="45"></textarea></strong></font></td>
</tr>
<tr>
<td colspan="2" bgcolor="#c8c8c8">
<img onclick="Smile(':-D ')" src="smileys/1.gif" width="15" height="15" align="middle">
<img onclick="Smile(':oD ')" src="smileys/15.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-)) ')" src="smileys/2.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-) ')" src="smileys/3.gif" width="15" height="15" align="middle">
<img onclick="Smile(';-) ')" src="smileys/4.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-P ')" src="smileys/5.gif" width="15" height="15" align="middle">
<img onclick="Smile(':oP ')" src="smileys/16.gif" width="15" height="15" align="middle">
<img onclick="Smile('%-) ')" src="smileys/17.gif" width="16" height="16" align="middle">
<img onclick="Smile(':-| ')" src="smileys/6.gif" width="15" height="15" align="middle">
<img onclick="Smile(':-/ ')" src="smileys/7.gif" width="15" height="15" align="middle">
<img onclick="Smile(':( ')" src="smileys/8.gif" width="15" height="15" align="middle">
<img onclick="Smile('X[] ')" src="smileys/12.gif" width="15" height="15" align="middle">
<img onclick="Smile(':´-( ')" src="smileys/9.gif" width="15" height="15" align="middle">
<img onclick="Smile(':´o( ')" src="smileys/19.gif" width="21" height="16" align="middle">
<img onclick="Smile(':-O ')" src="smileys/10.gif" width="15" height="15" align="middle">
<img onclick="Smile('B-] ')" src="smileys/11.gif" width="21" height="15" align="middle">
<img onclick="Smile(':_) ')" src="smileys/13.gif" width="50" height="15" align="middle">
<img onclick="Smile(':-! ')" src="smileys/18.gif" width="22" height="19" align="middle">
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#c8c8c8"><center><input type="submit" value="Odoslať -->"></center></td></form>
</tr>
</table>
</center></div></td>
</tr>
</table>
<hr size="3" noshade width="600">
</center>
</div>
<?php
$query="select * from guestbook order by id_pr";
$result=mysql_query($query, $dbc) or die ("spojenie s databázou bolo neúspešné");
$num=mysql_num_rows($result);
//$ctrl je pomocná premenná
if ($ctrl1<>1)
{
$strana=1;
}//endif
$limit=10;
$celkovy_pocet=$num;
$pocet_stran=ceil($celkovy_pocet/$limit);
$pociatok=($strana*$limit)-$limit;
echo "<div align=center>";
for ($i=1; $i<=$pocet_stran; $i++)
{
if ($i<>$strana)
{
echo "<a href=\"guestbook.php?ctrl=1&strana=",$i,"\">",$i,"</a> | ";
}
else
{
echo "<font color=\"#ff0000\">",$i,"</font> | ";
}//endif
}//endfor
if ($strana<>$pocet_stran)
{
echo "<a href=\"guestbook.php?ctrl=1&strana=",$strana+1,"\">nasledujúca strana</a>";
}//endif
echo "</div></p>";
//výpis danej množiny prvkov
$query="select * from guestbook order by id_pr desc limit $pociatok, $limit";
$result=mysql_query($query, $dbc) or die ("spojenie s databázou bolo neúspešné");
$num=mysql_num_rows($result);
$row["text"] = replace_smile($row["text"]);
while ($row=mysql_fetch_array($result))
{
echo "<div align=center><center><table border=0 width=600>";
echo "<tr><td bgcolor=#000000 width=200 height=18><strong>";
echo "<font color=\"white\">",$row["meno_pr"],"</font></td><td bgcolor=#000000 width=200 height=18>";
echo "</strong><font color=white>",$row["nazov"],"</font></td><td bgcolor=#000000 width=200 height=18><p align=center><font color=white>",$row["cas"],"</font></p></td></tr><tr><td bgcolor=#C8C8C8 colspan=3><strong>",$row["text"],"</strong></td></tr><tr><td height=18 colspan=2></td></tr>";
echo "</table>\n
";
}//end while
mysql_free_result($result);
?>
<?
include('sablony/bottom.inc');
?>
-------------------------------------------------------------------------------------
a dalsi problem je strankovanie.... Marcus Flintus mi povedal ze chyba je v premennej $pociatok..... ale nechce mi povedat kde :D
tak to trochu skratim :
$query=("SELECT * FROM guestbook ORDER BY id_pr");
$result=mysql_query
($query, $dbc) or die ("spojenie s databázou bolo neúspešné");
$num=mysql_num_rows($result);
//$ctrl je pomocná premenná
if ($ctrl1<>1)
{
$strana=1;
}//endif
$limit=10;
$celkovy_pocet=$num;
$pocet_stran=ceil($celkovy_pocet/$limit);
$pociatok=($strana*$limit)-$limit;
echo "<div align=center>";
for ($i=1; $i<=$pocet_stran; $i++)
{
if ($i<>$strana)
{
echo "<a href=\"guestbook.php?ctrl=1&strana=",$i,"\">",$i,"</a> | ";
}
else
{
echo "<font color=\"#ff0000\">",$i,"</font> | ";
}//endif
}//endfor
if ($strana<>$pocet_stran)
{
echo "<a href=\"guestbook.php?ctrl=1&strana=",$strana+1,"\">nasledujúca strana</a>";
}//endif
echo "</div></p>";
//výpis danej množiny prvkov
$query=("SELECT * FROM guestbook ORDER BY id_pr DESC LIMIT $pociatok, $limit");
$result=mysql_query($query, $dbc) or die ("spojenie s databázou bolo neúspešné");
$num=mysql_num_rows($result);
$row["text"] = replace_smile($row["text"]);
while ($row=mysql_fetch_array($result))
---------------------------------------------------------------------------------
marcus Flintus mi povedal ze chyba je v $pociatok.... ze vzdy to vrati hodnotu 0 ... ale neviem ako to spravit aby to islo :P