Jump to content

Lodius2000

Members
  • Posts

    586
  • Joined

  • Last visited

    Never

Everything posted by Lodius2000

  1. Andy-H That worked. just to make sure I understand how it worked (like i said, reeeeeeally rusty at my php): including the false value for $datetime means that modify() must accept some sort of argument, so if you put in an argument it returns false because it is supposed to throw an exception, and if you put no argument, the function returns false, which throws an exception right?
  2. So I am extending the DateTime class and would like to completely disable the modify() function that is built in so i have this: <?php class NewDateTime extends DateTime { public function modify() { throw new Exception('modify() has been disabled.'); } } thats not the entire class description, just the pertinent part of course now any time I create a new object from NewDateTime I get this message at the top of the screen: what gives? how do I get rid of this and still disable modify()? I'm betting its a setting that i have wonky but I am really rusty in php so dont know where to look in php.ini
  3. i should learn to test my theories that i propose before i test... magic quotes was on... didnt occur to me until i said it in the post tho solved
  4. Guys... im rusty and my script is not working right. i have an edit article page. it goes like this $article= "pull article text from database where id = whatever $clean_article= stripslashes($article); then create a text area with the contents of $clean_article then write $updated article to the db with addslashes($updated_article); so each time when i use say this line of code <img src="blah"> it should go in the db as <img src=\"blah\"> and come out of the db as <img src=\"blah\"> then before i see it is transformed into <img src="blah"> then goes back in the db as <img src=\"blah\"> instead i am getting this <img src="blah"> becomes <img src=\"blah\"> when i put it in the db then gets put on the page as <img src=\"blah\"> when i edit the article with the above script i see <img src=\"blah\"> in the text area the first time then subsequent times become <img src=\\\"blah\\\"> and so on what could be the problem could this be a magic quotes issue?
  5. so javascript passes the current value of the form fields to $_SESSION ?
  6. Just as the title says, I want to know how a preview function is created, similar to wordpress, blogger, this forum, yada yada ... they all have a preview post function but I dont know how it does it. It doenst seem like the database is altered, but how does the preview function grab the content of the form as is and display it, is it js? then it loads it into a dummy page, say 'preview.php'? or is it database driven. If it is then preview becomes a button with 'submit' functionality right. but it doens't update the real database table, just the preview table. so how do you give a form dual submit functionality like that. to my knowledge you can put submit buttons all over the place but they all submit to where the form tag says to go. Thanks
  7. duh, Im such a fool. I always forget about the 'troubleshooting' functions and jump straight to asking a total noob question Solved
  8. if I use a mysql query like 'SELECT title, post FROM table WHERE id = 23' but there is no id = 23 what is the php value of a variable made out of title or post? NULL, 2 single quotes ( '' ), something else? thanks
  9. tang, yes $pagetitle should be passed to headTemplate but it is not. mikesta, good suggestion but it didnt work, you cant declare a global variable and define it in the same line so I broke it apart and that didnjt work, then i defined the var outside the function, then made it global. then I put the global declaration inside of headTemplate at the top and that didnt work either any other suggestions from the crowd, Im not new at this php thing but this is making me nuts.
  10. Hi all long time no see I tend to keep my layouts in separate files from my main php code and call the layout from within php, most of the time the layout is called within a function also... so heres my problem i have a layout page that contains the code... headTemplate.php <html> <head> <title><?php print $pagetitle; ?></title> ...it goes on from there now head template gets called from index.php like so <?php function show_form($errors = '') { $pagetitle= "BLAH BLAH BLAH"; require_once('templates/headTemplate.php'); } show_form(); ?> but the BLAH BLAH BLAH is not displayed in the title bar of my window, am I somehow throwing this variable out of scope? what could be wrong? thanks
  11. yeah ive been unsuccessful in fixing the 'multiple' part of the select function of formhelpers.php too, but I havent ever needed to use it so i havent put my all into it, but just to let you know, I found an error in it too also, in my expirience most unsubmitted form field have an empty 'value' attribute, I have made many forms using formhelpers.php and tey validate transitional just fine
  12. pfm, error_reporting(E_ALL); reports notices right?, I use this same method in my scripts and always have E_ALL on to me if($var) checks if the variable even exists, where if(isset($var)) checks to see if it both exists and has a value that is not null, in the case above, we know that _submit_check will have a value if it exists, so we don't have to check that it does, we just need to see if its there so what he has is correct, UNLESS it generates a notice... then I have alot of code to rework
  13. can you mark lines 89 and 104, I used this book too and didnt have too much problem with it... didnt type out all the examples though, mostly just looked at them so that I can see how they work, looking at this one, it looks like it should work, now for that validation error that is "making the whole form useless"... i bet its in validate form // size is required if (($_POST['size'] != 'small') && ($_POST['size'] != 'medium') && ($_POST['size'] != 'large')) { $errors[ ] = 'Please select a size.'; } it looks like you need the logical 'or' operator here... what you have, to me, looks like the radio buttons would only validate if all 3 of them are selected, try replacing both sets of && with || then see if it validates //I LOVE this book, it taught me a million and one good things. if there is an error in one of the included scripts, its no big deal, they all seem to have errors, this book is great, stay with it, and continue with its models, and do the exercises at the ends of the chapters Edit: bravo for being so new and creating a near technicaally perfect post, so many newbs here wouldnt use the code tags and the inline images help too welcome
  14. better yet make a page that doesnt use the sliding popup, then have a landing page that allows them to choose, similar to the old flash/no flash pages
  15. i dunno if this is the best way (if you can use mysql) if you have only php at your disposal then using rand() is probably the best way, but if you set the survey to run on the result of 1, then for each user there is a 20% chance that they wont see the survey, it is theoretically possible to go hundreds of users without a survey being served. but if you have a database, you can make a counter, each time $page_count/5 = (int) (when the page count divided by 5 is a whole number) then you can serve the survey, this way guarantees that a survey will be served 20% of the time //sorry no code, im on lunch from work, no time // depending on how many visitors you site gets 20% of the time is probably way too many
  16. you have no logical operators in between 7,8,9 i assume you want the if() to fail if 7 8 and 9 are not set, so try try if (!isset($error1) && !isset($error2) && !isset($error3) && !isset($error4) && !isset($error5) && !isset($error6) && (!isset($error7) && !isset($error8) && !isset($error9))) {
  17. if i remeber right, php has a nifty zip module (like GD) that can assist in this, other than that, it is a matter of making a script that will zip up the right files and setting cron to access it
  18. more code would help please use code tags, its the '#' button above all the smilies
  19. that could partially be solved by a rather complicated regular expression (not my expertise) but there is also a human element to it too, whats to say that awesome1@yahoo.com and awesome2@yahoo.com arent the same guy, but also whats to say that they are. versus if you get entries from joe@joeshmoe.com, and joe1@joeshmoe.com and you go to joeshmoe.com and it is a guy named joe shmoe's personal wordpress blog, so you investigate further... you sign up for an account so you can see the registered users, and what do you know, there is only 2 users, you and joe. in this case you are most certainly dealing with spam since joe obviously has the rights to the domain, he is just setting up emails here and there. but if you got joe@joeshmoe.com and bill@joeshmoe.com, and bill was a constant contributor to joes blog, maybe he is joes neighbor and joe set him up with a free email account. unless you put a 1 entry per MAILING address clause in your terms and then check against all your db entries, it will be hard to stop spam, because email addresses come easy, physicals, not so much, each person probably has home and work, then maybe a PO box also, so at most we are looking at 3 or 4 addresses that a person who really wants to spam your contest can use. beyond that they will be going out of their way to enter your contest, which will probably cost them money (getting more PO boxes) in summation, you are going to have to accept the fact that there will be a limited amount of spam in your contests, the important thing to do is to minimize how much spam 1 person can generate. I personally think that tying their electronic entry to something in the physical world does the best job of that, where logging ip's or any other form of electronic uniqueness (is there such a thing?) does not, because it either eliminates potential entrants (IP log) or is too easy to fudge (email problems we have been discussing)
  20. im going with samshel, please explain in detail, but to me it sounds like you need a database+ajax
  21. store their email address, that will get rid of a lot of multiple entries, I might think. The average person probably has no more than 2 emails and is too lazy to sign up for another. we at php freaks though are not average, since lots of us have our own domains, we have hundreds if not thousands of email addresses open to us, so you may have to look through your database and look for awesome@example.com, awesome1@example.com, awesome2@example.com..... that is probably the webmaster at example.com spamming your contest. on logging the ip, not really a great idea. as milton, employee of initech (who uses a shared connection) leans over his cubicle wall and tells peter about your awesome contest that he just entered, peter can not enter the contest because you have logged and blocked milton's ip, but peter and milton have the same ip
  22. then dont use font, use span see deprecated html tags http://www.codehelp.co.uk/html/deprecated.html
×
×
  • 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.