guestbook script PHP

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
I am in need of help installing a guestbook script called hnguestbook. I have uploaded all the files. I understand that I need to convert the php files over to a text file before uploading, and the gif files in binary mode (not sure how to do that).
Also I am not sure which script is the one I should use as the main page at which I use as the link to the guestbook on my site. I tried using index.php but that only gave me a title and thats it.

I heard that this was designed for unix and IE7. Im on windows xp and using firefox. but even IE gives the same result as firefox (just a title).

The instalations instructions didnt clearify which page is meant to be the main one.

Here is a list of the different file names:

gb_view.php
gb_sign.php
gb_functions.php
gb_admin.php
gb_adminview.php
gb_ajax.js
gb_config.php
index.php
gb_style.css
gb_english.php
data.txt
ip.txt

I appreciate the help
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
index.* is usually the main page for any site/script.

In your case it would be index.php
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
You dont have to convert you file, just upload the files to the folders of your choice.
Now about the home page, i think index.php will be the home page for the ordinary users and gb_admin.php wouldbe for admin people.
If you have uploaded the datas can you give the link to where its installed so that we can help you further.
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Thanks for the input I have put the index.php file as the main, all it seems to give me is this:

http://mwebbuilder.x10hosting.com/index.php

Im guessing the echo and print functions have not been properly formatted yet for the html come up.

here is the code for index.php

Code:
[B]<?php
[U]include[/U]("gb_config.php");
[I]//Check [U]for[/U] banned IP[/I]
[U]if[/U] (!(file_exists($ip_file))){ 
fopen($ip_file,"w") [U]or[/U] [U]die[/U]("Can't open the file $ip_file");;
$data=file($ip_file);	
}[U]else[/U]{
fopen($ip_file,"r");
$data=file($ip_file);	
}
$userIP=$_SERVER['REMOTE_ADDR']; 
[U]for[/U] ($i=0; $i[B]<sizeof($data); $i++){
$bannedIP = trim($data[$i]);
[U]if[/U] ($bannedIP == $userIP){
[U]echo[/U]("<h3>[/B]$la34[B]</h3>[/B]");
[U]return[/U] 0;
}
} [I]//end [U]for[/U][/I]
	 
?>[/B]
[B]<html>[/B]
[B]<head>[/B]
[B]<title>[/B][B]<? [U]echo[/U] $gb_title; ?>[/B][B]</title>[/B]
[B]<meta name="description" content="hnGuestbook, an AJAX Php Guestbook" />[/B]
[B]<meta name="keywords" content="ajax guestbook, free guestbook, php guestbook, hnGuestbook, hnScripts, ajax, guestbook, php" />[/B]
[B]<script language="javascript" type="text/javascript">[/B]
var loadtext = '[B]<? [U]echo[/U] $la32; ?>[/B]';
var c_minute = [B]<? [U]echo[/U] $flood_protection; ?>[/B];
[B]</script>[/B]
[B]<script language="javascript" src="gb_ajax.js" type="text/javascript">[/B][B]</script>[/B]
[B]<link href="gb_style.css" rel="stylesheet" type="text/css" media="screen" />[/B]
<meta http-equiv="Content-Type" content="text/html; charset=[B]<? [U]echo[/U] $encoding; ?>[/B]">

[B]</head>[/B]
[B]<body>[/B]

[B]<div align="center">[/B]
[B]<div [U]class[/U]="container">[/B]
[B]<div [U]class[/U]="content">[/B]

[B]<h3>[/B][B]<? [U]echo[/U] $gb_title; ?>[/B][B]</h3>[/B]

[B]<?
$token = md5(uniqid(rand(), [U]true[/U]));
$pcode = md5($spam_protection_code);
[U]if[/U]($disable_gb=="1"){
[U]echo[/U] ("[B]<center>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<b>[/B]$la33[B]</b>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]<br>[/B][B]</center>[/B]");
[U]exit[/U];
}
?>[/B]


[B]<div id="signform" style="display:none;">[/B]
[B]<font size="1">[/B][B]<? [U]echo[/U] $la17; ?>[/B].[B]</font>[/B]
[B]<br>[/B]

