A little help with PHP INCLUDE files

  • RSMEDUDE
  • Novice
  • Novice
  • User avatar
  • Posts: 33

Post 3+ Months Ago

Hello everyone,

I am a long time member but I very rarely post on here. To that end I hope I am posting this issue in the right place.

Before I get into things I want to state that I am a novice with PHP. I am learning but a lot of the coding that I am using is either a free to use download with proper notation or coding I have figured out how to make work together off of different how to sites.

I am trying to work on my model railroad clubs website and what I am trying to accomplish is to make a header include file so that I have what we call the "hotbox" showing up on every page. The other benefits to this are that the header will ultimately look uniform across all pages and I will only have one page to edit for updates to the "hotbox". I have most of the pages working how I want but I have some that are being a little stubborn and I am not sure why.

Before I show you the code for what I want to accomplish here are some links.

This is how the site looks and functions now: Reading Society of Model Engineers Main Site

This is more or less what I want it to look like: Reading Society of Model Engineers BETA Site

In the BETA site you will see that some pages load the way they should with the "hotbox" at the top while others load without it. The ones without are my problem pages. The example code of what I am working with that is listed below is from the h.php page and the contact_us.php page.

FILE: h.php
Code: [ Select ]

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="resource-type" content="document">
<meta name="Generator" content="Microsoft FrontPage 4.0">
<meta name="revisit-after" content="10">
<meta name="keywords" content="live, steam, miniature, small, scale, ho , o, gauge, laurel, run, lite, rail, railroad, model, rsme, reading, society, engineers, club, livesteam, literail,">
<meta name="rating" content="Safe For Kids">

<title>Reading Society of Model Engineers</title>
<base target="main">

<LINK REL=stylesheet TYPE="text/css" HREF=rsme.css>

<style type="text/css">

/*Example CSS for the two demo scrollers*/

#pscroller2{
width: 490px;
height: 25px;

padding: 3px;
background-color: #C0C0C0;
}

#pscroller2 a{
text-decoration: none;
}

.someclass{ //class
}

</style>

<script type="text/javascript">

/*Example message arrays for the two demo scrollers*/

var pausecontent2=new Array()
pausecontent2[0]='<center><a href="http://www.rsme.org/calendar/2012/oct.php">RSME Run Day October 7, 2012 12pm - 5pm</a></center>'
pausecontent2[1]='<center><a href="http://www.rsme.org/pdf/RSME_2012_OPEN_HOUSE_FLYER.pdf" target="window">RSME Fall Open House October 20 and 21, 2012 12pm - 5pm</a></center>'
pausecontent2[2]='<center><a href="http://www.rsme.org/calendar/2012/nov.php">RSME Run Day November 4, 2012 12pm - 5pm</a></center>'

</script>

<script type="text/javascript">

