08-25-2005
|
#1 (permalink)
|
|
Registered User
Join Date: Aug 2005
Location: Breda, Holland, Europe
Posts: 10
|
[PHP] shoutbox
Hi!
I'm quite new here, I read the tutorial on this site about the shoutbox.
i followed it till the admin page, I don't want that part yet. I just wanted to test if the firstpart woulld do it.
well, it doesn't.
it's quite a lot of code, so i don't know if it's alright if i post it here..
well here it is:
PHP Code:
<?php
session_start();
mysql_connect('...','....','.....' or die(mysql_error());
mysql_select_db('db') or die(mysql_error());
function getshouts()
{
$query= mysql_query('SELECT * from shoutbox_db ORDER BY id DESC LIMIT 10') or die(mysql_error());
while($row = mysql_fetch_array($query))
{
$name = stripslashes($row['name']);
$contact = stripslashes($row['contact']);
$text = stripslashes($row['text']);
if(empty($contact)){
echo $name ;
echo '<br>'. $text ;
}
else{
echo '<a href="'.$contact.'" target="_blank">';
echo $name .'</a>' ;
echo '<br>'. $text ;
} // else end
} // while end
echo '<p>';
echo '
<form name="shout" method="post" action="shout.php">
<input name="name" type="text" id="name" value="Name" size="25" maxlength="10"><br>
<input name="contact" type="text" id="contact" value="http://" size="25"><br>
<input name="text" type="text" id="message" value="Message" size="25"><br>
<input name="shout" type="submit" id="shout" value="Shout!">
</form>
';
} //function getshouts end
if( isset ($_POST[shout]))
{
$name = addslashes($_POST['name']);
$contact = addslashes($_POST['contact']);
$text = addslahes($_POST['text']);
if ( ( isset ( $name )) && ( isset ( $text ) ))
{
$smilies = mysql_query ( SELECT * FROM smilies ) or die(mysql_error());
while($get = mysql_fetch_array($smilies))
{
$alt = $get ['Alt'];
$smilie = $get ['URL'];
$text = str_replace( $get['Symbol'], '<img src="blender3d/smilies/'.$smilie'" class="smilies" alt="'.$alt'">', $text );
$themessage = addslashes($text);
}
mysql_query("INSERT INTO shouts (name,contact,text) VALUES ('$name','$contact','$text')") or die(mysql_error());
$_SESSION['has posted'] = yes;
header("Location: shout.php");
else{
echo 'some entry fields are empty, please fill them and shout again.';
header("Location: shout.php");
}
}
?>
but when i put it on line i get a white page, and when i check the source code (not that i would see any php code, that's not where i did it for) i see this:
<html><body></body></html>
while above the php code it has all kinds of code like a title and meta tags.
but it just shows it like it's an empty page..
What do i do wrong 
Last edited by Yao; 08-25-2005 at 12:46 PM.
|
|
|
08-25-2005
|
#2 (permalink)
|
|
Invicible Snake
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668
|
1 file can not say anything,try to work form the beginning to the end ,make sure you understand what you are doing before asking,so that the answer you receive will be ur experiment
(The most important here is i`m too lazy to read those codes lmao  )
__________________
|
|
|
08-25-2005
|
#3 (permalink)
|
|
Registered User
Join Date: Aug 2005
Location: Breda, Holland, Europe
Posts: 10
|
it's not like i don't know what i'm doing  .. i understand what i'm doing.. but it's quite odd that the form is not showing.
and it should work like this, without the admin page.. but i don't know what kind of a fault i made.
|
|
|
08-25-2005
|
#4 (permalink)
|
|
Recursively call who?
Join Date: Nov 2003
Location: Pittsburgh, PA
Posts: 294
|
It may be a stupid question, but are you sure the webhost you are using supports PHP?
|
|
|
08-25-2005
|
#5 (permalink)
|
|
Registered User
Join Date: Aug 2005
Location: Breda, Holland, Europe
Posts: 10
|
i'm very sure 
|
|
|
08-25-2005
|
#6 (permalink)
|
|
Sheep Worrier
Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,073
|
Hmmm. You might have PHP error display turned off. If that is the case then you'll just get a blank screen instead of a description of the error. I'm not a PHP expert myself, but if you turn error display on, then at least you'll get some idea of where the problem in your script is located...
__________________
|
|
|
08-25-2005
|
#7 (permalink)
|
|
Registered User
Join Date: Aug 2005
Location: Breda, Holland, Europe
Posts: 10
|
well.. normally seen it gives the errors.. but now it doesn't..
i checked all the settings, but couldn't even found something which has a relation with PHP.
|
|
|
08-26-2005
|
#8 (permalink)
|
|
code anyone?
Join Date: Feb 2004
Location: New Zealand
Posts: 590
|
sorry i haven't replied to your email, been very busy.
i've had this problem a few times myself (on different scripts) and i can't remember exactly what the problem with it is, but i have a feeling it is something to do with error reporting level and/or the php server settings. hope that helps..
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
PHP Shoutbox
|
GoldNetX |
HTML / PHP / ASP / JS |
6 |
06-29-2004 09:14 PM |
All times are GMT +1. The time now is 08:20 AM. Content Relevant URLs by vBSEO 3.2.0
|