[B]<form name="signgb">[/B]
[B]<table border="0" cellpadding="0" cellspacing="2" width="100%" id="table1">[/B]
[B]<tr>[/B]
[B]<td valign="top">[/B][B]<? [U]echo[/U] $la11; ?>[/B]: *[B]</td>[/B]
[B]<td valign="top">[/B][B]<input type="text" name="name" size="30">[/B][B]</td>[/B]
[B]</tr>[/B]
[B]<tr>[/B]
[B]<td valign="top">[/B][B]<? [U]echo[/U] $la12; ?>[/B]:[B]</td>[/B]
[B]<td valign="top">[/B][B]<input type="text" name="email" size="30">[/B][B]</td>[/B]
[B]</tr>[/B]
[B]<tr>[/B]
[B]<td valign="top">[/B][B]<? [U]echo[/U] $la13; ?>[/B]:[B]</td>[/B]
[B]<td valign="top">[/B][B]<input type="text" name="homepage" size="30" value="http://">[/B][B]</td>[/B]
[B]</tr>[/B]
[B]<tr>[/B]
[B]<td valign="top">[/B][B]<? [U]echo[/U] $la14; ?>[/B]: *[B]</td>[/B]
[B]<td valign="top">[/B][B]<textarea rows="5" name="message" cols="35">[/B][B]</textarea>[/B][B]<br>[/B]
[B]<a href="javascript:smiley(' :p ');">[/B][B]<img src="images/s1.gif" alt=":p" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :) ');">[/B][B]<img src="images/s2.gif" alt=":)" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :a ');">[/B][B]<img src="images/s3.gif" alt=":a" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :o ');">[/B][B]<img src="images/s4.gif" alt=":o" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :s ');">[/B][B]<img src="images/s5.gif" alt=":s" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :r ');">[/B] [B]<img src="images/s6.gif" alt=":r" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :v ');">[/B][B]<img src="images/s7.gif" alt=":v" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :h ');">[/B][B]<img src="images/s8.gif" alt=":h" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' ;) ');">[/B][B]<img src="images/s9.gif" alt=";)" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :m ');">[/B][B]<img src="images/s10.gif" alt=":m" border="0">[/B][B]</a>[/B][B]</td>[/B]
[B]</tr>[/B]
[B]<tr>[/B]
[B]<td valign="top">[/B]&nbsp;[B]</td>[/B]
[B]<td valign="top">[/B]&nbsp;[B]</td>[/B]
[B]</tr>[/B]
[B]<tr>[/B]
[B]<td valign="top">[/B]&nbsp;[B]</td>[/B]
[B]<td valign="top">[/B]<input type="button" value="[B]<? [U]echo[/U] $la18; ?>[/B]" name="signbutton" onClick="javascript:ajax('POST','gb_sign.php','action','signgb');"> <input type="reset" value="[B]<? [U]echo[/U] $la19; ?>" name="B2"> <input type="button" value="<? echo $la20; ?>" name="" onClick="javascript:hidediv('signform');"></td>
</tr>
</table>
</form>

<br><div id="signdiv">
</div>

<br>	

</div> <!-- end hiddend sign form -->

<div id="entries"> 
</div>

<script language="Javascript" type="text/javascript">
var pcode = '<? echo $pcode; ?>';
ajax('POST','gb_view.php','page','1','<? echo $token; ?>');
</script>

</div> </div>




</div>
</body>
</html>[/B]


Thanks a lot for your help
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
In your code, you have the following line

<div id="signform" style="display:none;">

just change it as

<div id="signform">

It will work fine. Try it.
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
That helped out a lot, but for some reason now, the images which are put into a seperate folder called images are not being accessed. In the code it has the link in there properly but all I get on the web page is the "alt" message instead of the actual image. I also had this problem with the index.php page. It wasnt being accessed at all until I put all the script files into the main public folder. Is there a setting I need to change to get the server to read the subfolders?

This is the code from index.php that handles the smileys

Code:
[B]<a href="javascript:smiley(' :p ');">[/B][B]<img src="images/s1.gif" alt=":p" border="0">[/B][B]</a>[/B] [B]
<a href="javascript:smiley(' :) ');">[/B][B]<img src="images/s2.gif" alt=":)" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :a ');">[/B][B]<img src="images/s3.gif" alt=":a" border="0">[/B][B]</a>[/B] [B]
<a href="javascript:smiley(' :o ');">[/B][B]<img src="images/s4.gif" alt=":o" border="0">[/B][B]</a>[/B] 
[B]<a href="javascript:smiley(' :s ');">[/B][B]<img src="images/s5.gif" alt=":s" border="0">[/B][B]</a>[/B] 
[B]<a href="javascript:smiley(' :r ');">[/B] [B]<img src="images/s6.gif" alt=":r" border="0">[/B][B]</a>[/B] [B]
<a href="javascript:smiley(' :v ');">[/B][B]<img src="images/s7.gif" alt=":v" border="0">[/B][B]</a>[/B] 
[B]<a href="javascript:smiley(' :h ');">[/B][B]<img src="images/s8.gif" alt=":h" border="0">[/B][B]</a>[/B] 
[B]<a href="javascript:smiley(' ;) ');">[/B][B]<img src="images/s9.gif" alt=";)" border="0">[/B][B]</a>[/B] [B]<a href="javascript:smiley(' :m ');">[/B][B]<img src="images/s10.gif" alt=":m" border="0">[/B][B]</a>[/B][B]</td>[/B]

Thanks a lot
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
I may know why he images aren't being retrieved. If I visit http://mwebbuilder.x10hosting.com/images/s1.gif (One of the smilies) I get a 403 Permission Denied error. This would suggest that the permissions on the /images folder is incorrect.

