• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Please help with MySQL and PHP

updated index.php script.....

PHP:
<?PHP

// www.methodcomptech.com

include "functions.php";

if ($sss == 1)
{
	$sm  = array (";))",":((",";;)",">:D<",";)","\\:D/",":-/",":x",":\">",":P",":-*","=((",":o","x(",":>","B-)","#:-S",":-S",">:)",":(|)",":))",":|","/:)","=))","O:)",":-B","=;","I-|","8-|","L-)",":-&",":-$","[-(",":O)","8-}","<:-P","(:-|","=P~",":-?","#-o","=D>",":-ss","@-)",":^o",":-w",":-<",">:p","<):)",":@)","3:-O",":(","~8>","@};-","%%-",":-j","(~~)","^:)^","[-x","8-x","=:)",">-)",":-L","[-O<","$-)",":-\"","B-(",":)>-",":-@",":D",">:/",":)",":p",":O"); 
	$num_smiley = 73;
	for ($nc = 1;$nc <= $num_smiley;$nc++)
		$num[] = "<img src=y_emo/$nc.gif>";
}

$num_entry=mysql_numrows($gb);

$epp = $def_epp;
if (isset($_GET['epp']) and ($_GET['epp'] != ""))
	$epp = $_GET['epp'];

$pg = 1;
if (isset($_GET['pg']) and ($_GET['pg'] != ""))
	$pg = $_GET['pg'];

$tp = ceil($num_entry/$epp);

$start = ($pg-1) * $epp;
$end = $start + $epp;

echo "<html><head><title>$title</title></head><body text=#000000 link=gray alink=gray vlink=gray bgcolor=white><font size=1>";
if ($center != 0)
	echo "<center>";

echo "<table width=$width cellpadding=0 cellspacing=0 border=0><tr><td width=1%><img src=ipei_imgs/blank.gif width=1 height=1></td><td width=96% valign=bottom align=right><font face=arial size=1 color=gray>Page: ";

echo "<a href=index.php?pg=1&epp=$epp>&lt;&lt;</a> | ";

for ($a=$pg-4;$a < $pg;$a++)
{
	if (($a >= 1) and ($a <= $tp))
		echo "<a href=index.php?pg=$a&epp=$epp>$a</a> | ";
}

echo "<b><font size=+1>$pg</font></b>";

for ($b=$pg+1;$b <= $pg+4;$b++)
{
	if (($b >= 1) and ($b <= $tp))
		echo " | <a href=index.php?pg=$b&epp=$epp>$b</a>";
}

echo " | <a href=index.php?pg=$tp&epp=$epp>&gt;&gt;</a>";

echo " of $tp pages.<br><font face=arial size=4 color=gray><a href=index.php?a=view>v<b>i</b>ew</a> / <a href=index.php?a=sign>s<b>i</b>gn</a></font></font></td><td width=3%><img src=ipei_imgs/blank.gif width=1 height=1></td></tr></table><br><br>";

