hcdarkmage
-
Posts
326 -
Joined
-
Last visited
Posts posted by hcdarkmage
-
-
Simple way to combat that:
<?php include "menu.inc.php"; function menu(){ global $_menu; $str = ''; foreach($_menu as $url => $name){ $sel = ($_GET['page'] == $url ) ? ' id="selected" ' : ''; $str .= "<li ". $sel ."><a href='index.php?page=" . $url . "' >" . $name . "</a>\n"; //<--- This line sets the URL in the menu } echo $str; } $page = ( isset($_GET['pg']) ? $_GET['pg'] : ((isset($_GET['page']))? $_GET['page']:'home')); $file = basename($page).'.php'; $html_path = "php/"; ?>
and it calls the menu function like this:
<? #include $html_path."menu.html"; menu(); ?>
my menu.inc.php:
<? $_menu = array('home' => 'Philosophy & Focus', //<--- These are the links that it calls. 'biography' => 'Biography', 'consultations' => 'Consultations', 'classes' => 'Classes', 'client_comments' => 'Client Comments', 'calendar' => 'Calendar', 'recommended_reading' => 'Recommended Reading', 'products' => 'Products', );
Simply change the line I pointed out to:
$str .= "<li ". $sel ."><a href=" . $url . " >" . $name . "</a>\n";
And change the menus to:
'index.php?page=biography' => 'Biography',
and set the Google menu to:
'http://www.google.com' => 'Google',
And you should be able to set up any other external links that you like.
-
-
Please post the error.
-
Actually ken, if you go to the link he supplied and look at the page source, you'll see that his whole code is messed up. Travel, could you please show the code you have for all three pages, and make sure you use the code tags for your code. That way we can help you out. There are many inconsistencies that need to be fixed and that may be what is causing your problems.
Just post the current code by doing something like:
header.php
code here
main code
code here
footer.php
code here
-
It may help if we can see the code to footer.php. There maybe some CSS styling or inline styling in there that is causing the problem. pLease post more code in the [ code ][ /code ] tags so we can help you out more.
-
Try this
<?php // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); // Validate the age. if ($age >= 18 || $age < 35) { // Here is the change, but it may be if($age >= 18 && $age < 35) print '<p>Youth Message!</p>'; } else { $age .=$age; } // End of 1st conditional. if ($age >= 35) { print '<p>Generic Message!</p>'; } else { $age .=$age; } // End of 2nd conditional. ?>
-
Do you see the problem you are creating with this code here?
$query = "INSERT INTO capture ('$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total','$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' ) VALUES ('$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' )";
I doubt that the fields that you are trying to put data in are named with the data that the user sends. Take a look and try again.
-
It is not inserting the values because it doesn't know where to put them.
$query = "INSERT INTO capture VALUES (' ', '$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' )";
I believe the proper syntax for this would be
$query = "INSERT INTO tablename (columns) VALUES (data)";
If your first column is auto incrementing, then I suggest you just skip to Name in the columns section and do the same for the values. Putting the ' ' in the values is a bad idea.
In your case it would look like
$query = "INSERT INTO capture ('Name', 'Ad1', 'Ad2', . . .) VALUES ('$Name', '$Ad1', '$Ad2', . . .)";
-
Another thing you can try is modify your DB so that it has a column like "used" with a default value of 0. When that user is used you set the value to 1. Then in your query, you just check to see if "used = 0".
Just a thought. But, then again, you would have to change the query if you wanted them to be displayed again . . .
-
that is a browser issue. I doubt there is anything you can do on your site itself to stop that from happening.
EDIT: You could just select the "Never For This Site" Button.
-
I had a similar problem using random. I don't know if this helps but try looking at http://www.phpfreaks.com/forums/index.php/topic,149411.0.html that is the topic I started and it helped a lot.
-
try
$time = $time + $hours
-
You actually had 2 extra } in there. Here is the cleaned code:
<?php class weather { public static $response; public static $location; public static $current; public static $nextdays; public static $error = false; public function weather() { $this->location = 'Pickering, ON'; } public function get() { if (empty($this->location)) { $this->error = true; return false; } $requestAddress = "http://www.google.com/ig/api?weather=".trim(urlencode($this->location))."&hl=en"; $xml_str = file_get_contents($requestAddress,0); $xml = new SimplexmlElement($xml_str); if (!$xml->weather->problem_cause) { $this->response = $xml->weather; $this->parse(); }else{ $this->error = true; } } public function parse() { foreach($this->response as $item) { $this->current = $item->current_conditions; foreach($item->forecast_conditions as $new) { $this->nextdays[] = $new; } } } public function display() { echo '<table border=1 cellpadding=2 align=center>'; echo '<tr align=center>'; foreach($this->nextdays as $new) { echo '<td>'; echo '<div class="weatherIcon">'; echo '<h2>'.$new->day_of_week['data'].'</h2>'; echo '<img src="http://www.durhamit.ca/test/' .$new->icon['data'] . '"/><br/>'; echo '<br />Min: '.$this->convert($new->low['data']).' &#38;#38;#8451;'; echo '<br />Max: '.$this->convert($new->high['data']).' &#38;#38;#8451;'; echo '<br />'.$new->condition['data'].' '; echo '</div>'; echo '</td>'; } echo '</tr>'; echo '</table>'; } public function convert($value, $unit = "C") { switch($unit){ case "C": return number_format(($value - 32)/1.; }; } }
-
It helps if you keep your tags in the proper order. Try this:
public function display() { echo '<table border=1 cellpadding=2 align=center>'; echo '<tr align=center>'; foreach($this->nextdays as $new) { echo '<td>'; echo '<div class="weatherIcon">'; echo '<h2>'.$new->day_of_week['data'].'</h2>'; echo '<img src="http://www.durhamit.ca/test/' .$new->icon['data'] . '"/><br/>'; echo '<br />Min: '.$this->convert($new->low['data']).' &#8451;'; echo '<br />Max: '.$this->convert($new->high['data']).' &#8451;'; echo '<br />'.$new->condition['data'].' '; echo '</div>'; echo '</td>'; } echo '</tr>'; echo '</table>'; }
-
You could google php tutorials to help you out. Or better yet you can go to http://www.w3schools.com. OR even better, if you want someone to do the work for you, you can ask to have this moved to the freelance forum.
-
Don't forget to mark the thread as solved.
-
Try this:
<?php if (isset($_POST['redirect'])){ header("Location: http://www.website.com/".$_POST['redirect']."submit.php"); exit(); } ?> <form method="post" action=""> <select name="redirect"> <option value="vodka">Vodkas</option> <option value="bourbons">Bourbons</option> <option value="rum">Rums</option> <option value="gin">Gins</option> <option value="brandy">Brandy</option> <option value="tequila">Tequila</option> <option value="whiskey">Whiskey</option> </select> <input type="submit" value="Go!"> </form>
-
And how would that stop someone from either just setting the variable themselves or removing the code that is checking if the variable is set?
The only way you can prevent someone from bypassing your lic.php file is if the file that is including and using the information from lic.php is also encrypted.
I agree with you, and I was just offering a suggestion, lol. I was thinking along the same lines and it seems that you would be stuck without a solution unless you encrypt everything. Especially if they have the ability to modify the files to remove the lic.php file.
-
You could put in your "lic.php" file a variable like:
$sugar = "needed";
Then in your other pages use an if statement to see if that variable is found. If the variable is missing, then exit the page or show an error.
-
This may explain why: http://www.w3schools.com/css/pr_text_text-decoration.asp. It shows you what options you can put in the text-decoration tag.
-
ignace is right. I keep forgetting about firebug, .
-
One more suggestion, I guess. In the area that you want to put your code try putting in something like
<p>This is test text to see if it shows.</p>
See if anything shows up that way.
-
Check your CSS file. I see that you are pulling one. All you have to do is see if there is a
body { color: #000000; }
or something similar in the CSS file.
-
It may be that you have the text color the same as your body color. You may want to check that out.
how can I add dynamic titles and dynamic meta descriptions to my pages?
in PHP Coding Help
Posted
Let's take this one step at a time. Going back over some of your code, I have seen some mistakes (i.e. missing end tags), but have faith. We are working on your problem.
For your index.php, it should look similar to this:
header.php will look something like:
And footer.php something like:
This should help you see how it works with the separation of the files. Your constants on all pages are header.php and footer.php.