You should try to CHMOD that folder to 0755. This can be done using either FTP or the cPanel file manager.
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Thank you for the help, though I get the same problem after CHMOD to 0755. may I ask what makes you feel its 0755? IS there a place in the script that is identified to that number? If so where can I find it?

You don't have permission to access /images/s3.gif on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.



This is the error message that I am getting when I try to view the image
Thanks a lot
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
may I ask what makes you feel its 0755?
0755 is the default for all folders.

You could also try to CHMOD the folder to 0777, but I'm not sure that will make much difference.
Other things to try:
  • Is there a .htaccess file in /images? If there is can you post the content here?
  • CHMOD all of the files in /images to 0644
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Thank you very much for the help, I got the smileys working. found out what I needed to do was CHMOD each image over to 0777. Now I seem to have a problem with getting the other pages to work when I press the sign button.
The sign button is programmed to activate gb_sign.php which makes sense. Im just not sure whats stopping it from activating. I tried CHMOD 0777 like the images but that didnt help

Any suggestions?

Here is gb_sign.php
Code:
[B]<?
[U]include[/U]("gb_config.php"); 
$dosign = $_REQUEST['dosign'];
$pcode = md5($spam_protection_code);
$scheck = $pcode{0}.$pcode{2}.$pcode{4}.$pcode{1}.$pcode{5};

[U]if[/U]($dosign == $scheck){

$page = $_REQUEST['page'];
$name = $_POST['name'];
$homepage = $_POST['homepage'];
$email = $_POST['email'];
$message = $_POST['message'];

$ip = $_SERVER['REMOTE_ADDR'];
$browser = getBrowser($_SERVER['HTTP_USER_AGENT']);
$stime = time();



[U]if[/U] (trim($name) && trim($message)){

[U]if[/U] ($flood_protection != "0"){
[U]if[/U] ($_COOKIE['signed'] == "yes") {
    [U]echo[/U]("$la21");
	[U]exit[/U];
}
}

[I]//Cut name's length[/I]
$name = cut_str($name, 35);

[I]//Check [U]for[/U] valid email[/I]
[U]if[/U](strpos ($email, '@') === [U]false[/U]){
$email = "";
}


[U]if[/U] (!(file_exists($data_file))){ 
		fopen($data_file,"w");	
}


$message = scheck($message);
$name = scheck(trim($name));
$email = scheck(trim($email));
$homepage = scheck(trim($homepage));

$message = ereg_replace("\r", "", $message);
$message = ereg_replace("\n", "[B]<br>[/B] ", $message);

$new_entry = $name."|".$homepage."|".$email."|".$message."|".$ip."|".$stime."|".$browser."\n";

$data=fopen($data_file,"a+");
flock($data, LOCK_EX);
fwrite($data,$new_entry);
flock($data, LOCK_UN);
fclose($data);

[I]//End writing entry[/I]

}[U]else[/U]{
[U]echo[/U]("$la22");
}


}[U]else[/U]{[I]//end dosign[/I]
[U]echo[/U]("$la23");
}



[U]function[/U] scheck($value){
[U]global[/U] $bad_words;
$value = strip_tags($value);
$value =  stripslashes($value);
$value = ereg_replace("\|", "", $value);

[U]if[/U](trim($bad_words) != ''){
$filter = explode(',',$bad_words);
[U]foreach[/U] ($filter [U]as[/U] $badword){
$value = ereg_replace($badword," **** ",$value);
}
}

[U]return[/U] $value;
}

[I]//Get Browser Type Function by Daniel.[/I]
[U]function[/U] getBrowser($userAgent) {
	$browsers = [U]array[/U](
		'Opera' => 'Opera',
		'Mozilla Firefox'=> '(Firebird)|(Firefox)', 
		'Galeon' => 'Galeon',
		'Mozilla'=>'Gecko',
		'MyIE'=>'MyIE',
		'Lynx' => 'Lynx',
		'Netscape' => '(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)',
		'Konqueror'=>'Konqueror',
		'SearchBot' => '(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)',
		'Internet Explorer 7' => '(MSIE 7\.[0-9]+)',
		'Internet Explorer 6' => '(MSIE 6\.[0-9]+)',
		'Internet Explorer 5' => '(MSIE 5\.[0-9]+)',
		'Internet Explorer 4' => '(MSIE 4\.[0-9]+)',
	);

	[U]foreach[/U]($browsers [U]as[/U] $browser=>$pattern) { 
		[U]if[/U](eregi($pattern, $userAgent)) { 
			[U]return[/U] $browser; 
		}
	}
	[U]return[/U] 'Unknown'; 
}

[I]//Cut the length of a string[/I]
[U]function[/U] cut_str($str, $length){
	
	[U]if[/U](strlen($str) > $length){
		[U]for[/U] ($i=0; $i<$length; $i++){
		$cut_name = $cut_name.$str[$i];
		}
		[U]return[/U] $cut_name;
	}[U]else[/U]{
		[U]return[/U] $str;
	}
	
}

?>[/B]
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Hi post the code that contain the sign button, it would have be disabled.
 
Top