Jump to content

Recommended Posts

I am getting some output errors after simply amending a text link on this page;

http://www.locus-capital.com/contact.php

The output can be seen on the page above. The full code for the contact.php page is here;

<!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>
    
  </head>
  <body>hexdec(substr($hexcolor,0,2)),'g'=>hexdec(substr($hexcolor,2,2)),'b'=>hexdec(substr($hexcolor,4,2)));
	return $dec_color;
	}
	function generateCode($characters) {
		/* list all possible characters, similar looking characters and vowels have been removed */
		$possible = '23456789bcdfghjkmnpqrstvwxyz'; 
		$code = '';
		$i = 0;
		while ($i < $characters) { 
			$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
			$i++;
		}
		return $code;
	}
	function CaptchaImage($width='400',$height='30',$characters='5',$hex_bg_color='FFFFFF',$hex_text_color="FF0000",$hex_noise_color="CC0000", $img_file='captcha.jpg') {
		$rgb_bg_color=$this->hex_to_dec($hex_bg_color);
		$rgb_text_color=$this->hex_to_dec($hex_text_color);
		$rgb_noise_color=$this->hex_to_dec($hex_noise_color);
		$code = $this->generateCode($characters);
		/* font size will be 60% of the image height */
		$font_size = $height * 0.60;
		$image = @imagecreate($width, $height) or die('Cannot Initialize new GD image stream');
		/* set the colours */
		$background_color = imagecolorallocate($image, $rgb_bg_color['r'], $rgb_bg_color['g'],$rgb_bg_color['b']);
		$text_color = imagecolorallocate($image, $rgb_text_color['r'], $rgb_text_color['g'],$rgb_text_color['b']);
		$noise_color = imagecolorallocate($image, $rgb_noise_color['r'], $rgb_noise_color['g'],$rgb_noise_color['b']);
		/* generate random dots in background */
		for( $i=0; $i<($width*$height)/3; $i++ ) {
			imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
		}
		/* generate random lines in background */
		for( $i=0; $i<($width*$height)/150; $i++ ) {
			imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
		}
		/* create textbox and add text */
		$textbox = imagettfbbox($font_size, 0, $this->font, $code);
		$x = ($width - $textbox[4])/2;
		$y = ($height - $textbox[5])/2;
		imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code);
		/* save the image */
		imagejpeg($image,$img_file);
		imagedestroy($image);
		echo "<img id="\"captchaImg\"" alt="\"security" src="\"$img_file?".time()."\"" />";
		$_SESSION['captcha_code'] = $code;
	}

}
?>


     
    <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" /> 
    <title>Locus Capital Consulting - hedge funds,  investment consulting,  investment adviser,  hedge fund research,  family office management,  wealth management</title> 
    <meta content="hedge funds,  investment consulting,  investment adviser,  hedge fund research,  family office management,  wealth management,  alternative investing art management,  contemporary art,  fine art,  contemporary painting,  sculpture,  porcelain,  paintings," name="keywords" /> 
    <meta content="Locus Capital Consulting is a group of consultants based in London whose specialist knowledge is applied to the wealth management arena across a wide variety of asset classes and styles of investment." name="description" /> 
    <meta content="FOLLOW,INDEX" name="robots" /> <script src="/js/email.js" language="javascript"></script> <script src="/js/jquery.js" type="text/javascript"></script> <script src="/js/jquery-ui.min.js" type="text/javascript"></script> <script src="/js/jqueryslidemenu.js" type="text/javascript"></script> <script src="/js/jquery.form.js" type="text/javascript"> </script> <!--[if IE 6]>
