FortMyersDrew Posted June 26, 2007 Share Posted June 26, 2007 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'); ?> Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 <?php $result = mysql_query("select * from shoutbox order by id desc limit 5"); ?> if you increase the number behind "limit" the shoutbox will be longer, and to make it look like your website, edit the HTML and CSS. Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 ahh thanks for the limit trick. as for the the editing the html/css there is none for the shoutbox. It is its own seperate .php file Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 yes, so just add your HTML (the layout of the shoutbox as I can see is set in CSS at the top) Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 where would i go about adding this? in what part of the files? Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 <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 Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 see i have tried that and what i get is the results on www.Drewsmedia.com. What would i have to type in to make the text the same color as the rest of the text on site and the By i want to be white in color Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 <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> Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 .shout{ padding-bottom:4px; border-bottom:1px solid #000; width:180px; text-align:left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; background-color:#262727 color:#525757; } This is what i have so far... www.DrewsMedia.com However the post and date are still black and the by is not white.. Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 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 Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 alright making progress lol now i just need to change the post color. then i have a few more questions but we will see about those later lol Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 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 Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 you forgot a space after your "by" and don't forget to click "topic solved" when you're done Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 <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 Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 well you have to close your tags... and add a </font> behind by and so on then change the color codes on each part Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 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 Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 That's because links are preset in the CSS code and cannot be edited by font tags http://www.htmlite.com/CSS006.php this should help you out. Now don't forget to click "Topic Solved" Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Alrighty then now im 100% satisfied. Now onto something different I would like to ask you. How would i go about adding the server time next to the posting date? Is there any more .php files I need to show you to get this done? Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 I'd need to see "doit.php" Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 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']); } ?> Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 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. Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Well it gets the date however it does not get the time of the server which is what i want also Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 the second piece of code I edited does show the current time. like I said, the problem probably lies in your database, since your "time" now needs to contain 14 characters instead of 8 Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Pfft i must be getting annoying by now lol but making GREAT progress. That is correct that is how i want it but i want it to display normally. It is showing up as 18:24 I want it to show up like 6:24pm www.DrewsMedia.com Check out the test Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 <?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 - g:i a"); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.