Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. You need to make sure that you specify a content-type of html in the header like this: $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  2. This statement contradicts itself First you say this: This isn't a problem, I've got loads of material that could help you code it. But then you say this: So is what you actually mean "Can you write it for me with me doing nothing?"
  3. Can't this be done by just using mysql's like? Obviously this isn't a complete script and you'll need to take the bits and plug them into your script. // Initial email (Obviously passed into your script via $_POST) $email = 'user@gmail.com'; // Get the domain part of the email address $domain = substr($email, strpos($email, '@')+1); // Stick it in a query to the database $sql = "SELECT group_name FROM groups WHERE string LIKE '%" . $domain . "%';" // Run a while loop on the returned results and you should be fine
  4. if(!isset($_REQUEST['phone']) || empty($_REQUEST['phone'])){ exit('You must provide a phone number'); } This will make sure that something has been entered, it won't check to see if it's in the correct format, in fact it won't even ensure it's a number. If you want that then try googling 'Validate Phone Number PHP' it brings up plenty of results.
  5. Sorry, my bad, I misread one of your numbers. Change it to this: imagefilledrectangle($signature, 100, 15, 250, 30, $red); It's really simple, the numbers are just offsets from the top left of the image. In your main image 0,0,350,60 means: The top left point should be placed 0 pixels from the left of the screen and 0 pixels from the top of the screen. In your main image 0,0,350,60 means: The bottom right point should be placed 350 pixels from the left of the screen and 60 pixels from the top of the screen. Exactly the same applies for the filled rectangle, but it's numbers are offset against the parent image.
  6. You need an else statement on your very first conditional. If you add an else statement to this that exits the script you'll be fine. The one that says you're not an image or below 20000 bytes. Or just move all the rest of the code into the first if.
  7. Try changing this: imagefilledrectangle($signature, 0, 1, 150, 30, $red); to this: imagefilledrectangle($signature, 75, 15, 225, 45, $red);
  8. The database is the way to go if you want it truly dynamic. The database table would contain the image url along with the date it was submitted, then you'd be able to query the database and order the results by the date descending and display using a gallery script that supports pagination. The other way would be to rename the files on upload based on timestamp and read the directory of images. It's easy if you know php, but I see from your post that you dont, so you could try googling for a gallery script that can do it, or maybe post in the PHP Freelance board
  9. It's taking the URL in $url and validating it against a set of rules. Look at filter_var() in the manual. You're filter is FILTER_VALIDATE_URL It's basically checking to make sure that the URL is formed correctly.
  10. You've got confused with your if statements. You have: if (isset($_POST["direction"]) == "north") you need: if (isset($_POST["direction"]) && ($_POST["direction"] == "north")) Basically, what's on the left side of the equals sign must equal what's on the right side, so in your example, you're comparing the left side of the equals sign which is a check to see if the variable is set, if it is return true. So you're comparing the Boolean TRUE, with the string "north", these obviously aren't the same.
  11. Is this a serious question? You know about php, cURL and Proxies, but have never heard of Google?
  12. Let me guess, if it's a valid format it displays all the details and uploads the file, and if it's not it doesn't display the data, but still uploads the file?
  13. Can you not just put the airports that you actually want into the stations.csv?
  14. Yes, from the look of the shadowbox-js website, the following code is used to include shadowbox on the page: <link rel="stylesheet" type="text/css" href="shadowbox.css"> <script type="text/javascript" src="shadowbox.js"></script> <script type="text/javascript"> Shadowbox.init(); </script> The following should work: <?php // This is the value that you can switch between 1 and 0 $show = 1; if ($show){ echo ' <link rel="stylesheet" type="text/css" href="shadowbox.css"> <script type="text/javascript" src="shadowbox.js"></script> <script type="text/javascript"> Shadowbox.init(); </script> '; } ?>
  15. You need to make sure that the value coming from the database is actually valid, we can't see if this is the case as you've provided no code and no example where it's not working.
  16. It doesn't look as though even the name is compulsory. If you're just wanting to make sure it's not blank then you can use empty() and isset() If you want to actually verify that the phone number is in a valid format then refer to preg_match()
  17. OK, but that's not a question. Perhaps post a question, and as it's obviously some kind of course work, also post what you have so far and maybe we can point you in the right direction, although I expect people will be reluctant to actually do it for you, as you need to understand what the code is doing.
  18. There's probably a much nicer solution to this but I'm hungover, so this will have to do for now. <?php /* Query to get rates from database goes here, I'm just using hard coded array */ $rates = array(1 => '4.95', 2 => '6.00', 3 => '8.00', 4 => '5.00', 5 => '15.00'); /* Sample array of id's */ $products = array(1,2,3,4,4,4,5,6,8,; /* Build an array of id's keyed on id with a count as the value */ foreach ($products as $id){ if (isset($counts[$id])){ $counts[$id]++; } else { $counts[$id] = 1; } } /* Calculate shipping */ $shipping = 0; $flat_rate = 0; if (isset($counts[8])){ $shipping = $rates[5] * $counts[8]; } if (isset($counts[7])){ $shipping = $shipping + ($rates[4] * $counts[7]); } if (isset($counts[4]) || isset($counts[3]) || isset($counts[2]) || isset($counts[1])){ $flat_rate = $rates[1]; } if (isset($counts[5])){ $flat_rate = $rates[2]; } if (isset($counts[6])){ $flat_rate = $rates[3]; } $shipping = $shipping + $flat_rate; echo $shipping; ?>
  19. I think I'll mark this as solved as there are now a number of solutions. As for which one I'm going with, I haven't decided yet :-\ Cheers Rich
  20. Check out the Image Processing Book in the PHP Manual. You're after the GD functions here. Regards Rich
  21. That doesn't work either. Look at the first value in the list 81.0, should display as 81, it's the same for 67.0
  22. I can see what you've tried to do there, but it won't quite work as the 'if' condition will always return true. strstr() will always return the decimal point along with whatever follows it. I think for want of a better solution, I'll probably go with this. $n = array('81.0', '80.5', '70.5', '67.0', '65.5'); foreach($n as $v) { $parts = explode(".", $v); echo ($parts[1]) ? $v : $parts[0]; echo "<br />\n"; } Cheers Rich
  23. I've been wracking my brain trying to figure this simple problem out and I can't for the life of me figure out the best way to do it. I have the following array: $n = array('81.0', '80.5', '70.5', '67.0', '65.5'); I only want to display the numbers to one decimal place if it's not a whole number, like so. 81 80.5 70.5 67 65.5 I've tried looking for a solution with sprintf(), rtrim() and number_format(), but what's the best way to do it? Regards Rich
  24. Yeah, start with C:\temp or something. Huggie
  25. Good Question... I'm not sure if it will work on Server 2003. Here's my instructions for XP. Start >> Run Type mmc and click Ok. File >> Add/Remove Snap In >> Add Select 'Computer Management' >> Add >> Finish >> Close >> OK This should now show you the MMC with your local computer. If this works then let me know. Huggie
×
×
  • 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.