<script type='text/javascript' src='js/DD_belatedPNG.js'></script>
<script>DD_belatedPNG.fix('img, png, .info, .testimonial-tipbg ');</script>
<![endif]--> 
    <link href="/css/reset.css" type="text/css" rel="stylesheet" /> 
    <link href="/style.css" type="text/css" rel="stylesheet" /> 
    <link href="/css/jquerycssmenu.css" type="text/css" rel="stylesheet" /> 
    <link href="/css/content-slider.css" type="text/css" rel="stylesheet" /> 
    <link href="/css/jqueryslidemenu.css" type="text/css" rel="stylesheet" /> <!-- Start Wrapper --> 
    <div id="wrapper"> <!-- Start Header --> 
      <div id="header-wrapper"> 
        <div class="header-inner"> 
          <h1 class="logo"><a href="index.html"><img alt="Locus Capital Consulting" src="/images/logo.png" /></a></h1> 
        </div> 
      </div> <!-- End Header --> <br style="clear: left;" /> 
      <div class="top-navigation"> 
        <div class="jqueryslidemenu" id="myslidemenu"> 
          <ul> 
            <li><a href="index.html">Home</a></li> 
            <li><a href="about.html">About Us</a> 
              <ul> 
                <li><a href="people.html">People</a></li> 
              </ul> 
            </li> 
            <li><a href="institutional-services.html">Institutional Services</a></li> 
            <li><a href="private-client-services.html">Private Clients</a></li> 
            <li><a target="_blank" href="http://www.locus-capital-art-advisory.com">Art Advisory</a></li> 
            <li><a href="portfolio.html">Disclaimer</a></li> 
            <li class="activelink"><a href="contact.php">Contact Us</a></li> 
          </ul> <br style="clear: left;" /> 
        </div> 
      </div> <!-- Start Main section  --> 
      <div id="main"> <!-- Start Left Column --> 
        <div id="leftcolumn-wrapper"> <!-- Start Left Column Inner --> 
          <div class="leftcolumn-inner"> 
            <h1 class="page-title">Contact Us</h1> 
            <p><b>Please fill in the following details and we'll be in touch shortly...</b> </p> 
            <div class="message"></div> 
            <div class="contact-us"> 
              <form action="https://hosting.heartinternet.co.uk/contact-us.php" method="post" name="form1" id="contactForm"> 
                <p><span class="form-col1">Your Name:<span class="red">*</span></span> <input name="cname" /></p> 
                <p><span class="form-col1">Your Email:<span class="red">*</span></span> <input id="email" name="cemail" /></p> 
                <p><span class="form-col1">Phone:<span class="red">*</span></span> <input value="Example - xxxx-xxx-xxxx" id="cphone" name="cphone" /> </p> 
                <p><span class="form-col1">Website:</span> <input id="cwebsite" name="cwebsite" /></p> 
                <p><label class="form-col1">Message:</label> 
                  <textarea id="message" rows="5" cols="20" name="cmessage"></textarea>
                </p> 
                <p>
                  <table width="100%" border="0"> 
                    <tbody>
                      <tr> 
                        <td width="21%"><br /></td> 
                        <td width="79%">
                          <table width="100%" border="0"> 
                            <tbody>
                              <tr> 
                                <td><!--?php $captcha = new CaptchaImage(400,50,5,'ffffff','339966','ffffff');?--><br /></td> 
                              </tr> 
                            </tbody>
                          </table> 
                        </td> 
                      </tr> 
                      <tr> 
                        <td><br /></td> 
                        <td><span class="form-col1">Enter Code:</span> <input type="text" name="code" /> <!--?php echo $captcha_msg ?--></td> 
                      </tr> 
                    </tbody>
                  </table> 
                </p>
                <p> </p> 
                <p> <input type="image" class="submit" src="/images/submit.png" value="Send Message" name="submit" /></p> 
              </form> 
            </div> 
          </div> <!-- End Left Column Inner --> 
        </div> <!-- End Left Column --> <!-- Start right columsn/ sidebar --> 
        <div id="rightcolumn-wrapper"> 
          <div class="rightcolumn-inner"> 
            <h3> Useful Links </h3> 
            <ul> 
              <li> <a href="/about.html">About Us</a> </li> 
              <li> <a href="/portfolio.html">Portfolio</a> </li> 
              <li> <a href="/institutional-services.html">Institutional Services</a> </li> 
              <li> <a href="/privacy-policy.html">Privacy</a> </li> 
            </ul>
            <div class="vpace"> </div> 
            <h3>Address Details</h3> 
            <ul class="contact-info"> 
              <li>Locus Capital Consulting </li> 
              <li>43-45 Portman Square </li> 
              <li>London, W1H 6HN </li> 
            </ul> 
            <div class="vpace"> </div> 
            <h3>General Contact Info</h3> 
            <ul class="contact-info"> 
              <li><b>Phone:</b> +44 (0) 20 7060 1962  </li> 
              <li><script>mail("enquiries","locus-capital",0,"")</script> <br /></li> 
            </ul> 
            <div class="vpace"> </div> 
            <h3>Contact Info for external fund managers</h3> 
            <ul class="contact-info"> 
              <li><script>mail("fund","fund-data",0,"")</script><br /></li> 
            </ul> 
          </div> <!-- End .rightcolumn-inner  --> 
        </div> <!-- End #rightcolumn-wrapper --> 
      </div> <!-- End Main section #main  --> 
      <div class="clear"></div> <!-- Start Footer --> 
      <div id="footer-wrapper"> 
        <div class="footer-wrapper-inner"> 
          <ul class="footer-rightdiv"> 
            <li><a href="http://www.locus-capital.com">© <script type="text/javascript" language="JavaScript">
//<![CDATA[
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
var today = new Date();
var year  = y2k(today.getYear());
document.write(year);
//]]>
</script>
		        Locus Capital Consulting - All Rights Reserved</a>  | </li> 
            <li><a href="/site-map.html"> Site Map</a>  | </li> 
            <li><a href="/privacy-policy.html">Privacy Policy</a></li> 
            <li><a target="_blank" href="mailto:alan.peake@mail.com">Site Credits</a></li> 
          </ul> 
        </div> 
      </div> <!-- End Footer --> 
    </div> <!-- End Wrapper --> 
  </body>
