Jump to content
php.lv forumi

Recommended Posts

Posted

Lūdzu kāds gudrs scriptotājs var sastelēt šito pareizi jo man web vajag chatu! :( Un šis ar noderētu citiem arī! Un vai var userus savienot ar ipb?

<html> 
<head> 
<title>WebmasterStash Simple Shoutbox</title> 
</head> 
<body> 
<?php 

$conn = mysql_connect("localhost", "jzvac_admin", "1991jz9969470"); 
$db = mysql_select_db("jzvac_db", $conn); 

if($_GET['postview'] == "true") { 

$sql=mysql_query("SELECT * FROM shoutbox ORDER BY id DESC LIMIT 25"); 

while($r=mysql_fetch_array($sql)) 
{ 

	// Lets fetch the details from the database shall we! 
	$username	 = stripslashes($r['username']); 
	$dateline	 = stripslashes(date("jS M G:i", $r['dateline'])); 
	$comment	= stripslashes(strip_tags($r['comment'])); 
	// We dont need the IP or ID for this part, so lets not bother fetching useless information. 

	echo'['.$dateline.'] <strong>'.$username.':</strong><br /> 
		 '.$comment.' 
		 <hr style="border-bottom: 1px dotted #555555;" align="center" size="0" color="#FFFFFF" />'; 

} 
echo'<meta http-equiv="refresh" content="5"/>'; 

}else { 
echo'<table width="600" align="center"> 
		<tr> 
			<td align="center"> 
			<iframe src="?postview=true" width="600" height="250" align="center"></iframe> 
			</td> 
		</tr> 
		<tr> 
			<td>'; 
if($_POST['submit']) { 

	$username	 = strip_tags(addslashes(htmlentities($_POST['username']))); 
	$comment	 = strip_tags(addslashes(htmlentities($_POST['comment']))); 
	$ipaddr		= $_SERVER['REMOTE_ADDR']; 

	$sql=mysql_query("INSERT INTO shoutbox (username, comment, ipaddr)  
VALUES('$username', '$comment', '$ipaddr')"); 

	if($sql) { 
		echo'<strong>Comment Added Successfully!</strong>'; 
	} 

} 

echo'<form action="" method="POST"> 
		<fieldset> 
		<b>Username:</b> <input type="text" name="username" maxlength="50" size="10" /> 
		<b>Comment:</b> <input type="text" name="comment" maxlength="500" size="30" /> 
		<input type="submit" name="submit" value="Post ?" /> 
		</fieldset> 
	</form>'; 

echo'</td> 
	</tr> 
  </table>'; 

} 
?> 
</body> 
</html>

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...