help php script

Looking for volunteers to join your project? Need help with a script but can't afford to pay? Want to offer your services as a volunteer to build up your portfolio? This is the place for you...

Moderator: General Moderators

Post Reply
jdimino
Forum Newbie
Posts: 6
Joined: Sat Dec 31, 2005 2:28 pm

help php script

Post by jdimino »

Hello

Need your help, I have an existing script that uses a text database with a built in search engine, currently the script works like this, you type-in the first array and hit the find button. The results will be displayed in a family tree form, I would like to change this script so that instead of entering the first array, it should be able to read the first array from a separate database and display the results in a slideshow with time laps, play, stop, next, and previous button.
Is anyone willing to help me? I can send you the php script.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Is the code too long to post here?

can you show us the example, so I can be sure I followed your description right? Is there an example of what you want to acheive? I won't write the code for you but I'll show you what to do
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Moved to Volunteer work forum.
jdimino
Forum Newbie
Posts: 6
Joined: Sat Dec 31, 2005 2:28 pm

Post by jdimino »

Hi

This is the full code, I want to replace the search box with read from another database. once the new array is read, the rest should stay the same.
then add the play, stop, next for a slideshow presentation.
I want to honest, I'm not sure if I can handle to follow you, to write the new code, but I can give it a try.
Thanks

Code: Select all

