Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by phppup

  1. I'm new to AJAX, and I'm working with some 3rd party code as a learning tool.

    Came across this section but:


        type: "POST",  
        url: "my_code.php",  
        data: "username="+ usr,  
        success: function(msg){  

    I would prefer NOT having a my_code.php file, but rather to include the PHP code as part of the single file that already contains all the other scripting.

    Can this be achieved? What do I need to put in the URL line to direct it to self-examine?

    Pros and cons of proceeding this way?


    Thanks folks.

  2. I'm no expert, but in an effort to assist, I would think some simple troubleshooting is in order.

    For starters, your code says:

    if($mail->send()){ header('Location: thank-you.html'); // redirect to 'thank you' page

    } else {

    $errorMessage = 'Oops, something went wrong. Mailer Error: ' . $mail->ErrorInfo;



    So, my first question is: After you send a test email do you EITHER get redirected to the Thank You page OR see the ERROR?

    The answer to this question should at least get you started in a direction with analysis.

    PS: Experience has taught me to check inbox and SPAM folders. Also, there is sometimes a delay on receiving emails from strange addresses depending on your service provider.

  3. I'm not even sure I understand the question, BUT it seems from


    return an error message "Invalid parameter(s) for the date!" if passing an invalid parameters to this function.

    that you need to write a function that will analyze the calendar entries.

    The depth to which you go is up to you, but for starters you would need to determine which months have 30 days and which have 31. 

    Just as there would be no acceptable MONTHS > 12, there is also no date of September 31 or October 32.

    Of course, February and Leap Years will be the biggest challenge.

    My solution: Tell the instructor that all inputs will come from drop-down menus and go get a coffee.

  4. Yup. Already realized that, and appreciate the insight.

    But aside from a message/disclaimer advocating that the user "Hurry before the name is removed" there's really not much else to be done.

    [I suppose I could INSERT the name immediately and DELETE it if registration isn't completed within a given timeframe, but that seems like a lot of work in the babe of "convenience"... LOL]

    I guess the overriding questions are still: is it worth the effort? Does it compromise the website's security?

  5. This IDEA would be implemented in a REGISTRATION form, NOT a sign in.  The effort is strictly for user convenience to allow someone to check whether a username is available before completing additional steps to register.

    As for Little_Bobby_Tables, I would think that underscores in a name are harmless (and acceptable). So it's not about the name, but the additional characters that should be disallowed.

    My concern is the overall safety and security of the website, and NOT compromising it for user convenience.

    As for password strength, how much of that burden should be placed on the user?  If a user wants a weak password (and knows it is weak), is there a reason that I should not allow it to be acceptable?


  6. That sounds a tiny bit contradictory.

    I mean, changing a message is simple enough, but the end result will be the same.

    Wouldn't a simple user be unfazed by the terminology?

    Wouldn't a seasoned hacker read right through the thin veil?

    Is this REALLY something to stay away from?

    Please also address my other questions within the post.

    Are there characters or names that users should find unavailable. Is it safe to allow a user access to the name ADMIN? Or PHP? etc.

    And what about code alternatives? Which are best? Which to avoid?

  7. I want to accomplish two things: save some server overhead and create a friendlier user experience.

    Thus, prior to form submission, the user should have the opportunity to check whether the chosen username is available.

    As I've begun researching the topic, I've discovered AJAX, Vue, and XMLHttpRequest alternatives.


    Any suggestions and alternatives that would give me guidance would be appreciated.


    Additionally, are there any characters that should be expressly prohibited from use in a username (or other input field) that could aid malicious hackers in causing harm to my website, database, and files?



  8. Sorry, I never used Fiddle, etc.

    The images would go behind.

    Going back to the "window blinds" metaphor, imagine you extended a closed blind on the ground. Now you place a pizza box on top of it.

    The slats may overlap top to bottom (that's my secondary issue), but you will visibly see the right and left portions of each slat running from either end toward the center.

    The positioning and sizing is not the problem, yet.

    The real issue is establishing a single container with a right wing and a left wing that is positioned as a single unit.

    One instance (slat) is fine.

    But, repetitions jumble or hide the images when the code is like this:


    <div  id='one of many'>

    <div style="z-index: -9; position: absolute">

             <img src="red.jpg" " >

               <img src="red.jpg" >


    <div  style="z-index: -6; position: relative; float: right" >

         <img src="red.jpg" >

          <img src="red.jpg" >



    <div  id='two of many'>

    <div style="z-index: -9; position: absolute">

             <img src="red.jpg" " >

               <img src="red.jpg" >


    <div  style="z-index: -6; position: relative; float: right" >

         <img src="red.jpg" >

          <img src="red.jpg" >



    It will function with ten <br> between each container, but the <br> causes displacement in other areas of the page.

    My thinking is that there's a triggering based on the size of the small image I am using. Once I 'clear' a certain placement. That is why I feel the problem is my use of ABSOLUTE and RELATIVE, but I haven't found a solution.

  9. At this point, which images to use, their size, etc. is not a concern (which is why I wanted a design that could offer flexibility later).

    What is a concern, is the ability of placing a table, form, or larger image in the center of the webpage as a central overlay.

    Additionally, if I wanted the lines of images to overlap (similar to the slats on a set of window blinds), then i believe the z-index comes into play (and is not functional without a "position" reference [think I read that somewhere].

    I've gotten a reasonable result from the code that I posted initially. BUT, when I place a second container (id='second of many') into the mix [essentially duplicating the code], the entire flow goes haywire.

    I'm guessing it has to do with my use of ABSOLUTE and RELATIVE, but I cannot seem to find the correct combination on my own 



  10. Probably as rudimentary as things can get, but I'll give it a try:

    On a webpage where X,Y,& Z each represent individual images.


    Left side ........................... Right side

    X X X                                      X Z X 

    X Z X                                      Y Y X 

    X Y Y                                      Y Z X 


    with each side beginning at it's extreme end of page.

    Some overlap may occur, so a z-index capacity is necessary.



  11. Quote




    Battlig with this code all weekend, and not getting the result I want.

    This bit of code should offer an understanding, but I'll explain more after removing the FAILED efforts.


    <div  id='one of many'>

    <div style="z-index: -9; position: absolute">

             <img src="red.jpg" " >

               <img src="red.jpg" >


    <div  style="z-index: -6; position: relative; float: right" >

         <img src="red.jpg" >

          <img src="red.jpg" >



    This sort of works, but really doesn't because when the code is REPEATED to create a second, third, etc. row, images are dislodged and hidden or lost completely.


    The end result that I am trying to achieve is:

    A set of images beginning from left to right.

    A set of images on the SAME axis/line beginning at right to left (heading for a collision midway).

    The ability to repeat this SINGLE double-ended row multiple times consecutively while maintaining the location of the images.

    NOTE: currently I have kinda achieved my goal with <br /> but this is NOT acceptable because other elements on the page get shifted rather than being layers that are positioned accordingly on the page.

    The ability to successfully repeat the process has been the kink that unravels the process.

  12. In a PHP file [php_one.php], I wrote some PHP code that contained a form.  I used ECHO to write the HTML inside of the PHP tags.

    On another PHP page [php_two.php], I wanted to show the code that was used to create the first page [php_one.php].

    My first effort provided an interesting result, since the PHP code was readable.  However, all HTML code was visible in its executed form.

    There was an actual input field and a submit button (not the code used to produce them) in the context of my coding.

    I have tried using:

    $array = file("FILE")

    All results were similar and carried the same problem.

    How can I view code so that even the HTML is visible as code?

  13. Quote

    if you are asking this because the mysqli prepared query programming interface is ridiculously overcomplicated and inconsistent, switch to the much simpler, more consistent, and better designed PDO extension. 

    Can I establish the binding by using the PDO prepared statement while all other code is procedural?

  14. In lieu of prepared statements, will this work effectively?  Is it overkill?

    $username = mysqli_real_escape_string($conn,$_POST["username"]);
    	$username = strip_tags(trim($username));

    Can I write it this way:

    $username = mysqli_real_escape_string($conn,strip_tags(trim($_POST["username"])));

    Are prepared statements a guarantee for defeating an injection attack?  Or should they be used in conjunction with the above (or other) coding to bolster a database's defenses?

  15. @requinix  YES, I am beginning to think that low grade server fees come with a high price.

    I suppose I should be happy that I've excelled to the point of catching the errors and seeking [something closer to] perfection.

    Although it may have been easier when I didn't notice these mistakes and was simply happy to have a result generated.  LOL

  16. And while we're discussing anomalies, I am trying to determine when a SUBMIT button with a value = 'submit' is clicked.

    $A = $_POST['click1'];
        echo "<br>1 ".$A."<br>";echo "<br>2 ".$_POST['click1']."<br>";
    if(isset($A))  { echo "YES, the value is: ". $A; } else { echo "NO the value is: " . $A; }
    if(isset($A))  { echo "YES, the value is:".  $_POST['click1']; } else { echo "NO the value is: " .  $_POST['click1']; }
    if(isset($_POST['click1']))  { echo "YES, the value is: ". $A; } else { echo "NO the value is: " . $A; }
    if(isset($_POST['click1']))  { echo "YES, the value is:".  $_POST['click1']; } else { echo "NO the value is: " .  $_POST['click1']; }

    None of my echo messages are grabbing $A, although I seem to have it declared.

    What did I do wrong here?

    Is there a better way to determine if a specific input='submit' is selected?

  17. While playing with some code, I wrote these few lines of script.

    $_SESSION["favcolor"] = green;
    echo "Session variable is ". $_SESSION["favcolor"] ;

    I tested the code and everything worked fine.
    But then, I noticed an error in my coding: I had accidentally forgotten the QUOTES around the word GREEN.

    I corrected the code

    $_SESSION["favcolor"] = "green";

    But when I tested it, the page would not open/load.

    Then I removed the quote marks and restored the line to it's original state

    $_SESSION["favcolor"] = green;

    And things worked fine.

    Shouldn't the quote marks be required?
    Why am I having this issue?
    Is it really an issue, or should I just accept that it works WITHOUT the quotes and be satisfied with that result?

  18. @requinix

    I don't know EXACTLY what you think I should "look carefully" and hope to see.

    If it was obvious, i'd have already spotted it, and not have asked the question.

    The best I can summize that you're eluding to is that errors occur.

    But do those errors affect the end result?

    In an instance where I do, in fact, know what tables are in my db, the question is even more appropriate: was NOT EXIST created for only lazy db designers??

    Or is there a realistic usage?

  19. I have discovered that if I try to create a table within a database,  and the table name already exists, the existing table remains intact.

    It does not get overwritten or removed. And my code has error messaging to indicate the disparagy.

    Likewise, there is built in SQL errors that will be thrown (if made visible).

    So, is there any benefit to using:


    as opposed to just CREATE TABLE when writing code??

  20. I have a form with several text fields.

    For example (sorry, no code insert option on my phone)


    <form method="post"> Enter value1 :<input type="text" name="str1"><br/> Enter value2 :<input type="text" name="str2"><br/> <input type="submit" >

    I would like to scan the INPUTS to determine which fields were left empty.

    Using !isset (to the best of my knowledge) would require that I list each input individually.

    Is there a PHP alternative that, similar to JavaScript, would allow me to evaluate every INPUT or TEXT field to then list those left empty?

  • 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.