Jump to content

oni-kun

Members
  • Posts

    1,984
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by oni-kun

  1. You wrote it so if $emailMessage is blank, it won't send. $emailMessage will always be "\n----MESSAGE-----\n" even if they entered a message or not. You'd just need to check the POST not the variable. Try this: <?php if (isset($_POST['Name'])){ $emailTo = 'cm@chrismdesign.com'; $emailName = $_POST['Name']; $emailFrom = $_POST['Email']; $emailSubject = $_POST['Subject']; $emailMessage = "\n-----MESSAGE-----\n" . $_POST['Message']; $emailMessage .= "\n-----NAME-----\n" . $_POST['Name']; $emailMessage .= "\n-----EMAIL-----\n" . $_POST['Email']; if (!preg_match('/^([A-Z0-9\.\-_]+)@([A-Z0-9\.\-_]+)?([\.]{1})([A-Z]{2,6})$/i', $emailFrom) || empty($emailFrom)) { echo 'Please enter a valid email address'; } elseif (empty($emailName)) { echo 'Please enter your name'; } elseif (empty($emailSubject)) { echo 'Please enter a subject'; } elseif (empty($_POST['Message'])) { echo 'Please enter a message'; } else { if (!empty($emailFrom)) { $emailHeaders = 'FROM: <cm@chrismdesign.com>'; } /* Send Email */ if (mail($emailTo, $emailSubject, $emailMessage, $emailHeaders)) { echo 'You message has been sent!'; } else { echo 'There was an internal error whilst sending your email.<br>'; echo 'Please try again later.'; } } } ?> A simple mistake to make.
  2. Wait, It's action="url" method="post" .. lol
  3. "and it did come before the mail() function before." He said it himself, that he had the header before mail(). You told him otherwise.
  4. This is impossible to accomplish. PHP is a serverside language, meaning it'd output the result before it could even randomly change. You must do this in Javascript, Java/flash makes no sense to.. JS should be simple such as if you define a function to swap images: setInterval(swapImages(), 3000); For 3 second intervals. Simple enough.
  5. Yes he does, You're telling him to do what he already did, you're confusing him!
  6. okay, doesn't this if (!empty($emailFrom)) { $emailHeaders = 'FROM: <cm@chrismdesign.com>'; } define it? and it did come before the mail() function before. Im sorry again, like I said, total php noob. Just use my code (on the previous page now), I'm not sure what he's on about. You set the headers correctly.
  7. What on earth are you guys doing? Try this code: <?php if (isset($_POST['Name'])){ $emailTo = 'cm@chrismdesign.com'; $emailName = $_POST['Name']; $emailFrom = $_POST['Email']; $emailSubject = $_POST['Subject']; $emailMessage = "\n-----MESSAGE-----\n" . $_POST['Message']; $emailMessage .= "\n-----NAME-----\n" . $_POST['Name']; $emailMessage .= "\n-----EMAIL-----\n" . $_POST['Email']; if (!preg_match('/^([A-Z0-9\.\-_]+)@([A-Z0-9\.\-_]+)?([\.]{1})([A-Z]{2,6})$/i', $emailFrom) || empty($emailFrom)) { echo 'Error'; } elseif (empty($emailSubject)) { echo 'You must enter a valid subject.'; } elseif (empty($emailMessage)) { echo 'You must enter a message to send to our team.'; } else { if (!empty($emailFrom)) { $emailHeaders = 'FROM: <cm@chrismdesign.com>'; } /* Send Email */ if (mail($emailTo, $emailSubject, $emailMessage, $emailHeaders)) { echo 'You message has been sent!'; } else { echo 'There was an internal error whilst sending your email.<br>'; echo 'Please try again later.'; } } } ?> <form name="contact" method="post" action="index_test.php"> Your Name: <input type="text" name="Name"><br> Your Email: <input type="text" name="Email"><br> Subject: <input type="text" name="Subject"><br> Message:<br> <textarea name="Message" cols="30" rows="8"></textarea><br> <input type="submit" name="submit" value="Contact Us"> </form> That'll prevent the code from running, if the page is first loaded (I.E. No POST data. ). Why on earth are you complaining about headers to be before mail, when it is, and giving invalid code?
  8. What does that have to do with anything? Yes you can do.. if ($this == $that) echo $this; echo "Foo";
  9. What you might want to do is define an error class, or more simply something such as: function CheckInput() { if(!isset($_GET['id'])){ trigger_error('ID Not set'); } if(strlen($_GET['id']) >= 30) { trigger_error('ID too long'); } //etc.. } CheckInput(); Instead of: if (isset($_GET['id'])) { if(!empty($_GET['id']) { if (strlen($_GET['id']) > 30) { die('ID too long'); } else { $id = $_GET['id']; } else { die('Please set ID'); // } else { //... }.. As you can see, defining checks, or better yet error classes are cleaner and take less processing time.
  10. likewise. i ran that through Google translator, and it vomited. I laughed so hard I almost cried. Rofl.. OP, need anything else?
  11. This has nothing to do with Asia. According the the article, it only affects Europe. YES! This is what I wanted to know, I thought the UN or something just had laws against it or something stupid and'd affect us all. Europe is so stupid with its things, an IP there is actually considered 'an official identification'
  12. European Union decides somewhat the laws of it, I'm not 100% sure what they are, funny me, but yeah it effects Microsoft globally. [ot]Waiting 92 seconds on rapidshare to download my....... Homework.[/ot]
  13. So the majority of web developers do not bother with the browser with the highest % of users? Well the saying goes, Develope it for Firefox, Hack it for IE. If you notice so many millions of sites include 'ie only' CSS/JS etc. Firefox should rise, er, out of the ashes, and claim over IE's poor rendering problems.
  14. I thought the ability to uninstall it would be enough, Including other browsers sounds downright stupid. But atleast with Firefox, The majority of web developers will obviously agree they only develop for FF and not IE. So maybe it's time to move the population of non-tech savvy people to the, well, standards. PS: IE has an Alexa transponder in it, always has, tracks usage, that's how Alexa is so informatical and a monopoly for web tracking.
  15. I have a decent gaming computer, But I remember many moons ago I had an old PII w/ an ATI-Rage Pro II video card, a whopping 8MBs of VRAM! I had to add a second card or something to get a second monitor in, Since it was sorta pre-LCD age I had these 400 pound things. It got too crazy so I was glad I picked up an LCD, 19 inches is perfect, I hate too big , and I hate widescreen, The height is more important to me.
  16. I'm gonna play right now! Domination is ALL I do, I just am not so good at team deathmatch, I'm a tad flawed on walking around endlessly to find someone to shoot (usually ground war is fine..) I love defending and working as a 'team', like HC S&D. I'm officially at 4d 00h 00m gametime, Which is awesome for my level.
  17. Bleh, got the answer googling, Doesn't seem the best for simple tasks yeah.
  18. fgetcsv and similar? Since it's internal rather than logic it should run faster, you should run some tests.
  19. What is your application of this? It's sorta ironically mixing flatfiles with databases. If it's just for importing the odd file it shouldn't matter, but if it's an essential code than you should store the files in a format, serialized, imploded, in an array, or even in xml/csv which can be easily handled with built in plugins that should perform much faster than all that parsing. You can test speeds and try a few optimizations using this benchmarking code if you wish, I think it works: This'll be at the top of your page, or included.. $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; And this at the bottom: $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; printf('<br>Page loaded in %.4f seconds.', $totaltime);
  20. I love this game! I sorta didn't like it at first compared to WAW, as most of the guns seemed to only differentiate in stats, not really how they worked. But I've come pretty well into it. I'm prestige 1 so far, level 49 so i'm getting there. I have insomnia so I play from midnight-5am when I don't have anything the next day so i'm doing pretty well. My KD was 0.8 for a long run, but I was just playing, I manage to get an average like 23:9 each round so I'll bump it up soon. My favourite weapon's: Barrett .50c w/FMJ, SPAS-12 shotgun, Akimbo 1887's, ACR. I managed to get 760~ kills with the SPAS, good shotgun, got an awsome title for it. Slowly working up to the 1000 where I can get that kickass emblem! Man I'm babbling on a lot, it's 7am, don't know when to sleep. (Nor did I know there was a misc section to talk about stuff like this) Oh, Perks are usually Stopping power/Steady Aim (for shotgun/thermal aiming)/Bling.
  21. Looks like part of a pagination script. It'll simply echo the amount of pages left, and then after the loop echo a link to another page.
  22. I'm not 100% sure what you wish to do. Do you want the estimate to be added upon 10 pounds if it goes up from 10->20 in the selection box? Wherever your actions are to take the POST data from the selection box, you may want to add it into a session variable (if you can not create a session, look for a tutorial, it's simple). Once you submit the form it'll simply be like.. $_SESSION['estimate_total'] += 10;.. So you can echo it like "Your estimate cost is ". $_SESSION['estimate_total'] . "pounds". EDIT: If you want it to be automatic (I.E.: Not refreshing the page) You'll need to use AJAX to query quote.php and fill in the value..
  23. Meh, you're right. I'm not sure if the original php.ini has a 'hardcoded' address for itself that cannot be overridden, it must be an option somewhere.
  24. I'm not 100% sure, but try this as root in your .htaccess: <Files /limitedperson/php.ini> order deny,allow deny from all </Files> This will tell the server to ignore that file. (Atleast in theory)
×
×
  • 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.