Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by CroNiX

  1. Did you try just using a foreach and outputting the header? $headers = array( 'HTTP/1.1 200 OK', 'Date: Sat, 09 Aug 2014 00:01:36 GMT', 'Server: Apache/2.2.22 (Ubuntu)', //...the rest ); foreach($headers as $header) { header($header); } exit($html);
  2. Look at the action of your form open tag ... "PHP_SHELF" should be PHP_SELF?
  3. Many many ways. Best to google "css menu dropdown"
  4. head() should be more like <html> <head> ...head code </head> <body> (no closing html!!!) Then create a foot(), which would be something like </body> </html> Then profile would sandwich the actual content between the head() and foot(), like: <?php require_once('Code/Controllers/LayoutController.php'); head(); //create the header ?> <div>This is the profile page</div> //insert the page code in the body <?php foot(); //create the footer which closes the body/html to complete the page ?>
  5. Yeah, I was just going by the example he posted. If he needs that he can just change max(array_keys($arr)) to the number of days in the given month. He also has a "0" day, not sure how that's possible if it's the days of the month.
  6. $arr = $arr + array_fill_keys(range(0, max(array_keys($arr))), 0); ksort($arr);
  7. yes, but I would start with the php documentation and start experimenting. You will learn more than someone just telling you. If you get stuck post the code and someone will surely help, but not many will unless they see that you've at least tried. The 2 choices I would use are the PDO/MySQL driver, or MySQLi driver (with an i). The original MySQL driver (with no i) is deprecated and will do you no good to learn it. There are also tons of tutorials showing how to do this. Manual for PDO: http://php.net/manual/en/book.pdo.php Manual for MySQLi: http://us1.php.net/manual/en/book.mysqli.php Google "pdo tutorial" or "mysqli tutorial" to get some examples. Or even this forum as this topic has been discussed many, many times over the years.
  8. @ginerjm, why do that manually when you could just use parse_str($_SERVER['QUERY_STRING'], $qs); $qs now contains a urldecoded array of key => value pairs.
  9. What kind of database server is it? MySQL or something else? You said "msql" and I'm not sure what that is. If you are going to be accessing the database, and want a way to secure your app a bit more, a user login system will provide more security than what you are wanting to do. Like checking to see if a username/email + password are correct is way more secure than a single "key" in the url, which is visible to anybody near the browser.
  10. I never receive mail from this site either.
  11. Do we need to guess what the url looks like that you are trying to capture something out of? You're not giving us all of the pieces needed for someone to help you.
  12. So you'd have an email field on that same form (which you did), and create an email field in the db for the user account table. Then just add the email field to the rest of the code where you create the user. if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['email'])) { if (createAccount($_POST['username'], $_POST['password'], $_POST['email'])) { Then in createAccount: function createAccount($pUsername, $pPassword, $pEmail) { ... $eUsername = mysql_real_escape_string($pUsername); $eEmail = mysql_real_escape_string($pEmail); ... $sql = "INSERT INTO users (`username`, `password`, `email`) VALUES ('" . $eUsername . "', '" . hashPassword($pPassword, SALT1, SALT2) . "', "' . $eEmail . "');"; Edit: I would also do your check to see if the username already exists before validating the rest of the values. If it exists, there is no need to continue validating the other fields.
  13. As stated MANY times already, only execute 1 query at a time. $query1 = $dbh->query($sql_to_create_pois_table); $query2 = $dbh->query($sql_to_create_pois_tag_table); You'd save yourself a lot of time if you thoroughly read the answers that people are taking the time to write you.
  14. You're building on an unstable foundation and trying to find workarounds. Sooner or later, your unstable building can fall. Especially if you end up getting a lot of traffic. The proper way to do this, and it really wouldn't take long, is to add a new column to the db for your date. Then select all your existing "text" dates, convert them with STR_TO_DATE(start_date, '%m/%d/%Y') and store them in the new column. It REALLY wouldn't take long to FIX the problem instead of masking it. It can be done entirely in SQL. You're also making mysql having to work a bit harder to convert your text dates to real dates. http://stackoverflow.com/questions/16444501/convert-text-date-to-datetime
  15. To expand: everything on the internet has an ip address. That's how it works There are several things you might be able to try as far as checking if members are cheating. None of them will work 100% of the time. -Store IP and Useragent string in db. Only allow impression to count if they haven't visited before. -Set a cookie that lasts for 6 months or something when visiting the impression page. Only count impressions that don't have the cookie present.
  16. It's not as straightforward as it is dealing with HTML forms as PDFs send form data as a FDF file instead of POST/GET. http://php.net/manual/en/intro.fdf.php You might try googling "pdf submit form to php"
  17. What is the column type for your date field?
  18. I take it you fixed this? When I click on the "NO THANKYOU, PROCEED WITH ORDER" it goes to the shopping_cart.php page. Note that "THANKYOU" really should be 2 words.
  19. It would be best to use a db for this, but you can always save a questionnaire to a file and serve that to the users. You could even store a serialized array or whatever you want to do, but personally I'd probably save it as a PDF and serve that to the students as it's more of a universal format.
  20. Not sure as I copy/pasted your code and it ran fine with the exception of not locating the menu_new.php and menu-items.php files (why does one use a underscore and the other a dash?). Anything in the logs? But... why even use php there? All you're doing is creating HTML and echoing it out. Why do you care about formatting the source code with \n?
  21. It means $res = $db->query($sql); didn't work, so $res is NOT an object so you can't use any methods like fetch_row() on it. Your thread is getting very long mixed with all sorts of different problems. It's getting very hard to track it all. You'd best post a new thread for each different problem, and show the complete (updated) relevant code for each one. You will do yourself a HUGE favor by googling the main part of your error messages so you can learn what they mean. When I say "main part" I mean leave things off that are specific to YOUR code. Like google "Call to a member function fetch_row() on a non-object" to learn about that error. If you don't, you will always be clueless as to what's going on and won't ever be able to learn how to troubleshoot your errors or write good code for the future.
  22. You really shouldn't use the mysql driver. It's been deprecated and your code won't work on newer php versions so it's kind of obsolete from the get-go. You won't do yourself any favors learning something that is obsolete. http://php.net/manual/en/migration55.deprecated.php You really should learn to use PDO, and if not that, use the mysqli (with an i) driver.
  23. He meant get rid of all whitespace before the closing XML in your heredoc. instead of: XML; (you have spaces before XML;) it should be XML; (no spaces before XML;)
  24. Probably just set all of your li to background none before your hover code.
  25. I always understood it to be Pre Hypertext Processor Because it gets processed before the hypertext (html) gets sent out to the browser
×
×
  • 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.