Reply
need advice plz on what to add to my guestbook or shoutbox next
Old 08-27-2009, 01:29 AM need advice plz on what to add to my guestbook or shoutbox next
Ultra Talker

Posts: 456
Trades: 0
hi, im am an absolute php newb. but if anyone can tell me what i should add next for functionality of my guestbook script or my shoutbox script that would really help my learning. right now the guestbook is just a form where you submit your name email and comment, and it stores it on another page to display. i dont really understand the chatbox code but its a basic chatbox where you can post messages to the page. both are working. any help greatly appreciated. thanks. derek
silverglade is online now
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-27-2009, 05:16 AM Re: need advice plz on what to add to my guestbook or shoutbox next
lizciz's Avatar
Ultra Talker

Posts: 333
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I guess you could add a CAPTCHA validation image in your questbook. There are complete scripts out there ready for use, couldn't be simpler. And try to understand what the script is doing.
You can try this one, which I found among my bookmarks http://www.white-hat-web-design.co.u...hp-captcha.php

Or, since you dont understand your shoutbox script, you could take a look at that and try to figure it out.
__________________
596f75206d65616e20796f752063616e2061637475616c6c79 207265616420746869733f
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 08-27-2009, 12:24 PM Re: need advice plz on what to add to my guestbook or shoutbox next
Ultra Talker

Posts: 456
Trades: 0
great thank you very much. also, my captcha image isnt showing up. and im not sure if my captcha code is correct for addguestbook1.php

here is the code to my files any help greatly appreciated again.

guestbook1.php

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>derek's first guestbook</title>
</head>

<body>

<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><strong> Sign Guestbook </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="addguestbook.php">
<td>
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="117">Name</td>
<td width="14">:</td>
<td width="357"><input name="name" type="text" id="name" size="40" /></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="email" type="text" id="email" size="40" /></td>
</tr>
<tr>
<td valign="top">Comment</td>
<td valign="top">:</td>
<td><textarea name="comment" cols="40" rows="3" id="comment"></textarea></td>
</tr>
<tr>
  <td valign="top">&nbsp;</td>
  <td valign="top">&nbsp;</td>
  <td><img src="CaptchaSecurityImages.php" />
Security Code: 
<input id="security_code" name="security_code" type="text" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><strong><a href="viewguestbook.php">View Guestbook</a> </strong></td>
</tr>
</table>
</body>
</html>
/////////////////////////////////////////////addguestbook1.php/////////////

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>derek's add guest php</title>
</head>

<body>

<?php
$host="brendansite1.startlogicmysql.com"; // Host name
$username=" "; // Mysql username
$password=" "; // Mysql password
$db_name=" "; // Database name
$tbl_name=" "; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");

$datetime=date("y-m-d h:i:s"); //date time

session_start();
   if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
      unset($_SESSION['security_code']);
   } else {
      echo "error";
   }


$sql="INSERT INTO $tbl_name(name, email, comment, datetime)VALUES('$name', '$email', '$comment', '$datetime')";
$result=mysql_query($sql);

//check if query successful
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page
}

else {
echo "ERROR";
}

mysql_close();
?>
</body>
</html>
////////////////////////////////////////////////viewguestbook1.php//////

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>derek's first view guestbook</title>
</head>

<body>

<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><strong>View Guestbook | <a href="guestbook.php">Sign Guestbook</a> </strong></td>
</tr>
</table>
<br>

<?php

$host=" "; // Host name
$username=" "; // Mysql username
$password=" "; // Mysql password
$db_name=" "; // Database name
$tbl_name=" "; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td>ID</td>
<td>:</td>
<td><? echo $rows['id']; ?></td>
</tr>
<tr>
<td width="117">Name</td>
<td width="14">:</td>
<td width="357"><? echo $rows['name']; ?></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><? echo $rows['email']; ?></td>
</tr>
<tr>
<td valign="top">Comment</td>
<td valign="top">:</td>
<td><? echo $rows['comment']; ?></td>
</tr>
<tr>
<td valign="top">Date/Time </td>
<td valign="top">:</td>
<td><? echo $rows['datetime']; ?></td>
</tr>
</table></td>
</tr>
</table>
<BR>
<?
}
mysql_close(); //close database
?>


</body>
</html>
silverglade is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to need advice plz on what to add to my guestbook or shoutbox next
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13903 seconds with 13 queries