+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: guestbook script PHP

  1. #1
    surreal5335 is offline x10Hosting Member surreal5335 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    28

    guestbook script PHP

    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

  2. #2
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: guestbook script PHP

    index.* is usually the main page for any site/script.

    In your case it would be index.php

  3. #3
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: guestbook script PHP

    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.
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

  4. #4
    surreal5335 is offline x10Hosting Member surreal5335 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    28

    Re: guestbook script PHP

    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:
    <?php
    include("gb_config.php");
    //Check for banned IP
    if (!(file_exists($ip_file))){ 
    fopen($ip_file,"w") or die("Can't open the file $ip_file");;
    $data=file($ip_file);	
    }else{
    fopen($ip_file,"r");
    $data=file($ip_file);	
    }
    $userIP=$_SERVER['REMOTE_ADDR']; 
    for ($i=0; $i<sizeof($data); $i++){
    $bannedIP = trim($data[$i]);
    if ($bannedIP == $userIP){
    echo("<h3>$la34</h3>");
    return 0;
    }
    } //end for
    	 
    ?>
    <html>
    <head>
    <title><? echo $gb_title; ?></title>
    <meta name="description" content="hnGuestbook, an AJAX Php Guestbook" />
    <meta name="keywords" content="ajax guestbook, free guestbook, php guestbook, hnGuestbook, hnScripts, ajax, guestbook, php" />
    <script language="javascript" type="text/javascript">
    var loadtext = '<? echo $la32; ?>';
    var c_minute = <? echo $flood_protection; ?>;
    </script>
    <script language="javascript" src="gb_ajax.js" type="text/javascript"></script>
    <link href="gb_style.css" rel="stylesheet" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=<? echo $encoding; ?>">
    
    </head>
    <body>
    
    <div align="center">
    <div class="container">
    <div class="content">
    
    <h3><? echo $gb_title; ?></h3>
    
    <?
    $token = md5(uniqid(rand(), true));
    $pcode = md5($spam_protection_code);
    if($disable_gb=="1"){
    echo ("<center><br><br><br><br><br><br><b>$la33</b><br><br><br><br><br><br></center>");
    exit;
    }
    ?>
    
    
    <div id="signform" style="display:none;">
    <font size="1"><? echo $la17; ?>.</font>
    <br>
    
    <form name="signgb">
    <table border="0" cellpadding="0" cellspacing="2" width="100%" id="table1">
    <tr>
    <td valign="top"><? echo $la11; ?>: *</td>
    <td valign="top"><input type="text" name="name" size="30"></td>
    </tr>
    <tr>
    <td valign="top"><? echo $la12; ?>:</td>
    <td valign="top"><input type="text" name="email" size="30"></td>
    </tr>
    <tr>
    <td valign="top"><? echo $la13; ?>:</td>
    <td valign="top"><input type="text" name="homepage" size="30" value="http://"></td>
    </tr>
    <tr>
    <td valign="top"><? echo $la14; ?>: *</td>
    <td valign="top"><textarea rows="5" name="message" cols="35"></textarea><br>
    <a href="javascript:smiley(' :p ');"><img src="images/s1.gif" alt=":p" border="0"></a> <a href="javascript:smiley(' :) ');"><img src="images/s2.gif" alt=":)" border="0"></a> <a href="javascript:smiley(' :a ');"><img src="images/s3.gif" alt=":a" border="0"></a> <a href="javascript:smiley(' :o ');"><img src="images/s4.gif" alt=":o" border="0"></a> <a href="javascript:smiley(' :s ');"><img src="images/s5.gif" alt=":s" border="0"></a> <a href="javascript:smiley(' :r ');"> <img src="images/s6.gif" alt=":r" border="0"></a> <a href="javascript:smiley(' :v ');"><img src="images/s7.gif" alt=":v" border="0"></a> <a href="javascript:smiley(' :h ');"><img src="images/s8.gif" alt=":h" border="0"></a> <a href="javascript:smiley(' ;) ');"><img src="images/s9.gif" alt=";)" border="0"></a> <a href="javascript:smiley(' :m ');"><img src="images/s10.gif" alt=":m" border="0"></a></td>
    </tr>
    <tr>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td valign="top">&nbsp;</td>
    <td valign="top"><input type="button" value="<? echo $la18; ?>" name="signbutton" onClick="javascript:ajax('POST','gb_sign.php','action','signgb');"> <input type="reset" value="<? echo $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>

    Thanks a lot for your help

  5. #5
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: guestbook script PHP

    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.
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

  6. #6
    surreal5335 is offline x10Hosting Member surreal5335 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    28

    Re: guestbook script PHP

    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:
    <a href="javascript:smiley(' :p ');"><img src="images/s1.gif" alt=":p" border="0"></a> 
    <a href="javascript:smiley(' :) ');"><img src="images/s2.gif" alt=":)" border="0"></a> <a href="javascript:smiley(' :a ');"><img src="images/s3.gif" alt=":a" border="0"></a> 
    <a href="javascript:smiley(' :o ');"><img src="images/s4.gif" alt=":o" border="0"></a> 
    <a href="javascript:smiley(' :s ');"><img src="images/s5.gif" alt=":s" border="0"></a> 
    <a href="javascript:smiley(' :r ');"> <img src="images/s6.gif" alt=":r" border="0"></a> 
    <a href="javascript:smiley(' :v ');"><img src="images/s7.gif" alt=":v" border="0"></a> 
    <a href="javascript:smiley(' :h ');"><img src="images/s8.gif" alt=":h" border="0"></a> 
    <a href="javascript:smiley(' ;) ');"><img src="images/s9.gif" alt=";)" border="0"></a> <a href="javascript:smiley(' :m ');"><img src="images/s10.gif" alt=":m" border="0"></a></td>
    Thanks a lot

  7. #7
    TechAsh's Avatar
    TechAsh is offline Retired TechAsh is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    UK
    Posts
    5,853

    Re: guestbook script PHP

    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.
    Useful Links:
    Terms of Service | Server News | Buy a Domain
    Free Domains: co.cc | Dot.tk -- Free File Storage: Dropbox -- Website Monitoring: Service Uptime


    My Websites:
    Earthtime Games & TechAsh's Blog

  8. #8
    surreal5335 is offline x10Hosting Member surreal5335 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    28

    Re: guestbook script PHP

    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

  9. #9
    TechAsh's Avatar
    TechAsh is offline Retired TechAsh is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    UK
    Posts
    5,853

    Re: guestbook script PHP

    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
    Useful Links:
    Terms of Service | Server News | Buy a Domain
    Free Domains: co.cc | Dot.tk -- Free File Storage: Dropbox -- Website Monitoring: Service Uptime


    My Websites:
    Earthtime Games & TechAsh's Blog

  10. #10
    surreal5335 is offline x10Hosting Member surreal5335 is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    28

    Re: guestbook script PHP

    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:
    <?
    include("gb_config.php"); 
    $dosign = $_REQUEST['dosign'];
    $pcode = md5($spam_protection_code);
    $scheck = $pcode{0}.$pcode{2}.$pcode{4}.$pcode{1}.$pcode{5};
    
    if($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();
    
    
    
    if (trim($name) && trim($message)){
    
    if ($flood_protection != "0"){
    if ($_COOKIE['signed'] == "yes") {
        echo("$la21");
    	exit;
    }
    }
    
    //Cut name's length
    $name = cut_str($name, 35);
    
    //Check for valid email
    if(strpos ($email, '@') === false){
    $email = "";
    }
    
    
    if (!(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", "<br> ", $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);
    
    //End writing entry
    
    }else{
    echo("$la22");
    }
    
    
    }else{//end dosign
    echo("$la23");
    }
    
    
    
    function scheck($value){
    global $bad_words;
    $value = strip_tags($value);
    $value =  stripslashes($value);
    $value = ereg_replace("\|", "", $value);
    
    if(trim($bad_words) != ''){
    $filter = explode(',',$bad_words);
    foreach ($filter as $badword){
    $value = ereg_replace($badword," **** ",$value);
    }
    }
    
    return $value;
    }
    
    //Get Browser Type Function by Daniel.
    function getBrowser($userAgent) {
    	$browsers = array(
    		'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]+)',
    	);
    
    	foreach($browsers as $browser=>$pattern) { 
    		if(eregi($pattern, $userAgent)) { 
    			return $browser; 
    		}
    	}
    	return 'Unknown'; 
    }
    
    //Cut the length of a string
    function cut_str($str, $length){
    	
    	if(strlen($str) > $length){
    		for ($i=0; $i<$length; $i++){
    		$cut_name = $cut_name.$str[$i];
    		}
    		return $cut_name;
    	}else{
    		return $str;
    	}
    	
    }
    
    ?>

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. My first PHP script :)
    By Symbian.Ankit in forum Graphics & Webdesign
    Replies: 10
    Last Post: 02-24-2008, 01:13 AM
  2. Creating MySql database/table using php script
    By bushimports in forum Free Hosting
    Replies: 1
    Last Post: 02-02-2008, 12:43 AM
  3. php script works elsewhere, not on x10
    By atomman in forum Programming Help
    Replies: 6
    Last Post: 01-10-2008, 08:07 AM
  4. How to protect images without htaccess using PHP
    By frznmnky in forum Tutorials
    Replies: 0
    Last Post: 12-26-2007, 11:51 AM
  5. Need a PHP Script
    By Rising in forum The Marketplace
    Replies: 16
    Last Post: 02-19-2006, 12:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers