Jump to content

Some Help Please


jkewlo

Recommended Posts

Maybe you could store each page in a session variable, an array of pages. So you'd put this on each page:

 

session_start();
if (!isset($_SESSION['page_history'])) { $_SESSION['page_history'] = array(); } // Make the array if it hasn't been made
array_push($_SESSION['page_history'], 'Index | http://site.com/index.php'); // Push the current page's title and URL to the array
if (count($_SESSION['page_history'] > 5)) { array_shift($_SESSION['page_history']); } // If the array is getting too long, shorten it

 

And to display the breadcrumbs:

 

function display_breadcrumbs() {
     foreach ($_SESSION['page_history'] as $page) {
          $page_parts = explode(' | ', $page);
          echo '<a href="'.$page_parts[1].'">'.$page_parts[0].'</a> > ';
     }     
}

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495374
Share on other sites

You type the name of it, put the arguments inside parentheses, and put a semicolon. If there are no arguments you put a left and right parentheses without anything in them. Then the code inside the function will be executed. So wherever you put this:

 

display_breadcrumbs();

 

The list of links will be displayed.

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495429
Share on other sites

Still dosnt show anything.

 

wonder why that is?

 

iv tried

 

<td width="327" height="38" valign="top"><?
function display_breadcrumbs() {
     foreach ($_SESSION['page_history'] as $page) {
          $page_parts = explode(' | ', $page);
          echo '<a href="'.$page_parts[1].'">'.$page_parts[0].'</a> > ';
     }     
} ?>          <? display_breadcrumbs(); ?></td>

 

iv got the sessions part at top of page.

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495493
Share on other sites

The code you posted looks right. Just make sure you put something like this at the top of every page, changing the third line with the page title and page URL (seperated by the pipe symbol: " | ").

 

session_start();
if (!isset($_SESSION['page_history'])) { $_SESSION['page_history'] = array(); } // Make the array if it hasn't been made
array_push($_SESSION['page_history'], 'Index | http://site.com/index.php'); // Push the current page's title and URL to the array
if (count($_SESSION['page_history'] > 5)) { array_shift($_SESSION['page_history']); } // If the array is getting too long, shorten it

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495527
Share on other sites

still not showing anything at all

 

weird

 

1 - 13 is the session and the function

 

