Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Yeah, sorry, i meant to point that out. I meant to say that it might be an option to use relative links instead.
  2. There's no easy way. You would have to build a script to interpret all of the HTML, which would then decide how to format the text on the image. If you using windows with php 5.2.2 or greater, then this might be a possible solution. Basically, it allows you to take a screenshot of a window.
  3. Yeah, it is possible. You need to modify your include path
  4. So you know the name of the variable in the URL? Just use the $_GET array: $refer = $_GET['refer'];
  5. Try: <?php if ($_SERVER['REQUEST_METHOD']=="POST"){ // In testing, if you get an Bad referer error // comment out or remove the next three lines if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 || !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) die("Bad referer"); $msg="Values submitted by the user:\n"; foreach($_POST as $key => $val){ if (is_array($val)){ $msg.="Item: $key\n"; foreach($val as $v){ $v = stripslashes($v); $msg.=" $v\n"; } } else { $val = stripslashes($val); $msg.="$key: $val\n"; } } $recipient="james@hobbscreative.co.nz"; $subject="Form submission"; error_reporting(0); if (mail($recipient, $subject, $msg)){ header("Location: http://www.ferrymeadgolf.co.nz/thankyou.html"); //you were missing your semi colon } else echo "An error occurred and the message could not be sent."; } else echo "Bad request method"; ?> Just fyi, the http_referer isn't the most reliable thing on the planet. It can easily be faked; but more moreover, there are certain browsers and firewalls which do not send it. You could therefore be blocking legitimate users.
  6. Umm, frankly, if any of you at 15-16 believe the quality of what you are producing will compete with someone who is a full time freelancer then i suggest you need to think again. Im 18. I don't do freelancing, though i'm sure i could. That said, i am under no illusions that the kind of thing i could be producing is probably not going to be quite as polished as that of other more experience people. And that is one of the key things here: experience. Furthermore, you are almost certainly going to get a more professional experience from someone older. It's not all just about programming ability. And gameyin: given that the quote revraz posted was by Chris92, is it particularly likely that it was aimed at you?
  7. As far as im aware, if you place quotes around the commas they will be escaped.
  8. You need to retrieve the variables from the POST array. For example: $subject = $_POST['subject'];
  9. Hmm. I guess that's what you get for trying to help when you're falling asleep!
  10. Use the LIKE operator and wildcards: SELECT * FROM tbl WHERE col = '%Jeff%' The % sign matches any character, any number of times. The an underscore(_) matches any character, but just once.
  11. The implode() function returns a string. You only need do your escaping on that: <?php $str = ''; if(isset($_POST['arrears'])){ $str = implode(',',$_POST['arrears']); } $str = mysql_real_escape_string($str); ?> In future, use tags around your code please.
  12. Frankly, i think the sigh was more in relation to the fact that Andy had already explained what had happened.
  13. Despite all the description, im not entirely what the problem is. As far as a i can see, you know what you are going to do. You say 'detect checkbox array' - there's not really anything you need to do there, apart from check if it has been set; which will have been if any elements have been clicked. You can then use the implode() function (as you said): $str = ''; if(isset($_POST['arrears'])){ $str = implode(',',$_POST['arrears']); } //store $str in the database You should only be storing this comma delimited list in your database if you are absolutely 100% certain than you will only ever need the data as a whole, in the same format it is stored in. If there is even the smallest possibility that you might require to know who missed their payments in january, then you will save yourself a lot of headaches by using another database table.
  14. You've tried to use the php date() function in your string. You cannot do that. You must concatenate(join) the returned value of the function with the rest of the string: <?php $query = "select * from test WHERE end_date = '".date('Y-m-d', strtotime('+ 5 days'))."'"; ?> Alternatively, see the the mysql date and time functions
  15. Not at all. What you would learn in a 4 year degree at college/university is wildy different from what you would teach yourself. While you can teach yourself a lot about programming, there is plenty you wouldn't even think about. See this post here: http://www.phpfreaks.com/forums/index.php/topic,180756.msg808017.html#msg808017 I think we see a lot of people around these forums with a similar viewpoint to you; they feel they can understand code that has been written, but not write their own. Personally, i would guess that,a lot of the time, this is just a lack of confidence and/or ideas. So what if you try and write something that doesn't work? I'm convinced you would learn a lot more than just reading other people's code.
  16. Yes, definitely back up your databases too. It's very straightforward with phpMyAdmin. When you log in, one of the options on the main screen is export. If you click that, you can save a copy of all your databases. If you select all of the databaes you can do it all in one go. And dont forget to check the 'save to file' option down the bottom.
  17. No problem. If you're all done, can you mark the topic as solved?
  18. Im not 100% sure i've fully understood but what i think is happening is: 1.) You edit the file 2.) You click save 3.) You get the correct message saying it has saved AND if you view the file again it has indeed been saved successfully 4.) BUT along with the saved message, you see the old code If thats about right, then it's because you're doing the saving at the bottom of your script, after the contents is grabbed from the file and displayed. You need to be doing the form processing at the top.
  19. Showing us the relevant code and database structure might help us help you.
  20. It's called pagination. Google for it and you'll find plenty of tutorials.
  21. Its not a whole different language, it just requires you to use some AJAX - which is javascript. See www.ajaxfreaks.com for an introduction to it. You may well find tutorials for the above on the internet, but it shouldn't be too hard to pick up the gist from one of the tutorials on the above site.
  22. Does anyone know if it is possible to set the callback function of a user defined sort as another method of a class? That might be a poor explanation, so perhaps some code will help to clarify: <?php class myclass{ function mysort($a,$b){ return $a - $b; } function pointlessfunction(){ $array = array(4,3,1,4,5,7,2); usort($array,'mysort');//this is the problem } } $myclass = new myclass(); $myclass->pointlessfunction(); ?> The above gives an 'invalid comparison function' error, which is fair enough - normally when referencing functions in the same class, you use $this. However, i've tried the above with various replacements like: usort($array,'this->mysort'); //or usort($array,$this->mysort); Without success. I realise that i could move the mysort function outside of the class, but i was wondering if it is possible to keep it within? I hope that's clear enough. Thanks in advance for any help. Ben
  23. I dont think opinions necessarily need to be backed up by fact. However, if you want others to agree with (or even just consider) that opinion, then you need a basis for the opinion, which would usually come from facts. Also, im not sure that an opinion is either valid or invalid. As you say, an opinion is your own personal thoughts - someone cannot invalidate those. An opinion, could, however be unfounded - if I have a particular opinion but cannot give any reason for that, then someone could argue that it is unfounded. To further confuse, one could argue that everything is an opinion. For me, fact could be defined as the prevailing opinion on a given matter.
  24. I really cant be bothered to have this argument with you. Ill just stick with my previous statement.
×
×
  • 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.