/***********************************************
SaveCancel* Pausing up-down scroller- ? Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}

// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}

</script>

</head>

<body topmargin="5">

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100">
 <tr>
   <td align="center" height="100" width="250" valign="top"><img src="http://www.rsme.org/images/rsmelogo.gif" width="178" height="88" align="center"></td>
   <td align="center" height="100" width="840" valign="top"><FONT SIZE="5"><B>Reading Society of Model Engineers</font></b><p>Berks County, Pennsylvania, USA<BR>
   <font size="2"><BR></font>
<!-- BEGIN NEWS FADER TEXT -->

<table width="139">
    <tr>
        <td align="centeR"><font color="red" size="4"><b><i>HOTBOX</i></b></font>
        </td>
    </tr>
    <tr>
        <td>
<script type="text/javascript">

new pausescroller(pausecontent2, "pscroller2", "someclass", 3600)

</script>
        </td>
    </tr>
</table>
<!-- END FADER -->
</p></td>
   <td align="center" height="100" width="250" valign="top"><img border="0" src="http://www.rsme.org/images/LITERAIL.gif" width="216" height="112" align="center"></td>
 </tr>
</table>
</center>
</p>

</body>

</html>
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  6. <meta name="ProgId" content="FrontPage.Editor.Document">
  7. <meta name="resource-type" content="document">
  8. <meta name="Generator" content="Microsoft FrontPage 4.0">
  9. <meta name="revisit-after" content="10">
  10. <meta name="keywords" content="live, steam, miniature, small, scale, ho , o, gauge, laurel, run, lite, rail, railroad, model, rsme, reading, society, engineers, club, livesteam, literail,">
  11. <meta name="rating" content="Safe For Kids">
  12. <title>Reading Society of Model Engineers</title>
  13. <base target="main">
  14. <LINK REL=stylesheet TYPE="text/css" HREF=rsme.css>
  15. <style type="text/css">
  16. /*Example CSS for the two demo scrollers*/
  17. #pscroller2{
  18. width: 490px;
  19. height: 25px;
  20. padding: 3px;
  21. background-color: #C0C0C0;
  22. }
  23. #pscroller2 a{
  24. text-decoration: none;
  25. }
  26. .someclass{ //class
  27. }
  28. </style>
  29. <script type="text/javascript">
  30. /*Example message arrays for the two demo scrollers*/
  31. var pausecontent2=new Array()
  32. pausecontent2[0]='<center><a href="http://www.rsme.org/calendar/2012/oct.php">RSME Run Day October 7, 2012 12pm - 5pm</a></center>'
  33. pausecontent2[1]='<center><a href="http://www.rsme.org/pdf/RSME_2012_OPEN_HOUSE_FLYER.pdf" target="window">RSME Fall Open House October 20 and 21, 2012 12pm - 5pm</a></center>'
  34. pausecontent2[2]='<center><a href="http://www.rsme.org/calendar/2012/nov.php">RSME Run Day November 4, 2012 12pm - 5pm</a></center>'
  35. </script>
  36. <script type="text/javascript">
  37. /***********************************************
  38. SaveCancel* Pausing up-down scroller- ? Dynamic Drive (www.dynamicdrive.com)
  39. * This notice MUST stay intact for legal use
  40. * Visit http://www.dynamicdrive.com/ for this script and 100s more.
  41. ***********************************************/
  42. function pausescroller(content, divId, divClass, delay){
  43. this.content=content //message array content
  44. this.tickerid=divId //ID of ticker div to display information
  45. this.delay=delay //Delay between msg change, in miliseconds.
  46. this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
  47. this.hiddendivpointer=1 //index of message array for hidden div
  48. document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
  49. var scrollerinstance=this
  50. if (window.addEventListener) //run onload in DOM2 browsers
  51. window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
  52. else if (window.attachEvent) //run onload in IE5.5+
  53. window.attachEvent("onload", function(){scrollerinstance.initialize()})
  54. else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
  55. setTimeout(function(){scrollerinstance.initialize()}, 500)
  56. }
  57. // -------------------------------------------------------------------
  58. // initialize()- Initialize scroller method.
  59. // -Get div objects, set initial positions, start up down animation
  60. // -------------------------------------------------------------------
  61. pausescroller.prototype.initialize=function(){
  62. this.tickerdiv=document.getElementById(this.tickerid)
  63. this.visiblediv=document.getElementById(this.tickerid+"1")
  64. this.hiddendiv=document.getElementById(this.tickerid+"2")
  65. this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
  66. //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
  67. this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
  68. this.getinline(this.visiblediv, this.hiddendiv)
  69. this.hiddendiv.style.visibility="visible"
  70. var scrollerinstance=this
  71. document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
  72. document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
  73. if (window.attachEvent) //Clean up loose references in IE
  74. window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
  75. setTimeout(function(){scrollerinstance.animateup()}, this.delay)
  76. }
  77. // -------------------------------------------------------------------
  78. // animateup()- Move the two inner divs of the scroller up and in sync
  79. // -------------------------------------------------------------------
  80. pausescroller.prototype.animateup=function(){
  81. var scrollerinstance=this
  82. if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
  83. this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
  84. this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
  85. setTimeout(function(){scrollerinstance.animateup()}, 50)
  86. }
  87. else{
  88. this.getinline(this.hiddendiv, this.visiblediv)
  89. this.swapdivs()
  90. setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
  91. }
  92. }
  93. // -------------------------------------------------------------------
  94. // swapdivs()- Swap between which is the visible and which is the hidden div
  95. // -------------------------------------------------------------------
  96. pausescroller.prototype.swapdivs=function(){
  97. var tempcontainer=this.visiblediv
  98. this.visiblediv=this.hiddendiv
  99. this.hiddendiv=tempcontainer
  100. }
  101. pausescroller.prototype.getinline=function(div1, div2){
  102. div1.style.top=this.visibledivtop+"px"
  103. div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
  104. }
  105. // -------------------------------------------------------------------
  106. // setmessage()- Populate the hidden div with the next message before it's visible
  107. // -------------------------------------------------------------------
  108. pausescroller.prototype.setmessage=function(){
  109. var scrollerinstance=this
  110. if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
  111. setTimeout(function(){scrollerinstance.setmessage()}, 100)
  112. else{
  113. var i=this.hiddendivpointer
  114. var ceiling=this.content.length
  115. this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
  116. this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
  117. this.animateup()
  118. }
  119. }
  120. pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
  121. if (tickerobj.currentStyle)
  122. return tickerobj.currentStyle["paddingTop"]
  123. else if (window.getComputedStyle) //if DOM2
  124. return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
  125. else
  126. return 0
  127. }
  128. </script>
  129. </head>
  130. <body topmargin="5">
  131. <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100">
  132.  <tr>
  133.    <td align="center" height="100" width="250" valign="top"><img src="http://www.rsme.org/images/rsmelogo.gif" width="178" height="88" align="center"></td>
  134.    <td align="center" height="100" width="840" valign="top"><FONT SIZE="5"><B>Reading Society of Model Engineers</font></b><p>Berks County, Pennsylvania, USA<BR>
  135.    <font size="2"><BR></font>
  136. <!-- BEGIN NEWS FADER TEXT -->
  137. <table width="139">
  138.     <tr>
  139.         <td align="centeR"><font color="red" size="4"><b><i>HOTBOX</i></b></font>
  140.         </td>
  141.     </tr>
  142.     <tr>
  143.         <td>
  144. <script type="text/javascript">
  145. new pausescroller(pausecontent2, "pscroller2", "someclass", 3600)
  146. </script>
  147.         </td>
  148.     </tr>
  149. </table>
  150. <!-- END FADER -->
  151. </p></td>
  152.    <td align="center" height="100" width="250" valign="top"><img border="0" src="http://www.rsme.org/images/LITERAIL.gif" width="216" height="112" align="center"></td>
  153.  </tr>
  154. </table>
  155. </center>
  156. </p>
  157. </body>
  158. </html>


