FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 haha you are pure genius lol dude you have made my shoutbox look so website customized however i only have a few questions left 1. is there anyway to autofill the Name, E-mail... like it saves the ip or w/e but when they return to the page there Nickname and Email are already filled in? Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 of course there is but give me some time Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Np that I have lol.. Another thing i wanted was like when you click the box name and you click something else the Name text that was there is gone is there and if you click all 3 the pre included text is gone is there a way to fill it back in until they type something? Also is there a way to change those boxes from plain white Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 yes but first things first run this Query in your PHPmyadmin and give me the name of the database you are using CREATE TABLE `shout_user_log` ( `id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY , `username` VARCHAR( 255 ) NOT NULL , `email` VARCHAR( 255 ) NOT NULL , `ip` VARCHAR( 255 ) NOT NULL ) ENGINE = innodb; Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 I ran the query the table has been added!! Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 now delete that, I have it now lol, don't want the world to have it Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Haha i deleted it lol Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 DON'T MIND THIS Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/d/r/e/drewsmedia/html/doit.php on line 28 Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/r/e/drewsmedia/html/doit.php:28) in /home/content/d/r/e/drewsmedia/html/doit.php on line 41 I got this error! Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 I have edited my previous post, redo it Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 Hold up, I accidentally changed the code back to not include the time Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Haha was just gonna say that Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 change your doit.php with this <?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 - g:i a"); //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()); $query = "SELECT * FROM `shout_user_log` WHERE `ip` = '$ip'"; $result = mysql_query ($query); $num_rows = mysql_num_rows ($result); if ($num_rows > 0) { $query = "DELETE * FROM `shout_user_log` WHERE `ip` = '$ip'"; mysql_query ($query); } $query = "INSERT INTO `shout_user_log` (`id`, `username`, `email`, `ip`) VALUES "; mysql_query ($query); //sends the user back to the form header("Location:".$_SERVER['HTTP_REFERER']); } else{ header("Location:".$_SERVER['HTTP_REFERER']); } ?> Updated version Now give me your current version of "SHOUT.PHP" Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Also when you refresh or go back to the homepage it doesnt fill it in for you Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 That's because I'm not done Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Shout.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> <!-- a:link {color: #CCCCCC;} a:visited {color: #CCCCCC;} a:active {color: #CCCCCC;} .shout{ padding-bottom:4px; border-bottom:1px solid #000; width:180px; text-align:left; font-family: Arial, Helvetica, sans-serif; font-size: 11px; background-color:#262727 color:#525757; font-weight: bold } --> </style> <title>Shoutbox</title> </head> <body> <?php include('config.php'); $result = mysql_query("select * from shoutbox order by id desc limit 10"); //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'> <font color=#525757>Shouted on: <i>".$time."</i><br> <font color=#CCCCCC>By: <b><a href='mailto:".$mail."'>".$name."</b></a><br><font color=#525757> ".$message."<br> </div><br>"; } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 Already have spam and bullcrap. Later if you could maybe you could help me with the whole admin thing and curse word stopper maybe tomorrow around the same time or something Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Shoutbox</title> </head> <body> <?php include 'shouts.php'; $query = "SELECT * FROM `shout_user_log` WHERE `ip` = '$ip'"; $result = mysql_query ($query); $user_info = mysql_fetch_array ($result); if (!$user_info[id]){ $name = "Name"; $email = "E-mail"; } else { $name = $user_info['username']; $email = $user_info['email']; } ?> <form method="post" action="doit.php"> <input type='text' name='name' value='<?php echo $name; ?>' onfocus='this.value=""'><br> <input type='text' name='mail' value='<?php echo $email; ?>' 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> Change your Form.php to this Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 wait wont that erase all the editing i have done? Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 this is your Form.php, it should not yet have been altered Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 oh you didnt put form.php lol by the way do you see all the spam and crap Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 I do, tell me when you altered "form.php" Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 altered Quote Link to comment Share on other sites More sharing options...
FortMyersDrew Posted June 26, 2007 Author Share Posted June 26, 2007 i wonder if this would be easier of AIM or Yahoo lol Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 26, 2007 Share Posted June 26, 2007 Don't have either <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Shoutbox</title> </head> <body> <?php include 'shouts.php'; $query = "SELECT * FROM `shout_user_log` WHERE `ip` = '$ip'"; $result = mysql_query ($query); $user_info = mysql_fetch_array ($result); if (!$user_info['id']){ $name = "Name"; $email = "E-mail"; } else { $name = $user_info['username']; $email = $user_info['email']; } ?> <form method="post" action="doit.php"> <input type='text' name='name' value='<?php echo $name; ?>' onfocus='this.value=""'><br> <input type='text' name='mail' value='<?php echo $email; ?>' 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> try altering it to that 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.