Jump to content

psquillace

Members
  • Posts

    94
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

psquillace's Achievements

Member

Member (2/5)

0

Reputation

  1. Ok mark this one as solved, i figured it out and I hope this little bit helps someone here. in PHP you cannot just say, if('pagename.htm') {echo "this stuff"}else{echo "that stuff"}; you have to tell it what server you are on, and if you are, then if you are on this page, then can you do this. Here is an example of what I did to make this menu work for me. if($_SERVER['PHP_SELF'] == 'brand-name-playing-cards.php') { echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"><b> Brand Name<br> Playing Cards</b></a></td></tr>\n"; }else{ echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#edede4';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"> Brand Name Playing Cards</a></td></tr>\n <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>\n"; }
  2. Ok Wait... it appears that I spoke to soon This is what I have now as an alternate - if('brand-name-playing-cards.htm') { echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"><b> Brand Name<br> Playing Cards</b></a></td></tr>\n"; }else{ echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#edede4';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"> Brand Name Playing Cards</a></td></tr>\n <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>\n"; } if('congress-playing-cards.php') { echo "<tr><td width=\"16\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"congress-playing-cards.php\"><b> Congress Playing Cards</b></a></td></tr>"; }else{ echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#edede4';\"><a class=\"menu\" href=\"congress-playing-cards.htm\"> Congress Playing Cards</a></td></tr> <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>"; } but for some reason, it is only picking up the else part no matter what page I am on. it also is not picking up my spacer image, is tehre a code for that that I need that is just for images or something. Thanks for any help or advice on this, Paul
  3. Thanks Man, that did it. I forgot to put an line ending delimeter on each line I think but it works now so. thanks again Paul
  4. Yes that is complete even with the <!--#virtual include"DOCUMENT_NAME" --> it is not commonly used but it is all over this site that I have to edit to php so I am not sure how to change it. I tried this below just now but the text editor is complaining about something already. lOL <?php if('congress-playing-cards.php') { echo "<tr><td width=\"16\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"congress-playing-cards.php\"><b> Congress Playing Cards</b></a></td></tr>" }else{ echo "<tr><td width="160" height="15" align="left" style="background-color:#edede4;" onMouseOver="this.style.backgroundColor='#cfcfc7';" onMouseOut="this.style.backgroundColor='#edede4';"><a class="menu" href="congress-playing-cards.htm"> Congress Playing Cards</a></td></tr>" } <tr><td height="1" class="navdivider"><img src="images/spacer.gif" border="0" hspace="0" vspace="0" width="160" height="1" alt=""></td></tr>
  5. Hello, I have changed most of my site over to php and now I have a problem. I did have virtual includes in html on my site that went like this <!--#if expr='("$DOCUMENT_NAME" = "gemaco-bridge-sets.htm")' --><tr><td width="160" height="15" align="left" style="background-color:#cfcfc7;" onMouseOver="this.style.backgroundColor='#cfcfc7';" onMouseOut="this.style.backgroundColor='#cfcfc7';"><a class="menu" href="gemaco-bridge-sets.htm"><b> Gemaco Bridge Sets</b></a></td></tr> <!--#else --> <tr><td width="160" height="15" align="left" style="background-color:#edede4;" onMouseOver="this.style.backgroundColor='#cfcfc7';" onMouseOut="this.style.backgroundColor='#edede4';"><a class="menu" href="gemaco-bridge-sets.htm"> Gemaco Bridge Sets</a></td></tr> <!--#endif --> <tr><td height="1" class="navdivider"><img src="images/spacer.gif" border="0" hspace="0" vspace="0" width="160" height="1" alt=""></td></tr> Now my menu on my pages are broken and I do not know how to convert that to php. Basically I want to say, If we are on this page, then load the menu like this... if not, then this... I know it is an if else I just do not know how to say the if this page part like in html. Thanks for any help or advice on this, Paul
  6. Thanks Guys for all your help, one last question on this though. I got it to work... FINALLY.... bleh.... but now, I want to say.... if (isset($_SESSION['myusername'])) { make url HTTPS and if not just HTTP is that possible or is that not how SSL works? Thanks for any help or advice on this, Paul
  7. Hello All: I created a simple login form for my site which I cannot get to work and I do not understand why. The login page is a simple username and password page and it connects to the db and all works fine as far as logging in. It is when I want content blocked on other pages that is the problem. On the very top of those pages I have, session_start(); if (!(isset($_SESSION['myusername']) && $_SESSION['mypassword'] != '')) { header ("Location: login.php"); exit(); } For some reason though, when I go to the home page after successfully logging in, I go to the login page again. The form action for that login is like this, session_start(); $host="localhost"; // Host name $username="wholesale_admin"; // Mysql username $password="blackjack21"; // Mysql password $db_name="kardwell_wholesale"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); }else { echo include('wrong_username.htm'); } Is there something I am doing wrong that someone can help me here get this working? Thanks for any help with this, Paul
  8. Hello All: I have started to make my .htaccess file so that my CMS will dynamically change the URL from one that is like this www.mydomain.com/info_page.php?page_id=$1&product=$2 to one that has a specific product on the end, like www.mydomain.com/oinons/bagels/coffee. The problem I am realizing was that I thought that I could just do this with just the .htaccess but now I am starting to see that you would need a php file or script to tell it what to change too. This is where I need the help because I am kind of new to php and would not even know where to begin with something like that. Can someone point me in the right direction or something so I can get this show on the road. Thanks, Paul
  9. Ahhh... Thanks guys for all the tips on this, I got it to work.. only took me 5hrs. LOL Paul
  10. Hi Mike, those are supposed to be Unix Times in Seconds. I tested it by doing an echo time() function. It gave me the date and time in seconds.
  11. Hello All, I worte this bit of code so that a few graphics I have online will change if in between 2 dates. It goes something like this: <?php if(time() > strtotime('1262930400') && time() < strtotime('1263427199')){ echo ('<tr><td align="center" valign="middle" colspan="2"><a href="http://www.raffledrums.com/acrylic-raffle-drums.htm"><img src="images/raffledrums_tn.jpg" border="0" hspace="0" vspace="5" width="238" height="98" alt="Giant Raffle Drums"></a></td></tr>'); }else{ echo ('<tr><td align="center" valign="middle" colspan="2"> </td></tr>'); } ?> However, it is not working correctly. Am I doing something wrong in there that I am missing? Thanks for the help and or advice on this, Paul
  12. oh ok, now I see what I did wrong. Thanks for the help on this, Paul
  13. ok, I was able to learn for my self how this is supposed to get done <?php if(isset($_POST['radio00'])) header("location $url"); { $URL="http://emrcontractor.com/index.php?option=com_content&view=article&id=8&Itemid=2" }else{ $URL="http://emrcontractor.com/index.php?option=com_content&view=article&id=1&Itemid=3" } ?> in case anyone else needs it....
  14. Hello All: I am writing a php snip or at least trying too where if one radio button is selected we go to this URL otherwise go to this URL. I started something like this but I get lost real quick after that because I never did an if else with radio buttons before. Any help would be appreciated. <?php if ($radio1 'selected' ? "http://"){ }else{ "http://" } sorry for such a hack job on that above I just don't know that much about php...
×
×
  • 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.