Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Actually I am concerned about the input since I don't see a form tag nor a submit button. So just how do you even know that your data is arriving at your php point? I also agree with everything the Maxdd says. Nor do I see any imput for 'student_id'. Nor do I see anywhere that your message could be produced. Nor do I understand why you do a 'die' followed by an attempt to re-direct to yourself if the date update fails (which won't work).
  2. It appears that you have one set of values which work and the second set is empty which causes the query to fail. Don't know what value1 and value2 are. What are you referring to by "first loop"? Can't you simply echo this stuff instead of logging it to make it a bit easier to read?
  3. As Psycho said - you are doing the bind correctly. So: How about doing this to your code: foreach($obj as $assocArray) { $id = $assocArray['id']; $name = $assocArray['name']; echo "id is $id name is $name<br>"; if (!$stmt->execute()) // execute the query echo "Execute failed to run"; } And see what happens as you loop thru your data.Note I threw in a check for a failure on the execute. One should do this always,perhaps adding an output of the error message.
  4. can we see how you changed your code to accomplish this? Kind of silly to just post some output and ask us to debug that...
  5. You buried a php tag inside the heredocs. I'm curious how that works. Try putting an echo statement right after line 324 to see if you are getting to that point when the script is run the FIRST time (when it has to display the screen for the first time). PS - since you have buried all of my code inside a much larger script, try moving my error checking up to the beginning of your bigger script to catch any and all errors.
  6. Don't you have to bind after you have assigned the values?
  7. Since, as I understand it, session data is stored on the server, and in order for a hacker to get to it he would first have to have the id, how does using a static id (set in your 'secure' function) make it more difficult to hack the session data what with everyone running with the exact same id?
  8. Close, but no cigar. Only post the code in the box, not your text. And try and isolate your problem to the relevant code and only give us that much. Is "start_secure_session" something that you have written? I don't find it in the manual is why I ask. Does it return a value that s/b checked?
  9. Are you going to write an appl to handle this thing? When you say templates do you mean multiple (as in many) unique layouts for a final product into which you wish to plug varying and different numbers of values into? With a little practice and experimentation you could use a php script and FPDF to create your tmeplates and have the script read in your csv file and post the values into the template very easily.
  10. True. You have 3 args in your call to prepare. So why is that? Check the manual and you'll see what the proper format is. http://us2.php.net/manual/en/pdo.prepare.php PS - What is $this in your Redeem function? You don't have an object in there to make your call to db->prepare with.
  11. Actually your code is kind of a mess. You don't do any checking to see if any of your inputs are set. You don't validate or sanitize them. and you don't handle the errors that will arise from your script as it is now written. I've taken the liberty to re-arrange your code and to structure it a little bit to make the whole thing a bit easier to comprehend. I added error checking (ALWAYS TURN IT ON!!!) so you can see the problems you have. NOTE HOW I HAVE ALSO POSTED THIS CODE USING THE FORUM-MANDATED CODING TAGS. PLEASE USE THEM NEXT TIME. <? /* * * */ //*********************** error_reporting(E_ALL | E_STRICT | E_NOTICE); ini_set('display_errors', '1'); /*SET THIS RIGHT BELOW AS THE FORM RECIEVING EMAIL*/ $webmaster_email = "__________@gmail.com"; /* This bit sets the URLs of the supporting pages. If you change the names of any of the pages, you will need to change the values here. */ $feedback_page = "feedback_form.html"; $error_page = "error_message.html"; $thankyou_page = "thank_you.html"; //***************** // Begin //***************** //***************** // if (!isset($_POST['btn'])) { DisplayPage(); exit(); } if ($_POST['btn'] == 'Submit') { /* This next bit loads the form field data into variables. If you add a form field, you will need to add it here. */ /* First section of variables are for the Items/Food */ $food1 = $_POST['food1'] ; $onefudgebrownie = $_POST['onefudgebrownie'] ; $food2 = $_POST['food2'] ; $fouritalianbiscotti = $_POST['fouritalianbiscotti'] ; $food3 = $_POST['food3'] ; $foursoftchewychocolatechipcookies = $_POST['foursoftchewychocolatechipcookies'] ; $food4 = $_POST['food4'] ; $fourcapecodcranberryoatmealcookies = $_POST['fourcapecodcranberryoatmealcookies']; $food5 = $_POST['food5'] ; $oneloafofartisanfrenchbread = $_POST['oneloafofartisanfrenchbread'] ; $food6 = $_POST['food6'] ; $sixkaiserdelirolls = $_POST['sixkaiserdelirolls'] ; $food7 = $_POST['food7'] ; $sixsofthamburgerrolls = $_POST['sixsofthamburgerrolls'] ; $food8 = $_POST['food8'] ; $sixfiveinchsubrolls = $_POST['sixfiveinchsubrolls'] ; $food9 = $_POST['food9'] ; $twelvetwoinchsliderrolls = $_POST['twelvetwoinchsliderrolls'] ; $food10 = $_POST['food10'] ; $foursnkickerdoodlecookies = $_POST['foursnkickerdoodlecookies'] ; $food11 = $_POST['food11'] ; $onecolossalcinnamonstickybun = $_POST['onecolossalcinnamonstickybun'] ; $food12 = $_POST['food12'] ; $onedeliciouswhoopiepie = $_POST['onedeliciouswhoopiepie'] ; $food13 = $_POST['food13'] ; $fourislandcoconutmacaroons = $_POST['fourislandcoconutmacaroons'] ; /* This second section of variables are for the Shipping/Customer Info*/ $shippinglastname = $_POST['shippinglastname'] ; $shippingfirstname = $_POST['shippingfirstname'] ; $telephonecell = $_POST['telephonecell'] ; $emailaddress = $_POST['emailaddress'] ; $breifdescript = $_POST['breifdescript'] ; // If the user tries to access this script directly, redirect them to the feedback form, if (!isset($_POST['email_address'])) { header( "Location: $feedback_page" ); } // If the form fields are empty, redirect to the error page. elseif (empty($email_address) || empty($comments)) { header( "Location: $error_page" ); } // If email injection is detected, redirect to the error page. elseif ( isInjected($email_address) ) { header( "Location: $error_page" ); } // If we passed all previous tests, send the email then redirect to the thank you page. else { mail( "$webmaster_email", "Feedback Form Results",$comments, "From: $email_address" ); header( "Location: $thankyou_page" ); } } //****************** echo "Unhandled button "; exit(); //****************** //****************** //****************** /* The following function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list. */ function isInjected($str) { $injections = array('(\n+)','(\r+)','(\t+)','(%0A+)', '(%0D+)','(%08+)','(%09+)'); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } function DisplayPage() { $code=<<<heredocs <form action="send_mail.php" method="post"> <table align="left"> <tr> <td> <input type="checkbox" name="food1" value="" /> 1 Fudge Brownie</td> <td><input style="color:#000000" type="number" name="onefudgebrownie" /> </td> </tr> <tr> <td> <input type="checkbox" name="food2" value="" /> 4 Italian Biscotti </td> <td><input style="color:#000000" type="number" name="fouritalianbiscotti" /> </td> </tr> <tr> <td> <input type="checkbox" name="food3" value="" /> 4 Soft & Chewy Chocolate Chip Cookies</td> <td><input style="color:#000000" type="number" name="foursoftchewychocolatechipcookies" /> </td> </tr> <tr> <td> <input type="checkbox" name="food4" value="" /> 4 Cape Cod Cranberry Oatmeal Cookies</td> <td><input style="color:#000000" type="number" name="fourcapecodcranberryoatmealcookies" /> </td> </tr> <tr> <td> <input type="checkbox" name="food5" value="" /> 1 Loaf of Artisan French Bread. </td> <td><input style="color:#000000" type="number" name="oneloafofartisanfrenchbread" /> </td> </tr> <tr> <td> <input type="checkbox" name="food6" value="" /> 6 Kaiser Deli Rolls </td> <td><input style="color:#000000" type="number" name="sixkaiserdelirolls" /> </td> </tr> <tr> <td> <input type="checkbox" name="food7" value="" /> 6 Soft Hamburger Rolls</td> <td><input style="color:#000000" type="number" name="sixsofthamburgerrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food8" value=""/> 6 5 sub rolls</td> <td><input style="color:#000000" type="number" name="sixfiveinchsubrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food9" value="" /> 12 2" slider rolls</td> <td><input style="color:#000000" type="number" name="twelvetwoinchsliderrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food10" value="" /> 4 Snickerdoodle Cookies</td> <td><input style="color:#000000" type="number" name="foursnkickerdoodlecookies"/> </td> </tr> <tr> <td> <input type="checkbox" name="food11" value="" /> 1 Colossal Cinnamon Sticky Bun</td> <td><input style="color:#000000" type="number" name="onecolossalcinnamonstickybun"/> </td> </tr> <tr> <td> <input type="checkbox" name="food12" value="" /> 1 Delicious Whoopie Pie</td> <td><input style="color:#000000" type="number" name="onedeliciouswhoopiepie"/> </td> </tr> <tr> <td> <input type="checkbox" name="food13" value="" /> 4 island coconut macaroons</td> <td><input style="color:#000000" type="number" name="fourislandcoconutmacaroons"/> </td> </tr> <tr> <td>Comments/Special Requests:</td> <td> <textarea rows="10" cols="50" name="comments" style="color:#000000" ></textarea> </td> </tr> </table> <br></br> <!--Shipping info/Personal Info Table --> <h3 align="left"> Shipping Information </h3> <table align="left"> <tr> <td>Last Name:</td> <td> <input style="color:#000000" type="text" name="shippinglastname" value="" maxlength="15" /> </td> <td>First Name:</td> <td> <input style="color:#000000" type="text" name="shippingfirstname" value="" maxlength="10" /> </td> </tr> <td>Telephone/Cell.:</td> <td> <input style="color:#000000" type="text" name="telephonecell" value="" maxlength="100" /> </td> <td>Email Address:</td> <td> <input style="color:#000000" type="text" name="emailaddress" value="" maxlength="100" /> </td> </tr> <tr> <td>Brief description of location on the lake:</td> <td> <textarea rows="10" cols="50" name="breifdescript" style="color:#000000"> </textarea> </td> </tr> <!--SUBMIT BUTTON --> <tr> <td> </td> <td> <input type="submit" name='btn'value="Submit" style = " background-color:#87D163; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius:6px; color: #fff; font-family: 'Oswald'; font-size: 20px; text-decoration: none; cursor: pointer; border:none; submit:hover { border: none; background:#000000; box-shadow: 0px 0px 1px #777; }" /> </td> </tr> <!--SUBMIT BUTTON end --> </table> </form> heredocs; echo $code; return; } I also changed your code to use $_POST instead of request. Request is not recommended.Try running this and see what happens.
  12. Actually I don't think it is re-directing. Your script starts off with all your html being output before it does any php. You can't execute a header command at that point. Turn on php error checking and do your php before you send any html output. See what you get then.
  13. Your connection var is NOT defined at the top of your class, hence my comment. It is defined as a local var within your constructor and nowhere else, hence again why things aren't working. Meanwhile, you still have a lot of code to correct to utilize the mysqlI_ extension instead of the old MySQL_ one. You can't mix the two you know.
  14. I asked for a 'snippet'. Not the whole code.
  15. Can you show the snippet that "works without $disp.>". It would be very interesting to see what you think is working.
  16. Why don't you show us that code that fails.
  17. Your is so much coding for such a simple process..... Anyway the problem is your class is not well thought out. In your query function where you try to execute a query, where is $myconnection defined? Hint: Not in that function.
  18. echo displayTomorrow() has to fail as you've showed it. It has to be written just like your displayToday call. Question. Why the extra braces in each of your methods?
  19. My final saying on this post. You are choosing to IGNORE what Psycho told you - a guy with over 10k posts! - and proceeding to waste your time developing for a flat file system that will NOT be able to be used in the fashion I described for you, which YOU YOURSELF thought was awesome. Really? Tell me you aren't going to be silly about this.
  20. Yes of course it's possible - not likely tho. If I were doing this, I would do it this way: 1 - store each day's post(s) in a db table with the date as the key field. Or perhaps, the date and a sequence number if you wanted to have multiple posts per day ie, multiple records per day. 2 - use php to build a dynamic dropdown to select the available month/year posts 3 - use a second dropdown built with ajax to show the available days for the month/year selected in #2 4 - use ajax again to then show the post(s) for the specific day selected in #3. No nav bar cause it's not really (imho) navigation, but merely selection. I don't think you want to put any references to individual posts in a nav bar or immediately in a dropdown. You're probably going to have way too many posts to be able to present them to the user that way. Let the user drill down to the item he wants to see. Of course when the page is first displayed, I'd actually show the user the current day's post and then he/she can use the dropdowns to move to a different one. Maybe even a button to automatically go back one day and another button to go forward one day.
  21. Didn't follow all the of the code - too much to piece together since we don't know how they are connected. But - have to ask - what exactly is a <piece> tag? I do not see that listed in my html reference (incl. 5).
  22. <?php echo "<img src='user/" . $log_username . "/" . $main_image . "' width='130' height='150' id='pic5'/>"; ?>
  23. Your error (which I've never seen) is not a php error. If that is JS code next to the message above, perhaps you should post on the js forum
×
×
  • 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.