|
|||
Shoutbox
Hi, i got 1 problem.This is my shoutbox script
---------------------------------------- <?php include ("include/config.php"); ?> <style type="text/css"> body,textarea,input,h2 {font-size: 8pt; font-family: arial;} h1 {font-size: 10pt; font-family: arial; color: #00000; } </style> <?php $connect = mysql_connect("$dbhost","$dbuser","$dbpass") or die(mysql_error()); mysql_select_db("$dbname", $connect) or die(mysql_error()); function filter($text) { $replace=array(' '=>' <img src="smiles/smile.gif">',' '=>' <img src="smiles/sad.gif">',' '=>' <img src="smiles/biggrin.gif">',' '=>' <img src="smiles/tongue.gif">',' '=>' <img src="smiles/wink.gif">','\''=>'',';'=>'','--'=>''); foreach($replace as $old=>$new) $text = str_replace($old,$new,$text); return $text ; } if(isset($_POST['submit'])) { //$result = mysql_query("select max(`time`), max(`banned`) from `shout` where `ip` = '".$_SERVER['REMOTE_ADDR']."'"); //$result = mysql_fetch_array($result); $name = filter(wordwrap(htmlentities($_POST['name']),25,'<br />',1)); $message = filter( substr( wordwrap( nl2br( htmlentities($_POST['message'])),32,'<br />',1),0,250)); if (((time() - $result[0]) > 30) && ($result[1]!=1)) mysql_query("insert into shout(`name`,`time`,`message`,`ip`) values('$name','".time()."','$message','".$_SERVER['REMOTE_ADDR']."')"); else echo "<div style=\"background-color:#99CCFF;\"><h2>Slow down dude!</h2 ></div>"; } $resultSet = mysql_query("select `name`, `time`, `message` from `shout` order by `time` desc limit 5"); while ($record = mysql_fetch_assoc($resultSet)) echo "<div><br>".$record['name']."<br>\n".$record['message']."<br>\n".date("h:i:s A",$record['time']). "</div>" ; mysql_close(); ?> ---------------------------------------------------- masalahnya sekarang, saya includekan shoutbox.php ni dlm index.php tapi, lepas saya submit shout, browser akan buka shoutbox.php dan bukan index.php mcm mana saya nak buat supaya lepas user shout, browser akan buka index.php bukan, shoutbox.php tq |
|
||||
above doesn't give us any clue. what's the form action like inside index.php? and what's inside config.php
__________________
LOWEST PRICE Domain Name Promo: http://www.HiveHost.net/domains |
|
|||
this is config.php
<?php $dbhost = "localhost"; $dbuser = "root"; $dbpass = "password"; $dbname = "project"; ?> ----------------------------- this is index.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body leftmargin="0" rightmargin="0"> <table width="100%" border="0"> <tr> <td colspan="2"> </td> </tr> <tr> <td> </td> <td width="20%" rowspan="2"> <?php include ('shoutbox.php'); ?> <form action="shoutbox.php" method="post" name="shout" target="_parent"> <input name="name" type="text" value="" size="23" maxlength="20"><br/> <input name="message" type="text" value="" size="23" maxlength="100"> <input name="submit" type="submit" value="submit"> <br/> </form> </tr> <tr> <td> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </body> </html> |
|
||||
it will open shoutbox.php because your form action is shutbox.php
<form action="shoutbox.php" method="post" name="shout" target="_parent"> but that's how it's suppose to work. form action must be submitted to shoutbox.php, i guess you need to use iframe in this case. any live demo for us to see? i have an odd feeling why even a simple shoutbox needs to be so complicated with database try www.onlyphp.com/onlyshout.php, i like this one. easy to customize and uses .txt file instead of database.
__________________
LOWEST PRICE Domain Name Promo: http://www.HiveHost.net/domains |
|
|||
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shoutbox n Web Counter | alfirus | Websites Review and Suggestion | 1 | 26-08-2006 03:19 AM |
| shoutbox | jepp | Website Programming | 2 | 29-01-2005 09:26 PM |
| Buat ShoutBox Guna Flash Ver 6 | ripcode | Website Design | 22 | 14-10-2004 05:02 PM |
| Recommended Shoutbox? | lcf | Website Programming | 14 | 23-06-2004 03:07 PM |
| installing php shoutbox | sunshinerocke | Website Programming | 5 | 18-09-2003 08:10 AM |
All times are GMT +8. The time now is 06:26 AM.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.




'=>' <img src="smiles/smile.gif">','
'=>' <img src="smiles/sad.gif">','
'=>' <img src="smiles/biggrin.gif">','
'=>' <img src="smiles/tongue.gif">','
'=>' <img src="smiles/wink.gif">','\''=>'',';'=>'','--'=>''); 







Linear Mode