</html>

Just cannot figure out what happened and after asking my hosting company and getting ignored i really need some help please.

Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/
Share on other sites

The open PHP tag goes after the <body> tag here:

<body>hexdec(substr($hexcolor,0,2)),'g'=>hexdec(substr($hexcolor,2,2)),'b'=>hexdec(substr($hexcolor,4,2)));

 

Note that there are a number of other errors. However, some of those errors may be caused by where you got the code from. Did you copy the code from the original file? The reason I ask is the following line uses < instead of >

while ($i < $characters) {
Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466401
Share on other sites

the php code you have posted has also been passed through htmlentities or perhaps you copied the view source from where it was published rather than the actual text on the page where it was published.

 

in any case, that's not functional php code, unless you go through and fix all the <, >, &, ", and ' characters.

 

perhaps if you explain exactly what you started with and what exactly you did or changed in the file to get to this point?

 

p.s. things you change in code on a server isn't you web host's problem. they are not going to be able or willing to help you.

Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466402
Share on other sites

 

The open PHP tag goes after the <body> tag here:

<body>hexdec(substr($hexcolor,0,2)),'g'=>hexdec(substr($hexcolor,2,2)),'b'=>hexdec(substr($hexcolor,4,2)));

Note that there are a number of other errors. However, some of those errors may be caused by where you got the code from. Did you copy the code from the original file? The reason I ask is the following line uses < instead of >

while ($i < $characters) {

 

you mean like this;

<body><?php hexdec(substr($hexcolor,0,2)),'g'=>hexdec(substr($hexcolor,2,2)),'b'=>hexdec(substr($hexcolor,4,2)));
Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466403
Share on other sites

You got it. Note that you'll probably still get errors, but that's a good start. :)

 

when i did the above the page just disappeared again.

 

This form/contact form was built a few years ago, its just a form and captcha script. I do not have the slightest clue about php, always willing to learn thou. I remember just downloading the script and following the instructions with copy paste and some minor line tweaks. I actually just found out that i had not even edited this file. I amended some other files on the server and not this one but somehow it has a bug.

 

I removed the change above as the page disappeared and people will not then be able to see the page to help. So it is back where i started.

Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466405
Share on other sites

when i did the above the page just disappeared again.

 

This form/contact form was built a few years ago, its just a form and captcha script. I do not have the slightest clue about php, always willing to learn thou. I remember just downloading the script and following the instructions with copy paste and some minor line tweaks. I actually just found out that i had not even edited this file. I amended some other files on the server and not this one but somehow it has a bug.

 

I removed the change above as the page disappeared and people will not then be able to see the page to help. So it is back where i started.

 

I also appreciate there may be other errors in the code, it might be old and i certainly did not write it.

Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466406
Share on other sites

the php code later in the page has also had the leading and trailing < > converted into html comments <-- and -->.

 

the question now becomes HOW did you edit this page? it looks like you used some sort of web based wysiwyg comment form and ALL the php code in it is no longer valid php.

Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466407
Share on other sites

the php code later in the page has also had the leading and trailing < > converted into html comments <-- and -->.

 

the question now becomes HOW did you edit this page? it looks like you used some sort of web based wysiwyg comment form and ALL the php code in it is no longer valid php.

 

I know its not even funny! i host with heart internet and all i did was right click on the conact.php file and amend one line of text, but it seems i never even changed anything so i just right clicked to edit and then exited and the WYSIWYG system replaced the code!

 

I am only getting one line of code displaying now, http://www.locus-capital.com/contact.php on that page; "; $_SESSION['captcha_code'] = $code; } } ?>

but i will look into the other converted characters you told me about... thanks.

Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466411
Share on other sites

the php code later in the page has also had the leading and trailing < > converted into html comments <-- and -->.

 

the question now becomes HOW did you edit this page? it looks like you used some sort of web based wysiwyg comment form and ALL the php code in it is no longer valid php.

 

You mean these lines? see below

<!--?php $captcha = new CaptchaImage(400,50,5,'ffffff','339966','ffffff');?--><br /></td> 
                              </tr> 
                            </tbody>
                          </table> 
                        </td> 
                      </tr> 
                      <tr> 
                        <td><br /></td> 
                        <td><span class="form-col1">Enter Code:</span> <input type="text" name="code" /> <!--?php echo $captcha_msg ?-->

could this be why i am getting this message at the top of the page?

"; $_SESSION['captcha_code'] = $code; } } ?>
Link to comment
https://forums.phpfreaks.com/topic/285641-contactphp-error/#findComment-1466414
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.