if ($_GET['a'] == "smilies")
{
	echo "<font size=1 face=arial color=gray>Emoticons are &copy; Yahoo!<br>note: not all smilie codes are exactly same as on Yahoo Messenger</font><br><br><table border=1>";
	for ($i=0;$i < $num_smiley;$i++)
	{
		echo "<tr><td>$sm[$i]</td><td>$num[$i]</td></tr>";
	}
	echo "</table>";
}
else if ($_GET['a'] == "process_delete")
{
	if ($_POST[password] == $pw)
	{
		$DQuery = "DELETE FROM `$table` WHERE `entrynum` = $_POST[e]";
		mysql_query($DQuery);
		echo "<font size=2 face=arial>Entry $_POST[e] Deleted.<br><br></font>";
	}
	else
		echo "<font size=2 face=arial>Invalid Password<br><br></font>";
}
else if ($_GET['a'] == "process_comment")
{
	if ($_POST[password] == $pw)
	{
		$cmttime = date("Y-m-d H:i:s");
		$querya="UPDATE `$table` SET `comment` = '".addslashes($_POST[comment])."',`comment_date` = '$cmttime' WHERE `entrynum` = '$_POST[e]'";
		mysql_query($querya);
		echo "<font size=2 face=arial>Comment added for entry $_POST[e].<br><br></font>";
	}
	else
		echo "<font size=2 face=arial>Invalid Password<br><br></font>";
}
else if ($_GET['a'] == "edit")
{
	if ($_POST[password] == $pw)
	{
		$query="SELECT * FROM `$table` WHERE 1 AND `entrynum` = $_POST[e]";
		$entryfile=mysql_query($query);
		$tip = mysql_result($entryfile,0,"ip");
		$tisp = mysql_result($entryfile,0,"res_ip");
		$original_cmt = mysql_result($entryfile,0,"msg");
	
		echo "<font size=1 color=gray face=arial>Edit Original Message:<br></font><form action=index.php?a=process_comment method=POST><input type=hidden name=\"password\" value=\"$_POST[password]\"><input type=hidden name=\"e\" value=\"$_POST[e]\"><TEXTAREA name=\"comment\" rows=12 cols=45>$original_cmt</TEXTAREA><br><input type=submit name=submit value=\"Edit Comment\" mysql_query($DQuery)></form><hr width=$width><br></font>";

//////////////////////


		echo "<font size=1 color=gray face=arial>Edit Original Message:<br></font><form action=index.php?a=process_comment method=POST><input type=hidden name=\"password\" value=\"$_POST[password]\"><input type=hidden name=\"e\" value=\"$_POST[e]\"><table cellspacing=3 cellpadding=3 border=0>
	<tr><td><TEXTAREA name=\"msg\" rows=12 cols=45>$original_cmt</TEXTAREA></td></tr>
	</table><br><input type=submit name=submit value=\"Edit Comment\"></form><br>";


//////////////////////

		echo "<font size=2 face=arial>IP: $tip<br>Resolved IP: $tisp<br>";

		echo "<font size=2 face=arial><br>Original Message:<br>";
		
		displayEntry(mysql_result($entryfile,0,"name"),mysql_result($entryfile,0,"msg"),mysql_result($entryfile,0,"comment"),mysql_result($entryfile,0,"email"),mysql_result($entryfile,0,"homepage"),convert_datetime(mysql_result($entryfile,0,"date"), "F j Y"),1,mysql_result($entryfile,0,"entrynum"));

		echo "<br><hr width=$width><font size=1 color=red face=arial>Delete:<br></font><form action=index.php?a=process_delete method=POST><input type=hidden name=\"password\" value=\"$_POST[password]\"><input type=hidden name=\"e\" value=\"$_POST[e]\"><input type=submit name=submit value=\"Delete entry #$_POST[e], CANNOT BE UNDONE\"></form>";
	}
	else
		echo "<font size=2 face=arial>Invalid Password<br><br></font>";
}
else if ($_GET['a'] == "login")
{
	$form = "<br><form action=index.php?a=edit method=POST><table cellspacing=3 cellpadding=3 border=0>
	<tr><td valign=top align=right><font size=2 face=\"$font\" color=$fcolor>password</font></td><td><input type=password name=\"password\" size=26><input type=hidden name=\"e\" value=\"$_GET[e]\"></td></tr>
	<tr><td>&nbsp;</td><td><input type=submit name=submit value=\"Login to edit entry #$_GET[e]\"></td></tr>
	</table></form><br>";

	echo $form;
}
else if ($_GET['a'] == "process")
{
	if (($_POST[name] == "") or ($_POST[msg] == ""))
		echo "<font size=2 face=arial>Missing Field(s): please input a name and a message<br><br></font>";
	else {
	$entrytime = date("Y-m-d H:i:s");
	$userIP = getenv("REMOTE_ADDR");
	$userISP = gethostbyaddr($userIP);

	$in_query = "INSERT INTO `$table` VALUES ('','$_POST[name]','$_POST[email]','$_POST[homepage]','','$_POST[msg]','$entrytime','','','$userIP','$userISP','1')";
	mysql_query($in_query);

	echo "<font size=2 face=arial>Thank you for posting $_POST[name]!<br><br></font>";
	}
}
else if ($_GET['a'] == "sign")
{
	$form = "<br><form action=index.php?a=process method=POST><table cellspacing=3 cellpadding=3 border=0>
	<tr><td valign=top align=right><font size=2 face=\"$font\" color=$fcolor>name</font></td><td><input type=text name=\"name\" size=26></td></tr>
	<tr><td valign=top align=right><font size=2 face=\"$font\" color=$fcolor>email</font></td><td><input type=text name=\"email\" size=26></td></tr>
	<tr><td valign=top align=right><font size=2 face=\"$font\" color=$fcolor>homepage</font></td><td><input type=text name=\"homepage\" value=\"http://\" size=26></td></tr>
	<tr><td valign=top align=right><font size=2 face=\"$font\" color=$fcolor>message</font></td><td><TEXTAREA name=\"msg\" rows=6 cols=30></TEXTAREA></td></tr>
	<tr><td>&nbsp;</td><td><input type=submit name=submit value=Post></td></tr></table></form>";

	if ($sss == 1)
		$form = $form . "<center><a href=index.php?a=smilies target=_blank>smilies help</a></center><br>";

	displayEntry("Sign Guestbook",$form,"",NULL,NULL,NULL,0,NULL);
}
else if ($num_entry == 0)
{
	echo "<font size=2 face=arial>The guestbook is empty.<br><br></font>";
}
else
{
	for ($c=$start;$c < $end;$c++)
	{
		if (($c >= 0) and ($c < $num_entry))
		{
			displayEntry(mysql_result($gb,$c,"name"),mysql_result($gb,$c,"msg"),mysql_result($gb,$c,"comment"),mysql_result($gb,$c,"email"),mysql_result($gb,$c,"homepage"),convert_datetime(mysql_result($gb,$c,"date"), "F j Y"),1,mysql_result($gb,$c,"entrynum"));
		}
	}
}
cleanup();

echo "</center><br><br></font></body><comment><!-- Method Comptech Technologies Guestbook - www.methodcomptech.com | emoticons are copyright by Yahoo! --></comment></html>";
?>
 
instead of just posting code which u copied off the internet why dont you post specific errors.

no one is going to program a forum for you.
 
hey, if you arent willing to help, dont post a reply. i already have someone helping thank you very much, and he asked me to post the code. that is why it is here. so as for saying i copied the code, sure. whatever you think. it is my current code that i made, so before you try to dis on me, make sure you know what you are talking about. thanks for your concern.
 
it is totally cool. i just need help, and i can admit that my php is not that great yet. thanks anyways
 
Well, Tree was unabel to figure it out, but he tried. If anyone else has any ideas how to make this script work properly, please let me know. I have already posted all the code there from when Tree requested it, so hopefully it will help you. Please let me know. Thanks for any help.
 
Thanks to everyone that tried helping. Unfortunately nothing worked. If anyone else knows how to resolve this problem, please, let me know
 
Thank ryza, since i am sure you are the one that gave me negative reputation points on my thread since you were the only one giving me a hard time about posting the code. if it wasnt you, sorry for accusing you, but you can see where i am coming from thinking it was you.
 
Back
Top