FILE: contact_us.php
Code: [ Select ]

<?php

ob_start('ob_gzhandler');
session_start();
include 'contact_us_inc.php';
// if submit
if (($_POST[x])&&(substr($_SESSION[igif], 17) === $_SESSION['afloat'])){

// posted
$x = $_POST[x];

// decode, strip string and round numbers
$a = base64_decode($_SESSION['afloat']);
$b = 0 + $a;
$a = explode(" ", $a);
$a = $a[3];
$bb = round($b);
$aa = round($a);

// x coords
$gc = explode(" ", '0 19 40 60 82 104 79 100 121 142 163 185');

// check if correct number has been clicked
$ac = $aa + 6;
if ($bb <= $aa){ $ac = $bb + 1; }

//wrong number clicked error message below
$mess = "ERROR: Sorry " . $_POST[yname] . " wrong number clicked";
// if correct number clicked success
if (($x >= $gc[$ac-1]) && ($x <= $gc[$ac])){

// submit your form
$to = $owner_email;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


// Additional headers
$headers .= 'From:<' . $_POST[email] . '>' . $_POST[yname] . "\r\n";
$headers .= 'RSME General Contact Form Version 1.0' . "\r\n";

// Message content
$messages = '<br><br><b>Name:</b> ' . $_POST[yname] . '<p><B>E-mail:</b> ' . $_POST[email] . '<p><b>Comments:</b> <br>' . $_POST[message];

// Mail it    
mail($to, "RSME MAIL: General Contact Form", $messages, $headers);
$yname = $_POST[yname];
?>
<script>    
alert("Thank you <? echo $yname; ?> for your correspondance. We will be sure to get back to you soon!");
window.location = "<?=$redirect;?>";
</script> 
<? 
exit; }

//demo alert message below
?>
<script>    
alert("<?=$mess;?>");
window.location = window.location;
</script>
<?
session_unset();
session_destroy();
ob_end_flush();
exit;
}
// afloat = base64_encoded random string
$afloat = base64_encode(" " . $num1 = rand(0,3) . "." . $num2 = rand(100,999) . "
Float " . $num3 = rand(1,4) . "." . $num4 = rand(100,999) . " ");

// rectangle x coord

$aler = "> 78";
if(round($num1 . "." . $num2) <= round($num3 . "." . $num4)) {$aler = "< 105";}

// create random image
$_SESSION[igif] = "create_gif.php?a=" . $afloat . "";
$_SESSION['afloat'] = $afloat;

?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="resource-type" content="document">
<meta name="Generator" content="rsmeorga Tag Generator">
<meta name="revisit-after" content="10">
<meta name="keywords" content="live, steam, miniature, small, scale, ho , o, gauge, laurel, run, lite, rail, railroad, model, rsme, reading, society, engineers, club, livesteam, literail,">
<meta name="rating" content="Safe For Kids">

<title>Reading Society of Model Engineers</title>


<LINK REL=stylesheet TYPE="text/css" HREF=../rsme.css>

<style type="text/css">
/* click image */
.cd {
width: 185px;
height: 15px;
background-image: url(<?=$_SESSION[igif];?>);
background-repeat: no-repeat;
position: relative;
left:<?=rand(-100,100);?>px;
bottom:<?=rand(-5,20);?>px;
z-index: 2;
}
</style>
<script language="JavaScript">
// submit form func val i date
function submitform() {

if (document.xcoords.yname.value == "") {
alert("Please Enter Your Name.");
return false; }
if (document.xcoords.email.value == "" || document.xcoords.email.value.indexOf("@")<1|| document.xcoords.email.value.indexOf(".")<1) {
alert("Please Enter Valid E-mail");
return false;}
if (document.xcoords.message.value == "") {
alert("Please Enter Question/Message.");
return false; } 

// if box coord submit else rectangle coord alert
// Do not edit javascript below this line. you can edit the alert message

if (document.xcoords.x.value <?=$aler;?>) {
document.xcoords.submit();

} else {
alert("Click number in square identicale to number in rectangle to submit.");
}
}
// image x value
function xcoord(event) {
image = event.offsetX?(event.offsetX):event.pageX-document.getElementById("coord").offsetLeft;
document.xcoords.x.value = image;
}
</script>

</head>

<body text="black" bgcolor="#C0C0C0" topmargin="5">

<?php include("../h.php"); ?>

<p align="left">The RSME is pleased to announce that we now have a general contact form setup on our website. You can now use this form to request general information about the RSME. We thank you for your patients while we created this section of the site. You can also click on the officers link to the left and select a specific officer or committee chairman to contact. We still have our traditional means of communication via the telephone or by writing us a letter and dropping it in the mail. No matter which route you choose to contact us we certainly look forward to hearing from you!</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
 <tr>
  <td width="33%" align="center" valign="top"><b>United States Postal Service</b></td>
  <td width="33%" align="center" valign="top"><b>Club House Phone<br>
  (please leave a message)</b></td>
  <td width="34%" align="center" valign="top"><b>Online contact form</b></td>
 </tr>
 <tr>
  <td width="33%" align="center" valign="top"><br>Reading Society of Model Engineers<br>
  P.O. Box 13011<br>
  Reading, PA 19612</td>
  <td width="33%" align="center" valign="top"><br>Phone Number: 610-929-5444</td>
  <td width="34%" align="center">
  
  <table summary="" border="0">
<form name="xcoords" action="<?=$_SERVER['PHP_SELF']; ?>" method="post">
    <tr>
        <td valign="top">Name: </td><td><input type="text" name="yname" size="40" maxlength="256" style="border: 1px solid <?=$bordercolor;?>"><br><br>
        </td>
    </tr>
    <tr>
        <td valign="top">E-Mail: </td><td><input type="text" name="email" size="40" maxlength="256" style="border: 1px solid <?=$bordercolor;?>"><br><br>
        </td>
    </tr>
    <tr>
        <td valign="top">Comments: </td><td><textarea name="message" cols="30" rows="7" style="border: 1px solid <?=$bordercolor;?>; background: #F5F5F5"></textarea>
<input type="hidden" name="x" /> </td>
    </tr>
<tr><td colspan=2 style="font: 11px Arial; color: <?=$bordercolor;?>; border-color: <?=$bordercolor;?>; border-style: solid; border-width: 1px; background: #F8F8FF; height: 30px; width: 310px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; position: relative; font-weight: normal;">To submit this form to the Reading Society of Model Engineers. Please click the number that is presented to you on the right side of the word "click".</td>
</table></form><p><div id="coord" onClick="submitform(xcoord(event))" class="cd"></div></div><p></div>
  
  </td>
 </tr>
</table>

</body>

</html>
<?php ob_end_flush(); ?>
  1. <?php
  2. ob_start('ob_gzhandler');
  3. session_start();
  4. include 'contact_us_inc.php';
  5. // if submit
  6. if (($_POST[x])&&(substr($_SESSION[igif], 17) === $_SESSION['afloat'])){
  7. // posted
  8. $x = $_POST[x];
  9. // decode, strip string and round numbers
  10. $a = base64_decode($_SESSION['afloat']);
  11. $b = 0 + $a;
  12. $a = explode(" ", $a);
  13. $a = $a[3];
  14. $bb = round($b);
  15. $aa = round($a);
  16. // x coords
  17. $gc = explode(" ", '0 19 40 60 82 104 79 100 121 142 163 185');
  18. // check if correct number has been clicked
  19. $ac = $aa + 6;
  20. if ($bb <= $aa){ $ac = $bb + 1; }
  21. //wrong number clicked error message below
  22. $mess = "ERROR: Sorry " . $_POST[yname] . " wrong number clicked";
  23. // if correct number clicked success
  24. if (($x >= $gc[$ac-1]) && ($x <= $gc[$ac])){
  25. // submit your form
  26. $to = $owner_email;
  27. $headers = 'MIME-Version: 1.0' . "\r\n";
  28. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  29. // Additional headers
  30. $headers .= 'From:<' . $_POST[email] . '>' . $_POST[yname] . "\r\n";
  31. $headers .= 'RSME General Contact Form Version 1.0' . "\r\n";
  32. // Message content
  33. $messages = '<br><br><b>Name:</b> ' . $_POST[yname] . '<p><B>E-mail:</b> ' . $_POST[email] . '<p><b>Comments:</b> <br>' . $_POST[message];
  34. // Mail it    
  35. mail($to, "RSME MAIL: General Contact Form", $messages, $headers);
  36. $yname = $_POST[yname];
  37. ?>
  38. <script>    
  39. alert("Thank you <? echo $yname; ?> for your correspondance. We will be sure to get back to you soon!");
  40. window.location = "<?=$redirect;?>";
  41. </script> 
  42. <? 
  43. exit; }
  44. //demo alert message below
  45. ?>
  46. <script>    
  47. alert("<?=$mess;?>");
  48. window.location = window.location;
  49. </script>
  50. <?
  51. session_unset();
  52. session_destroy();
  53. ob_end_flush();
  54. exit;
  55. }
  56. // afloat = base64_encoded random string
  57. $afloat = base64_encode(" " . $num1 = rand(0,3) . "." . $num2 = rand(100,999) . "
  58. Float " . $num3 = rand(1,4) . "." . $num4 = rand(100,999) . " ");
  59. // rectangle x coord
  60. $aler = "> 78";
  61. if(round($num1 . "." . $num2) <= round($num3 . "." . $num4)) {$aler = "< 105";}
  62. // create random image
  63. $_SESSION[igif] = "create_gif.php?a=" . $afloat . "";
  64. $_SESSION['afloat'] = $afloat;
  65. ?>
  66. <html>
  67. <head>
  68. <meta http-equiv="Content-Language" content="en-us">
  69. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  70. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  71. <meta name="ProgId" content="FrontPage.Editor.Document">
  72. <meta name="resource-type" content="document">
  73. <meta name="Generator" content="rsmeorga Tag Generator">
  74. <meta name="revisit-after" content="10">
  75. <meta name="keywords" content="live, steam, miniature, small, scale, ho , o, gauge, laurel, run, lite, rail, railroad, model, rsme, reading, society, engineers, club, livesteam, literail,">
  76. <meta name="rating" content="Safe For Kids">
  77. <title>Reading Society of Model Engineers</title>
  78. <LINK REL=stylesheet TYPE="text/css" HREF=../rsme.css>
  79. <style type="text/css">
  80. /* click image */
  81. .cd {
  82. width: 185px;
  83. height: 15px;
  84. background-image: url(<?=$_SESSION[igif];?>);
  85. background-repeat: no-repeat;
  86. position: relative;
  87. left:<?=rand(-100,100);?>px;
  88. bottom:<?=rand(-5,20);?>px;
  89. z-index: 2;
  90. }
  91. </style>
  92. <script language="JavaScript">
  93. // submit form func val i date
  94. function submitform() {
  95. if (document.xcoords.yname.value == "") {
  96. alert("Please Enter Your Name.");
  97. return false; }
  98. if (document.xcoords.email.value == "" || document.xcoords.email.value.indexOf("@")<1|| document.xcoords.email.value.indexOf(".")<1) {
  99. alert("Please Enter Valid E-mail");
  100. return false;}
  101. if (document.xcoords.message.value == "") {
  102. alert("Please Enter Question/Message.");
  103. return false; } 
  104. // if box coord submit else rectangle coord alert
  105. // Do not edit javascript below this line. you can edit the alert message
  106. if (document.xcoords.x.value <?=$aler;?>) {
  107. document.xcoords.submit();
  108. } else {
  109. alert("Click number in square identicale to number in rectangle to submit.");
  110. }
  111. }
  112. // image x value
  113. function xcoord(event) {
  114. image = event.offsetX?(event.offsetX):event.pageX-document.getElementById("coord").offsetLeft;
  115. document.xcoords.x.value = image;
  116. }
  117. </script>
  118. </head>
  119. <body text="black" bgcolor="#C0C0C0" topmargin="5">
  120. <?php include("../h.php"); ?>
  121. <p align="left">The RSME is pleased to announce that we now have a general contact form setup on our website. You can now use this form to request general information about the RSME. We thank you for your patients while we created this section of the site. You can also click on the officers link to the left and select a specific officer or committee chairman to contact. We still have our traditional means of communication via the telephone or by writing us a letter and dropping it in the mail. No matter which route you choose to contact us we certainly look forward to hearing from you!</p>
  122. <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  123.  <tr>
  124.   <td width="33%" align="center" valign="top"><b>United States Postal Service</b></td>
  125.   <td width="33%" align="center" valign="top"><b>Club House Phone<br>
  126.   (please leave a message)</b></td>
  127.   <td width="34%" align="center" valign="top"><b>Online contact form</b></td>
  128.  </tr>
  129.  <tr>
  130.   <td width="33%" align="center" valign="top"><br>Reading Society of Model Engineers<br>
  131.   P.O. Box 13011<br>
  132.   Reading, PA 19612</td>
  133.   <td width="33%" align="center" valign="top"><br>Phone Number: 610-929-5444</td>
  134.   <td width="34%" align="center">
  135.   
  136.   <table summary="" border="0">
  137. <form name="xcoords" action="<?=$_SERVER['PHP_SELF']; ?>" method="post">
  138.     <tr>
  139.         <td valign="top">Name: </td><td><input type="text" name="yname" size="40" maxlength="256" style="border: 1px solid <?=$bordercolor;?>"><br><br>
  140.         </td>
  141.     </tr>
  142.     <tr>
  143.         <td valign="top">E-Mail: </td><td><input type="text" name="email" size="40" maxlength="256" style="border: 1px solid <?=$bordercolor;?>"><br><br>
  144.         </td>
  145.     </tr>
  146.     <tr>
  147.         <td valign="top">Comments: </td><td><textarea name="message" cols="30" rows="7" style="border: 1px solid <?=$bordercolor;?>; background: #F5F5F5"></textarea>
  148. <input type="hidden" name="x" /> </td>
  149.     </tr>
  150. <tr><td colspan=2 style="font: 11px Arial; color: <?=$bordercolor;?>; border-color: <?=$bordercolor;?>; border-style: solid; border-width: 1px; background: #F8F8FF; height: 30px; width: 310px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; position: relative; font-weight: normal;">To submit this form to the Reading Society of Model Engineers. Please click the number that is presented to you on the right side of the word "click".</td>
  151. </table></form><p><div id="coord" onClick="submitform(xcoord(event))" class="cd"></div></div><p></div>
  152.   
  153.   </td>
  154.  </tr>
  155. </table>
  156. </body>
  157. </html>
  158. <?php ob_end_flush(); ?>


I would like to thank everyone for any and all help I can get on this in advance.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 414

Post 3+ Months Ago

OK so I see a couple things one thing is with include files you don't need to make it like its own separate page. Only include what is needed.

Bad example (what your currently doing)
h.php
HTML Code: [ Select ]
<html>
    <head>
        <title>Hotbox</title>
    <head>
    <body>
    Some content
    </body>
</html>
 
  1. <html>
  2.     <head>
  3.         <title>Hotbox</title>
  4.     <head>
  5.     <body>
  6.     Some content
  7.     </body>
  8. </html>
  9.  


contact_us.php
HTML Code: [ Select ]
<html>
    <head>
        <title>Contact Us</title>
    <head>
    <body>
    <?php include("../h.php"); ?>
    Some content For the contact page
    </body>
</html>
 
  1. <html>
  2.     <head>
  3.         <title>Contact Us</title>
  4.     <head>
  5.     <body>
  6.     <?php include("../h.php"); ?>
  7.     Some content For the contact page
  8.     </body>
  9. </html>
  10.  


Output (what gets built)
HTML Code: [ Select ]
<html>
    <head>
        <title>Contact Us</title>
    <head>
    <body>
    <html>
        <head>
            <title>Hotbox</title>
        <head>
        <body>
        Some content
        </body>
    </html>
    Some content For the contact page
    </body>
</html>
 
  1. <html>
  2.     <head>
  3.         <title>Contact Us</title>
  4.     <head>
  5.     <body>
  6.     <html>
  7.         <head>
  8.             <title>Hotbox</title>
  9.         <head>
  10.         <body>
  11.         Some content
  12.         </body>
  13.     </html>
  14.     Some content For the contact page
  15.     </body>
  16. </html>
  17.  



Good example
h.php
HTML Code: [ Select ]
Some Content
 
  1. Some Content
  2.  


contact_us.php
HTML Code: [ Select ]
<html>
    <head>
        <title>Contact Us</title>
    <head>
    <body>
    <?php include("../h.php"); ?>
    Some content For the contact page
    </body>
</html>
 
  1. <html>
  2.     <head>
  3.         <title>Contact Us</title>
  4.     <head>
  5.     <body>
  6.     <?php include("../h.php"); ?>
  7.     Some content For the contact page
  8.     </body>
  9. </html>
  10.  


Output (what gets built)
HTML Code: [ Select ]
<html>
    <head>
        <title>Contact Us</title>
    <head>
    <body>
    Some Content
    Some content For the contact page
    </body>
</html>
 
  1. <html>
  2.     <head>
  3.         <title>Contact Us</title>
  4.     <head>
  5.     <body>
  6.     Some Content
  7.     Some content For the contact page
  8.     </body>
  9. </html>
  10.  


and the other is that your looking for h.php here http://rsme.org/h.php where it doesn't exists the file sits here http://rsme.org/beta3/h.php so the correct include statement would be
PHP Code: [ Select ]
<?php include("h.php"); ?>
 
  1. <?php include("h.php"); ?>
  2.  
  • RSMEDUDE
  • Novice
  • Novice
  • User avatar
  • Posts: 33

Post 3+ Months Ago

Hi ScottG,

Thanks for the reply. I see what you mean by having too much information out in the include file (h.php). This was my first attempt at doing this and since I did not run into any issues on the initial files I did not think this would cause an issue. With that being said what you are showing me here makes sense to me.

I did make the change to the include file so that only the code necessary to make the information work is there. I then uploaded the file again and made sure it still worked on the pages that it was previously working on. This checked out as good.

I then looked at making the change to the content file (contact_us.php). The only thing that holds me up from changing that is the fact that I have this file in a subfolder. I am trying to write everything in the sense that the beta3 folder is the root directory. With that being said the contact_us.php file is actually located in a folder called forms. The directory structure looks like this (%root%/beta3/forms). The h.php file is held in the beta3 directory which is supposed to be acting like the root directory for testing purposes. There for as I understand things I need to tell the coding to look back one directory to find h.php. Does this make sense? So I made sure once again that the include line looked right on contact_us.php but I am still getting the same stuff. I did purge my cache and all that happy jazz. I do not see how by typing ../h.php would make it go all the way back to the "real" root directory (http://www.rsme.org) where the active website is running. Am I missing something there?

I can post new coding if actually needed!
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 414

Post 3+ Months Ago

The reason this seems odd is your use of frames i used the information i had at hand to come to the conclusion where the file was sitting and it appeared to be sitting in the beta3 folder that is why i stated that ../ would take you up one level or to your root. with that being said the link for the contact us page is http://rsme.org/forms/contact_us.php and not http://rsme.org/beta3/forms/contact_us.php since I stay away from the use of frames having ../ on the contact page would take you to the the beta3 folder if you directly went to http://rsme.org/beta3/forms/contact_us.php

I haven't used frames, Oh in about 10+ years so i don't know if there would be a scope issue with out testing for it which i could do when i get to work tomorrow or should i say today
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 414

Post 3+ Months Ago

So I've built my test and it seem to work like it should and go from the forms folder to the beta3 folder to find h.php. So please post your current code so further testing can be done.
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 414

Post 3+ Months Ago

I also couldn't help but notice the rest of the site also has multiple head and body tags not sure if on all pages or not but something to look in to.

I have seen a lot of broken and deprecated tags being used just in the main page.

I'm going to include my test project. I also threw together a quick mockup of your site with out using frames based on the file structure I use in all of my projects.

I put the most work in to the index page getting rid of all of the deprecated tags and broken tags. I made place holder pages for most the other pages except for the guess book, photo gallery, calendar and the whats new pages due to the folder structure you have set up. You can use the frame less setup if you want or continue using frames its your call.

This didn't take me long to make so if you continue to use the frames it is completely fine.
Attachments:
no_frame.zip

(226.47 KiB) Downloaded 38 times

Attachments:
frame_test.zip

(2.1 KiB) Downloaded 41 times

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 80 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.