Jump to content

bachya

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bachya's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Never mind - figured out that I needed to add a "return false;" so that the script wouldn't move past that button. :)
  2. Hi all, I have a form that uses CAPTCHA as a means of verification that the submitter is not spambot, or anything similar.  I have a button next to the place where the user is supposed to input the letters/numbers in the image: <button onclick="NewVerifyImage();">New image</button> ...and the NewVerifyImage() function looks like this: <script language="javascript" type="text/javascript"> var nReload = 5; function NewVerifyImage() {     if (nReload <= 2)         if (nReload <= 0)         {             alert("Sorry, too many reloads.");             return;         }         else             alert("Only " + nReload + " more reloads are allowed");     nReload--;     document.vimg.src = "verifyimg.php"; } // --> </script> This calls a script called verifyimg.php, which would generate a new CAPTCHA image and place it in the image called "vimg" - however, when I click this "New Image" button, it's as though I've clicked submit - the form goes to the page I redirect the user to when info has been submitted. Does anyone have any idea why it seems like this button is not calling the function properly? Thanks!
  3. Okay, so I finally was able to echo my path, piece by piece, and this code: [code]echo $_GET['issue'].'/'.$_GET['article'].'.html'[/code] ...gave this result: sp06/1.html (when my URL was www.mydomain.com/articles.php?issue=sp06&issue=1) Still no dice - as I said before, the problem is (I believe) coming in the part of the code below that is the ELSE branch to the "file_exists" function: [code]<?php     if (isset($_GET['article']))     {         if (file_exists($_GET['issue'].'/'.$_GET['article'].'.html'))             include($_GET['issue'].'/'.$_GET['article'].'.html');         else             echo $_GET['issue'].'/'.$_GET['article'].'.html';     }     else     {         include($_GET[issue].'/default.html');     } ?>[/code] Since it's echoing the path correctly, that must mean that "file_exists" is having a problem with it. Unfortunately, I'm newbie enough to PHP that that doesn't help me. [b]EDIT:[/b] Okay, it definitely is "file_exists", because if I remove that, it includes correctly. However, now I've just left a huge hole in my site...sheesh. Does anyone know why this function is giving me so much trouble?
  4. [!--quoteo(post=386475:date=Jun 21 2006, 12:36 PM:name=Buyocat)--][div class=\'quotetop\']QUOTE(Buyocat @ Jun 21 2006, 12:36 PM) [snapback]386475[/snapback][/div][div class=\'quotemain\'][!--quotec--] What exactly is the error you are getting? It looks like the file that will be included will be something like this: public_html/issue_dir/article_html.html I am assuming the public_html. At any rate, the problem I see is that you're GET[ ] needs to have 's around the strings, so $_GET['article'] instead of $_GET[article]. Otherwise I'm not sure what else is wrong. [/quote] The scary thing is that there is no error - it's just a blank page (with my main CSS layout). I tried adding 's around the variable names in $_GET[], but that didn't seem to help. [!--quoteo(post=386476:date=Jun 21 2006, 12:40 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 21 2006, 12:40 PM) [snapback]386476[/snapback][/div][div class=\'quotemain\'][!--quotec--] Maybe try echo'ing your path to see how it looks? eg; [code] echo $_GET['issue'].'/'.$_GET['article'].'.html'); [/code] Your code looks fine so....what exactly do you meen by? [/quote] Unfortuantely, that ALSO gives a blank page...it's baffling, because that should be right. I'm assuming it's incorrect because the desired results aren't appearing. :( I noticed that it echoes output in the ELSE part of the branch to check if the file exists or not...if that helps at all.
  5. Hi all, I have this bit of code: [code]<?php     if (isset($_GET[article]))     {         if (file_exists($_GET[issue].'/'.$_GET[article].'.html'))             include($_GET[issue].'/'.$_GET[article].'.html');         else             include($_GET[issue].'/default.html');     }     else     {         include($_GET[issue].'/default.html');     } ?>[/code] What I need is this: if I have a URL that's something like - www.mydomain.com/articles.php?issue=sp06&article=1 - I want to use both the "issue" and "article" variables to descend into my directory structure and include the necessary article. The directory is something like this: articles.php sp06 -> 1.html 2.html ... fl06 -> 1.html 2.html ... ...and so on. The above implementation is incorrect - perhaps my knowledge of concatenation in PHP is flawed... Can anyone point me in the right direction? Let me know if the above info is not adequate. Thanks.
  6. [!--quoteo(post=383356:date=Jun 13 2006, 12:51 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 13 2006, 12:51 PM) [snapback]383356[/snapback][/div][div class=\'quotemain\'][!--quotec--] You really should be checking the existance of any file before you try to include it anyway, otherwise your current setup has a [b]major[/b] security hole in your site. All you need do is check the file and querystring exist, if it does, include it, otherwise load a default. eg; [code] if (isset($_GET[article])) {   if (file_exists($_GET[article]."html")) {     include $_GET[article]".html";   } else {     include "default.html";   } } else {   include "default.html"; } [/code] PS: All this can easily be done in asp also. [/quote] How would I accomplish the above in ASP? For whatever reason, ASP is slightly more confusing to me...
  7. Hi all, I'm fairly new to PHP, and I have a question about dynamic content that's loaded through a URL variable. My site uses a line like this: <?php include("$_GET[article].html") ?> ...to dynamically include text into a laid out page (in a URL like www.mysite.com/articles.php?article=34). I like this, because it's simple (whereas, in ASP, I would have to have a large case statement with every possible article). However, I'm wondering if it's possible to have "default content" should someone enter something like: www.mysite.com/articles.php (no variable on the end). Is this possible, while STILL keeping intact my one-line inclusion from above? Or is something like a case statement the only way to have "default content?" Thanks! :)
×
×
  • 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.