Jump to content

ShoutBox Editing Help!!


FortMyersDrew

Recommended Posts

Shout.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<style type="text/css">
<!--
.shout{
padding-bottom:4px;
border-bottom:1px solid #000;
width:180px;
text-align:left;
font-family:Arial
font-size:11px;
background-color:#262727
font-color:$FF0000
}
-->
</style>
<title>Shoutbox</title>
</head>
<body>
<?php
include('config.php');
$result = mysql_query("select * from shoutbox order by id desc limit 5");

//the while loop
while($r=mysql_fetch_array($result))
{      
   //getting each variable from the table
   $time=$r["time"];
   $id=$r["id"];
   $message=$r["message"];
   $name=$r["name"];
     $mail=$r['mail'];

echo "<div class='shout'>
    Shouted on: <i>".$time."</i><br>
    By <b><a href='mailto:".$mail."'>".$name."</b></a><br>
    ".$message."<br>
   </div><br>";
} ?>
</body>
</html>

 

 

This is the code i am using for the shout.php here is the website I am using it on www.drewsmedia.com. I want to know what i must edit to make the shoutbox look like the rest of my website and how to make the shoutbox longer..

 

Form.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Shoutbox</title>
</head>
<body>
<?php include 'shouts.php'; ?>
<form method="post" action="doit.php">
<input type='text' name='name' value='Name' onfocus='this.value=""'><br>
<input type='text' name='mail' value='E-Mail' onfocus='this.value=""'><br>
<textarea name='message' onfocus='this.value=""' rows='3' cols='20'>Your Text Here</textarea>
<br>
<input type='submit' value='submit' name='submit'>
</form>
</body>
</html>

 

Config

<?php

    $dbhost   = '********';
    $dbname   = '********';
    $dbusername   = '********';
    $dbuserpass = '********';    
    
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
?>

Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

<style type="text/css">

<!--

.shout{

padding-bottom:4px;

border-bottom:1px solid #000;

width:180px;

text-align:left;

font-family:Arial

font-size:11px;

background-color:#262727

font-color:$FF0000

}

-->

</style>

 

by editing that you can change about everything about it

Link to comment
Share on other sites

well you can't just make the "by" alone white by my edit, to do that I'd to this:

 

echo "<div class='shout'>
    Shouted on: <i>".$time."</i><br>
    <font color=#FFFFFF>By</font> <b><a href='mailto:".$mail."'>".$name."</b></a><br>
    ".$message."<br>
   </div><br>";

 

btw this is in shout.php

Link to comment
Share on other sites

well by using this which I previously posted:

 

<style type="text/css">
<!--
.shout{
padding-bottom:4px;
border-bottom:1px solid #000;
width:180px;
text-align:left;
font-family:Arial
font-size:11px;
background-color:#262727
font-color:#FFFFFF
}
-->
</style>

 

all of the text will be white

Link to comment
Share on other sites

   <font color=#525757>Shouted on: <i>".$time."</i><br>
   <font color=#525757>By: <b><a href='mailto:".$mail."'>".$name."</b></a><br>
   ".$message."<br>

That is what i got so far But what do i have to edit so the By: is white and the Name is white but the message is not i want the By: and the Name to be #CCCCCC and the message to be #525757

 

 

Everything is good so far.. accept for the by: (Name)

 

www.drewsmedia.com

Link to comment
Share on other sites

echo "<div class='shout'>
   <font color=#525757>Shouted on: <i>".$time."</i><br>
   <font color=#CCCCCC>By: <b><a href='mailto:".$mail."'>".$name."</b></a><font color=#CCCCCC><br><font color=#525757>
   ".$message."<br>
  </div><br>";
} ?>

 

This is what I got lol.. Im satisfied with everything but the name i cant get that font the right color

 

www.DrewsMedia.com

Link to comment
Share on other sites

Doit.php

<?php
//including the database connection
include('config.php');
//getting everything that has been submitted
$name=mysql_real_escape_string(strip_tags($_POST['name']));
$mail=mysql_real_escape_string(strip_tags($_POST['mail']));
$message=mysql_real_escape_string(strip_tags($_POST['message']));
$submit=$_POST['submit'];
//get the current time with php date() function
//note that the server time will be recorded
//more info about all functions - http://php.net
$time=date("m/d/y");
//get the ip. Note that this wont see through proxies
$ip=$_SERVER['REMOTE_ADDR'];


//just some basic error checking which
//checks if name,e-mail and message 
//hasnt been left blank or with default text
if (($name!=="") || ($name!=="Name") || ($mail!=="") || ($mail!=="E-mail") || ($message!=="") || ($message!=="Your text"))
{
//inserts data into the database
$sql = "INSERT INTO shoutbox (id, name, mail, message, time, ip) VALUES ('NULL', '$name', '$mail', '$message', '$time', '$ip')";
mysql_query($sql) or die(mysql_error());
//sends the user back to the form
header("Location:".$_SERVER['HTTP_REFERER']);
}
else{
header("Location:".$_SERVER['HTTP_REFERER']);
}
?>

Link to comment
Share on other sites

make this:

 

<?php

//get the current time with php date() function
//note that the server time will be recorded
//more info about all functions - http://php.net
$time=date("m/d/y");

?>

(the php tags are just to get the syntax highlighting)

 

into this

<?php

//get the current time with php date() function
//note that the server time will be recorded
//more info about all functions - http://php.net
$time=date("m/d/y - H:i");

?>

(the php tags are just to get the syntax highlighting)

 

if you do that the next posts should include the date and the time

 

If it does not work, the problem is in your database because it needs to allow more characters.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.