1.<? session_start();
2.if (!isset($_SESSION['page_history'])) { $_SESSION['page_history'] = array(); } // Make the array if it hasn't been made
3.array_push($_SESSION['page_history'], 'Index | localhost/pro/project/index.php'); // Push the current page's title and URL to the array
4.if (count($_SESSION['page_history'] > 5)) { array_shift($_SESSION['page_history']); } // If the array is getting too long, shorten it
5.
6.function display_breadcrumbs() {
7.     foreach ($_SESSION['page_history'] as $page) {
8.          $page_parts = explode(' | ', $page);
9.          echo '<a href="'.$page_parts[1].'">'.$page_parts[0].'</a> > ';
10.     }     
11.}
12.
13.?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rain Water</title>
<script language="JavaScript" type="text/JavaScript">
<!--
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) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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 onLoad="MM_preloadImages('buttons/artanddesignover.gif','new%20buttons/art&designover.gif','new%20buttons/achiover.gif','new%20buttons/businessover.gif','new%20buttons/childover.gif','new%20buttons/computingover.gif','new%20buttons/crimeover.gif','new%20buttons/educationover.gif','new%20buttons/fictionover.gif','new%20buttons/foodover.gif','new%20buttons/healthover.gif','new%20buttons/historyover.gif','new%20buttons/homeover.gif','new%20buttons/mindover.gif','new%20buttons/musicover.gif','new%20buttons/poetryover.gif','new%20buttons/philoover.gif','new%20buttons/reigionover.gif','new%20buttons/romanceover.gif','new%20buttons/scienceover.gif','new%20buttons/sportover.gif','new%20buttons/travelover.gif')">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="290" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="1024" height="123"><a href="index.php?"><img src="logo.gif" width="1100" height="290" border=0></a></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td width="193" rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
         <td><a href="master.php?id=General_Art" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('art','','new%20buttons/art&designover.gif',1)"><img src="new%20buttons/art&design.gif" name="art" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Architecture" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('achi','','new%20buttons/achiover.gif',1)"><img src="new%20buttons/achi.gif" name="achi" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Business_Finanace" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('busi','','new%20buttons/businessover.gif',1)"><img src="new%20buttons/business.gif" name="busi" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Children" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('child','','new%20buttons/childover.gif',1)"><img src="new%20buttons/child.gif" name="child" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Computing" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('comp','','new%20buttons/computingover.gif',1)"><img src="new%20buttons/computing.gif" name="comp" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Crime_Mystery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('crime','','new%20buttons/crimeover.gif',1)"><img src="new%20buttons/crime.gif" name="crime" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Education" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('educ','','new%20buttons/educationover.gif',1)"><img src="new%20buttons/education.gif" name="educ" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Fiction" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('fic','','new%20buttons/fictionover.gif',1)"><img src="new%20buttons/fiction.gif" name="fic" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Food_Drink" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('food','','new%20buttons/foodover.gif',1)"><img src="new%20buttons/food.gif" name="food" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Health" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('hea','','new%20buttons/healthover.gif',1)"><img src="new%20buttons/health.gif" name="hea" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=History" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('his','','new%20buttons/historyover.gif',1)"><img src="new%20buttons/history.gif" name="his" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Home_Garden" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','new%20buttons/homeover.gif',1)"><img src="new%20buttons/home.gif" name="home" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Horror" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('horro','','new%20buttons/horrorover.gif',1)"><img src="new%20buttons/horror.gif" name="horro" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Mind_body_Spirit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('mind','','new%20buttons/mindover.gif',1)"><img src="new%20buttons/mind.gif" name="mind" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Music_Stage_Screen" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('music','','new%20buttons/musicover.gif',1)"><img src="new%20buttons/music.gif" name="music" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Poetry_Drama" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('poerty','','new%20buttons/poetryover.gif',1)"><img src="new%20buttons/poetry.gif" name="poerty" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Philosophy_Politics" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('philo','','new%20buttons/philoover.gif',1)"><img src="new%20buttons/philo.gif" name="philo" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Religion" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('reli','','new%20buttons/reigionover.gif',1)"><img src="new%20buttons/reigion.gif" name="reli" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Romance" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('rom','','new%20buttons/romanceover.gif',1)"><img src="new%20buttons/romance.gif" name="rom" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Science_Fiction" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('sci','','new%20buttons/scienceover.gif',1)"><img src="new%20buttons/science.gif" name="sci" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Sport" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('spo','','new%20buttons/sportover.gif',1)"><img src="new%20buttons/sport.gif" name="spo" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Travel_Holiday" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('tra','','new%20buttons/travelover.gif',1)"><img src="new%20buttons/travel.gif" name="tra" width="193" height="19" border="0"></a></td></      </tr>
    </table>    </td>
    <td height="57" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
130:       <td width="327" height="38" valign="top"><? display_breadcrumbs(); ?></td>
          <td width="372" valign="top"><Form method="get" action="search.php?search=">
              <div align="right">
                <input type="Text" name="search" id="search" />
                <input type="submit" value="Search" />
              </div>
          </Form></td>
        <td width="58" rowspan="2" valign="top"><div align="right"><font size="3"><a href="index.php?"><font color="#000000">Home</font></a><font color="#000000"> </font></font></div></td>
        <td width="73" rowspan="2" valign="top"><div align="right"><font size="3"><a href="sign_in.php?"><font color="#000000">Sign In</font></a><font color="#000000"> </font></font></div></td>
        <td width="107" rowspan="2" valign="top"><div align="right"><font size="3"><a href="MyAccount.php?"><font color="#000000">My Account</font></a><font color="#000000"> </font></font></div></td>
    <td width="128" rowspan="2" valign="top"><div align="right"><font size="3"><a href="my_basket.php?"><font color="#000000">My Basket</font></a><font color="#000000"> </font></font></div></td>
        </tr>
      <tr>
        <td height="19"></td>
        <td> </td>
        <td></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="8" height="48"></td>
          <td width="79" rowspan="2" valign="top"></td>
      <td width="100%" valign="top" bgcolor="#C6FC48">
  <?php