<?PHP
if(isset($_POST['Search_box'])){
	$file = stripslashes($_POST['Search_box']);
	$fp = file("reg.txt");
	$cultivar = array();
	$mother = array();
	$father = array();
	$hybridiser = array();
	$origin = array();
	$find = array();
	$fine["hybridiser"] = "";
	$fine["origin"] = "";
	$find["father"] = "";
	$find["grandmother1"] = "";
	$find["greatgrandmother1"] = "";
	$find["greatgrandfather1"] = "";
	$find["grandfather1"] = "";
	$find["greatgrandmother2"] = "";
	$find["greatgrandfather2"] = "";
	
	$find["mother"] = "";
	$find["grandmother2"] = "";
	$find["greatgrandmother3"] = "";
	$find["greatgrandfather3"] = "";
	$find["grandfather2"] = "";
	$find["greatgrandmother4"] = "";
	$find["greatgrandfather4"] = "";
	
	for($x=0; $x<count($fp); $x++){
		$split = split("\|",$fp[$x]);
		$cultivar[$x] = $split[0];
		$mother[$x] = $split[1];
		$father[$x] = $split[2];
		$hybridiser[$x] = $split[3];
		$origin[$x] = $split[4];
	}
	$found=false;
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($file)){
			$find["father"] = $father[$x];
			$find["mother"] = $mother[$x];
			$fine["origin"] = $origin[$x];
			$fine["hybridiser"] = $hybridiser[$x];
			$found=true;
			break;
		}
	}
	if($found){
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($find["father"])){
			$find["grandfather1"] = $father[$x];
			$find["grandmother1"] = $mother[$x];
			break;
		}
	}
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($find["grandfather1"])){
			$find["greatgrandfather1"] = $father[$x];
			$find["greatgrandmother1"] = $mother[$x];
			break;
		}
	}
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($find["grandmother1"])){
			$find["greatgrandfather2"] = $father[$x];
			$find["greatgrandmother2"] = $mother[$x];
			break;
		}
	}
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($find["mother"])){
			$find["grandfather2"] = $father[$x];
			$find["grandmother2"] = $mother[$x];
			break;
		}
	}
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($find["grandfather2"])){
			$find["greatgrandfather3"] = $father[$x];
			$find["greatgrandmother3"] = $mother[$x];
			break;
		}
	}
	for($x=1; $x<count($cultivar); $x++){
		if(strtolower($cultivar[$x]) == strtolower($find["grandmother2"])){
			$find["greatgrandfather4"] = $father[$x];
			$find["greatgrandmother4"] = $mother[$x];
			break;
		}
	}
	}
}
?>
<html>
<head>
<title>The Global Hibiscus Genealogy Family Tree</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function show_remote(imageSrc){
	OpenWindow = window.open("cvdata.php?search="+imageSrc.substring(0,imageSrc.length-4)+"", "remoteWin", "resizable=1, scrollbars=1, toolbar=1, left=0, top=0, width=800, height=390");
	/*OpenWindow.document.write('<img width="250" height="250" src="'+imageSrc+'"><br>');
	OpenWindow.document.write('<div align="center"><strong>'+imageSrc.split('.')[0]+'</strong><br>');
	OpenWindow.document.write('<a href="javascript:window.close();">Close Window</a></div>');
	*/
	
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

</head>

<body bgcolor="#FFFFFF" onLoad="MM_preloadImages('Slideshow_file/st2.gif','Slideshow_file/rw2.gif','Slideshow_file/ff2.gif','Slideshow_file/pl2.gif')">
<div align="center"><b><font size="6">SlideShow </font></b> 
  <form action="<?PHP echo $_SERVER['PHP_SELF']; ?>" method="POST">
    <input type=text name="Search_box"> <input type=submit value="Search!" name="submit">
      <br>
      <table bgcolor=ffffff border=0 cellpadding=4 cellspacing=0 width=100%>
        <tr> 
          
        <td width=200 valign=middle nowrap height="13"> <em id="pem" style="font-style: normal; font-family: arial,helvetica"></em> 
        </td>
          
        <td align=center width=300 height="13"> <a href="javascript:play()" style="text-decoration: none"> 
          </a><a href="javascript:play()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image20','','Slideshow_file/pl2.gif',1)"> 
          <img name="playbtn" border="0" src="Slideshow_file/pl1.gif" width="30" height="19" alt="Play"></a><a href="javascript:play()" style="text-decoration: none"> 
          </a> &nbsp; <a href="javascript:stop()" style="text-decoration: none"> 
          </a><a href="javascript:stop()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image21','','Slideshow_file/st2.gif',1)"><img name="stopbtn" border="0" src="Slideshow_file/st1.gif" width="30" height="19" alt="Stop"></a><a href="javascript:stop()" style="text-decoration: none"> 
          </a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="javascript:setButton(0); rewind();" style="text-decoration: none"> 
          </a><a href="javascript:setButton(0); rewind();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image21','','Slideshow_file/rw2.gif',1)"><img name="prevbtn" border="0" src="Slideshow_file/rw1.gif" width="30" height="19" alt="Previous"></a><a href="javascript:setButton(0); rewind();" style="text-decoration: none"> 
          </a> &nbsp; <a href="javascript:setButton(1); forward();" style="text-decoration: none"> 
          </a><a href="javascript:setButton(1); forward();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image21','','Slideshow_file/ff2.gif',1)"><img name="fowdbtn" border="0" src="Slideshow_file/ff1.gif" width="30" height="19" alt="Next"></a><a href="javascript:setButton(1); forward();" style="text-decoration: none"> 
          </a> </td>
          
        <td align=right width=200 valign=top height="13"><font face="Arial,Helvetica"  size="-1">Speed: 
          </font> 
          <select name="speedMenu" onChange="changeSpeed();">
              <option><font face="Arial,Helvetica"  size="-1">Slow</font> 
              <option selected><font face="Arial,Helvetica"  size="-1">Normal</font> 
              <option><font face="Arial,Helvetica"  size="-1">Fast</font> 
            </select>
          </td>
        </tr>
      </table>
  </form>
  <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" background="Slideshow_file/slideback.jpg">
    <TR valign="top"> 
      <TD height="491"> 
        <table width="100%" border="0" cellspacing="2" cellpadding="2" height="160">
          <tr> 
            <td height="91" width="42%" valign="middle"> 
              <div align="center"><b><br>
                </b> 
                <table width="80" border="1" height="72" bgcolor="#FF0033">
                  <tr bgcolor="#FFFFFF"> 
                    <td width="74" height="38"> 
                      <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["mother"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["mother"].".jpg"; ?>"></a></div>
                    </td>
                  </tr>
                </table>
                <b><?php echo $find["mother"]."&nbsp;"; ?></b></div>
            </td>
            <td height="91" width="14%" valign="top"> 
              <table width="117" border="1" height="107" bgcolor="#CC9900">
                <tr> 
                  <td height="73"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($file).".jpg"; ?>');"><img width="120" src="<?php echo $file.".jpg"; ?>" height="120"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $file."&nbsp;"; ?></b></div>
            </td>
            <td height="91" valign="middle" width="44%"> 
              <div align="center"><b><br>
                </b> 
                <table width="81" border="1" height="79" bgcolor="#FF0033">
                  <tr bgcolor="#FFFFFF"> 
                    <td width="71"> 
                      <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["father"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["father"].".jpg"; ?>"></a></div>
                    </td>
                  </tr>
                </table>
                <b><?php echo $find["father"]."&nbsp;"; ?></b></div>
            </td>
          </tr>
        </table>
        <TABLE WIDTH="779" BORDER="0" CELLPADDING="0" CELLSPACING="0">
          <TR> 
            <TD WIDTH="22" HEIGHT="66" VALIGN="TOP" ALIGN="right">&nbsp; </TD>
            <TD WIDTH="137" HEIGHT="66" VALIGN="TOP" ALIGN="right"> <br>
              <table width="89" border="1" height="65" bgcolor="#3333FF" align="center">
                <tr bgcolor="#FFFFFF"> 
                  <td width="117" height="42"> 
                    <div align="center"><b><a href="javascript:show_remote('<?php echo addslashes($find["grandmother2"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["grandmother2"].".jpg"; ?>" border="0"></a></b></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["grandmother2"]."&nbsp;"; ?></b> 
              </div>
            </TD>
            <TD ALIGN="RIGHT" VALIGN="top" WIDTH="121" HEIGHT="66"> 
              <DIV ALIGN="LEFT"><br>
                <TABLE WIDTH="74" BORDER="1" HEIGHT="52" ALIGN="center" BGCOLOR="#3333FF">
                  <TR> 
                    <TD WIDTH="59"> 
                      <DIV ALIGN="center"><b><A HREF="javascript:show_remote('<?php echo addslashes($find["grandfather2"]).".jpg"; ?>');"><IMG WIDTH="80" HEIGHT="80" SRC="<?PHP echo $find["grandfather2"].".jpg"; ?>" BORDER="0"></A></b></DIV>
                    </TD>
                  </TR>
                </TABLE>
                
              </DIV>
              <div align="center"><b><?php echo $find["grandfather2"]."&nbsp;"; ?></b></div>
            </TD>
            <TD ALIGN="left" VALIGN="top" WIDTH="203" HEIGHT="66"> 
              <div align="center"><font size="3"><b><font size="2"><?PHP echo "Hybridiser: ".$fine["hybridiser"]."<br>"; ?> 
                <?PHP echo "Origin: ".$fine["origin"]; ?></font></b></font> </div>
            </TD>
            <TD WIDTH="134" HEIGHT="66" VALIGN="top" ALIGN="RIGHT"> 
              <div align="center"><br>
                <TABLE WIDTH="89" BORDER="1" HEIGHT="71" ALIGN="center" BGCOLOR="#3333FF">
                  <TR BGCOLOR="#FFFFFF"> 
                    <TD WIDTH="82"> 
                      <DIV ALIGN="center"><A HREF="javascript:show_remote('<?php echo addslashes($find["grandmother1"]).".jpg"; ?>');"><IMG WIDTH="80" HEIGHT="80" SRC="<?PHP echo $find["grandmother1"].".jpg"; ?>" BORDER="0"></A></DIV>
                    </TD>
                  </TR>
                </TABLE>
                <b><?php echo $find["grandmother1"]."&nbsp;"; ?> </b></div>
            </TD>
            <TD WIDTH="123" HEIGHT="66" VALIGN="top" ALIGN="left"> <br>
              <table width="88" border="1" height="66" bgcolor="#3333FF" align="center">
                <tr bgcolor="#FFFFFF"> 
                  <td width="71"> 
                    <div align="center"><b><a href="javascript:show_remote('<?php echo addslashes($find["grandfather1"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["grandfather1"].".jpg"; ?>" border="0"></a></b></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["grandfather1"]."&nbsp;"; ?></b></div>
            </TD>
            <TD WIDTH="39" HEIGHT="66" VALIGN="top" ALIGN="left">&nbsp;</TD>
          </TR>
        </TABLE>
        <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
          <TR> 
            <TD WIDTH="95" HEIGHT="90" VALIGN="top" ALIGN="right"><BR>
            </TD>
            <TD WIDTH="120" HEIGHT="90" VALIGN="top" ALIGN="right"> <b><br>
              </b> <br>
              <table width="88" height="52" bgcolor="#009900" align="center" border="1">
                <tr bgcolor="#FFFFFF"> 
                  <td width="65" height="27"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandmother3"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandmother3"].".jpg"; ?>" border="0"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["greatgrandmother3"]."&nbsp;"; ?></b><br>
              </div>
              </TD>
            <TD ALIGN="left" VALIGN="top" WIDTH="120" HEIGHT="90"> 
              <div align="center"><b><BR>
                </b> <br>
                <table width="81" border="1" height="56" bgcolor="#009933">
                  <tr bgcolor="#FFFFFF"> 
                    <td width="79" height="4"> 
                      <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandfather3"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandfather3"].".jpg"; ?>" border="0"></a></div>
                    </td>
                  </tr>
                </table>
                <b><?php echo $find["greatgrandfather3"]."&nbsp;"; ?> </b></div>
            </TD>
            <TD ALIGN="left" VALIGN="top" COLSPAN="4" HEIGHT="90">&nbsp;</TD>
            <TD WIDTH="120" HEIGHT="90" VALIGN="top" ALIGN="left"><b><BR>
              </b> <br>
              <table width="84" border="1" height="64" bgcolor="#009933" align="center">
                <tr bgcolor="#FFFFFF"> 
                  <td width="71" height="11"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandmother2"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandmother2"].".jpg"; ?>" border="0"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["greatgrandmother2"]."&nbsp;"; ?> 
                </b></div>
            </TD>
            <TD WIDTH="120" HEIGHT="90" VALIGN="top" ALIGN="left"> 
              <div align="center"><b><BR>
                </b> <br>
                <table width="84" border="1" height="55" bgcolor="#009933">
                  <tr bgcolor="#FFFFFF"> 
                    <td width="68" height="48"> 
                      <div align="center"><b><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandfather2"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandfather2"].".jpg"; ?>" border="0"></a></b></div>
                    </td>
                  </tr>
                </table>
                <b><?php echo $find["greatgrandfather2"]."&nbsp;"; ?> </b></div>
            </TD>
            <TD WIDTH="106" HEIGHT="90" VALIGN="top" ALIGN="left">&nbsp;</TD>
          </TR>
        </TABLE>
        <TABLE WIDTH="779" cellpadding="0" cellspacing="0" border="0">
          <TR> 
            <TD COLSPAN="2" HEIGHT="72" VALIGN="top" ALIGN="right"> 
              <div align="center"></div>
            </TD>
            <TD width="131" HEIGHT="72" VALIGN="top" ALIGN="right"><b><br>
              </b> <br>
              <table width="86" border="1" height="73" bgcolor="#FFFF33" align="center">
                <tr bgcolor="#FFFFFF"> 
                  <td width="72" height="44"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandfather4"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandfather4"].".jpg"; ?>" border="0"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["greatgrandmother4"]."&nbsp;"; ?></b></div>
            </TD>
            <TD WIDTH="121" HEIGHT="72" VALIGN="top" ALIGN="left"><b><BR>
              </b> <br>
              <table width="88" border="1" height="81" bgcolor="#FFFF33" align="center">
                <tr bordercolor="#009933" bgcolor="#FFFFFF"> 
                  <td width="78" height="15"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandmother4"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandmother4"].".jpg"; ?>" border="0"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["greatgrandfather4"]."&nbsp;"; ?></b></div>
            </TD>
            <TD WIDTH="218" HEIGHT="72" VALIGN="top" ALIGN="left">&nbsp;</TD>
            <TD WIDTH="127" HEIGHT="72" VALIGN="top" ALIGN="left" BORDERCOLOR="#009933"><b><BR>
              </b> <br>
              <table width="80" border="1" height="80" bgcolor="#FFFF33" align="center">
                <tr bgcolor="#FFFFFF"> 
                  <td width="191"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandmother1"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandmother1"].".jpg"; ?>" border="0"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["greatgrandmother1"]."&nbsp;"; ?></b></div>
            </TD>
            <TD HEIGHT="72" VALIGN="top" ALIGN="left" WIDTH="120"> 
              <DIV ALIGN="center"></DIV>
              <b><BR>
              </b> <br>
              <table width="85" border="1" height="72" align="center" bgcolor="#FFFF33">
                <tr bgcolor="#FFFFFF"> 
                  <td width="79" height="34"> 
                    <div align="center"><a href="javascript:show_remote('<?php echo addslashes($find["greatgrandfather1"]).".jpg"; ?>');"><img width="80" height="80" src="<?PHP echo $find["greatgrandfather1"].".jpg"; ?>" border="0"></a></div>
                  </td>
                </tr>
              </table>
              <div align="center"><b><?php echo $find["greatgrandfather1"]."&nbsp;"; ?></b></div>
            </TD>
            <TD HEIGHT="72" VALIGN="top" ALIGN="left" WIDTH="33">&nbsp;</TD>
          </TR>
        </TABLE>
      </TD>
    </TR>
  </TABLE>
  <br>
  <font size="2"><b><font face="Trebuchet MS"> <br>
  <!-- Begin Sparklit Counter Code --> 
  <script language="JavaScript">
jsurl = "http://counter.sparklit.com/counter_js.spark";
document.write("<SCRIPT LANGUAGE=\"JavaScript\" ");
document.write(" src=\""+ jsurl + "?ID=240882");
document.writeln("&c=" + Math.random()*10000 + "\">\n<\/SCRIPT>");
</script>
  <!-- End Sparklit Counter Code --> </font></b></font> </div>
</body>
</html>
Burrito: Please use [ php ] tags when posting code in the forum.
Post Reply