$username = @$_POST[username];
$password = @$_POST[password];
$email = @$_POST[email];
$level = @$_POST[level];

$conn = new COM('ADODB.Connection') or die('Could not make conn');
$rs = new COM('ADODB.Recordset') or die('Coult not make rs');

$connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\wamp\\www\\pro\\project\\Rainwater.mdb";

$conn->Open($connstring);
if (!$conn)
  {exit("Connection Failed: " . $conn);}

$sql = "INSERT INTO sign (Username, Password, Email) 
VALUES ('$username', '$password', '$email')";
$rs->Open($sql, $conn);

?>
Congradulations you have signed up for Rain Water
You have field out the Form withthe folling information.<br />
Username: <b><? echo "".$username."" ?></b><br />
Password: <b><? echo "".$password."" ?></b><br />
Email: <b><? echo "".$email."" ?></b><br />
You Have Automaticaly been set with the User Status of "9".
</td>
      
        <td width="75"> </td>
        </tr>
      
      <tr>
        <td height="52"></td>
          <td> </td>
          <td> </td>
        </tr>
      
      <tr>
        <td height="218"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
      
      
    </table></td>
    <td width="93" height="318"></td>
  </tr>
  
  <tr>
    <td width="101" height="73"> </td>
    <td width="800"> </td>
    <td width="78"> </td>
    <td> </td>
  </tr>
  
  <tr>
    <td height="38"></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="117"></td>
    <td> </td>
    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="428" height="22"> <div align="center"><BR>
  <BR>
   © <FONT FACE ='Arial' size="2" > Rainwater Limited </FONT> <BR>
  <BR>
  <table width="800" border="0">
        <tr>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="85" height="13">
            <param name="movie" value="text15.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text15.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="85" height="13" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="93" height="14">
            <param name="movie" value="text16.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text16.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="93" height="14" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="57" height="14">
            <param name="movie" value="text17.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text17.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="57" height="14" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="71" height="16">
            <param name="movie" value="text18.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text18.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="71" height="16" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="99" height="16">
            <param name="movie" value="text19.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text19.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="99" height="16" ></embed> 
          </object>
        </div></td>
        </tr>
      </table>
  <BR>
</div></td>
      </tr>
    </table>    </td>
    <td> </td>
    <td> </td>
  </tr>
</table>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495627
Share on other sites

Oh sorry, I nested the parentheses wrong. It should be changed to:

 

session_start();
if (!isset($_SESSION['page_history'])) { $_SESSION['page_history'] = array(); } // Make the array if it hasn't been made
array_push($_SESSION['page_history'], 'Index | localhost/pro/project/index.php'); // Push the current page's title and URL to the array
if (count($_SESSION['page_history']) > 5) { array_shift($_SESSION['page_history']); } // If the array is getting too long, shorten it

function display_breadcrumbs() {
    foreach ($_SESSION['page_history'] as $page) {
         $page_parts = explode(' | ', $page);
         echo ' > <a href="'.$page_parts[1].'">'.$page_parts[0].'</a>';
     }     
}

 

Now I've tested it, so I know it will work. :P

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495638
Share on other sites

kk thanks alot :)

 

it does what i want it to but say all 5 of the links are refering to w/e page i am visiting

 

master.php?id=General_art

 

and repeating

 

Index > Index > Index > etc...

 

array_push($_SESSION['page_history'], 'Index | '); // Push the current page's title and URL to the array

 

i see if u delete the Index | it will echo the links as > > > > So a way to get it to record the page titles and the previous(s) links would work

Link to comment
https://forums.phpfreaks.com/topic/96799-some-help-please/#findComment-495661
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.