Jump to content
Larry Ullman's Book Forums

armlocker

Members
  • Content Count

    83
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by armlocker

  1. I did indeed, just like this: define ('PDFS_DIR', './pdfs'); Error still occurs: An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/add_pdf.php' on line 132: The PDF could not be added due to a system error. We apologize for any inconvenience. The corresponding error on line 132 in add_pdf.php is this: 128 // Clear $file and $_SESSION['pdf']: 129 unset($file, $_SESSION['pdf']); 130 131 } else { // If it did not run OK. 132 trigger_error('The PDF could not be added due to a system error. We apologize for any inconvenience.')
  2. .... I have tried that constant: define ('PDFS_DIR', BASE_URI . './pdfs/'); but still getting this error message: An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/add_pdf.php' on line 65: move_uploaded_file(/path/to/dir/./pdfs/df1bd4fbb72e4547143f5b1d4105ad4a83aec2e0_tmp) [function.move-uploaded-file]: failed to open stream: No such file or directory The line 65 oin add_pdf.php is referring to the config.inc.php constant shown above. But here is line 65 from add_pdf.php: 62 // Move the file to its proper folder but add _tmp, just
  3. .... the 'pdfs' directory is in the web root directory .... and .... is in the same folder as 'add_pdf.php script' .... and .... I'm using a web hosting server ..... hope that helps (The server organisation is the same as Figure 3.3 on page 54)
  4. Hail Larry - 'The Jedi Master of php' I'm at a loss: I contacted the hosting server and been trying all manor of pathways to the the 'pdfs' folder situated on the server. Here's what I've tried, but still the same type of "...failed to open stream: No such file or directory ..." error message. (Interesting research about server directories in the meantime) Already tried, but did not work: define ('PDFS_DIR', BASE_URI . '/ftp.fatcow.com/21/wolfcut/pdfs/'); define ('PDFS_DIR', BASE_URI . '/ftp.fatcow.com/wolfcut/pdfs/'); define ('PDFS_DIR', '/ftp.fatcow.com/21/wolfcut/pdfs/');
  5. ... things I have already tried which hasn't worked: define ('PDFS_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wolfcut/pdfs/'); define ('PDFS_DIR', BASE_URI . 'pdfs/');
  6. .... hiya Marg .... no frustration at all. I really enjoying this learning process .. AND ... this forum speak soon no doubt
  7. Hail All I have a problem with naming the location of the pdfs file in the config.inc.php file, which is preventing me from uploading pdfs: config.inc.php define ('BASE_URI', '/path/to/dir/'); define ('BASE_URL', 'www.wolfcut.co.uk/'); define ('PDFS_DIR', '/wolfcut/pdfs/'); define ('MYSQL', BASE_URI . 'mysql.inc.php'); root directory files on my web hosting server (fatcow) /wolfcut/pdfs/ and /wolfcut/includes/config.inc.php error message move_uploaded_file (/home/users/web/b1384/moo.laissezfairelondonco/wolfcut/wolfcut/pdfs/2 05c5187b34579c5cffbadd181853f3eea53
  8. ALL SORTED GUYS Yep , it was my mistake again (as usual). Here's the solution: SOLUTION: I didn't populate the database, hence why the Variable ['categories'] could not be found. All I had to do was copy the SQL commands from Larry's downloads and insert them into PHPMYADMIN. School Boy Error, but what a great learning experience. I now know the are 8 types of variable, what the are.... etc.... I know its not the conventional way of learning, but jumping in the deep end and tackling problems when the arise suits my style. Please continue to give me hints and tips as to where I go
  9. Thanks Margaux, I have the book, but even that can be perplexing at times. Please take a look at the code from add_page.php: ============= <? require ('./includes/config.inc.php'); redirect_invalid_user('user_admin'); $page_title = 'Add a Site Content Page'; include ('./includes/header.html'); require ('./includes/mysql.inc.php'); $add_page_errors = array(); // Check for a form submission: if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Check for a title: if (!empty($_POST['title'])) { $t = mysqli_real_escape_string($dbc, strip_tags($_POST['title'])); } else { $add_page_errors['tit
  10. The typo ')' you amended still leads to the same thing: "Please select a category!" Here's the complete error message: (its a long one).... ============ An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/add_page.php' on line 34: Use of undefined constant var_dump - assumed 'var_dump' Array ( [0] => Array ( [file] => /hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/add_page.php [line] => 34 [function] => my_error_handler [args] => Array ( [0] => 8 [1] => Use of undefi
  11. Hi Jon When I try the variation code, I get this: Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in /hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/add_page.php on line 33 I can't see where the syntax error is because I have copied the code thoroughly from the page 109. =============== When I try the orginal code, there is no error message. Only keeps asking me to "Please select a category!"
  12. Hello again. Problem: Every time I am logged in as administrator to add content, it doesn't allow me to submit the "Add This Page". Instead, it keeps asking me to "Please select a category!" - which I have. Current code I am using for 'validating category' (as on page 109) if (filter_var($_POST['category'], FILTER_VALIDATE_INT, array('min_range' => 1))) { $cat = $_POST['category']; } else { // No category selected. $add_page_errors['category'] = 'Please select a category!'; } What I have tried I have tried the other variation of: if (isset($_POST[
  13. Thanks Larry! I mean it. Thank you for dedicating so much time on the forums for everyone, and the great books on the subject. It's going to help a lot of people get ahead and become self-sufficient. Best wishes to you and all the advisers on these forums - really, if anyone is listening, where else can complete strangers get help like this from other complete strangers in such a way.....
  14. on the brink of New Year with one last question before 2013.... Parse error: syntax error, unexpected T_STRING in /hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/includes/login.inc.php on line 27 This is really obvious (sytax error), not so, because I have been through each line over 10 times; compared it to the code in the Ecommerce book and copied / paste from the downloaded code. So I can't see where I have left out a bracket or a semi-colon. Here's the code for login.inc.php from example one: <?php $login_errors = array(); if (filter_var($_POST[
  15. Thanks Larry - interesting read. Something I will have to delve into after I complete both your examples in the Ecommerce book. In the meantime I've made good with SHA1 and amending the database to CHAR (40), as suggested on page 135 of the php and mysql book (4th edition) Speak soon, I'm working on the login.inc.php script and encountering errors there too. Hopefully I can make full use of your brilliant books.
  16. Hi Larry - I used varbinary because that was the example given in the Ecommerce book. Apparently hash_hmac doesn't work on my hosting server, so I made do with SHA1, what do you recommend I use instead? Best wishes for 2013
  17. I am also having this Fatal Error message in the login.inc.page: Call to undefined function_get_password_hash() I tried the above technique by changing it to SHA1 ($p), but it doesn't seem to work this time. Any suggestions? by the way.... Happy New Year!
  18. woooo - hoooo. Problem solved.... here's how: firstly: went into mysql.inc.php and changed the "mysql_real_escape_string" from hash hmac to simply SHA1 secondly: went into register.php and on "INSERT INTO..." line where you add user to database, I deleted the "create_password_hash" and replaced it with "SHA1" thirdly: upon registering a new user, I magically recieved an email confirmation without "Fatal Error" Thank you Jonathon for giving me the lead on this. I then found out the rest using a combination of PHP and MySQL (4th edition) by Larry to understand the all about pa
  19. PHP VERSION 5.3.13 PHPMYADMIN VERSION 5.0.91 Hello everyone. One simple question: if my hosting server doesn't support hash_hmac(), where do I insert this line of syntax in the 'registration.php' file as advised on page 79, chapter 4: return mysql_real_escape_string ($dbc, sha1 ($password, true)); Error message goes like this: Fatal error: Call to undefined function create_password_hash() in /hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/register.php on line 72 Line 72 of register.php goes like this: $q = "INSERT INTO users (username, email, pass,
  20. Thank you everyone! I am learning a lot already. It wont be the last question I post on this forum though.
  21. OMG ==== you are an absolute genius Totally worked: Before I had this in the index.php: require ('MYSQL'); And upon your advice, it is now this: require ('./includes/mysql.inc.php'); I'm not sure if you have the Larry's book, but I must have mis-understood what he meant on page 70 ".....The database connection script can be included by referring to the MYSQL constant, defined in the configuration file. This means that even if you change the name or location of mysql.inc.php, you have to change only one line in the configuration file and all your pages will still include that sc
  22. Hiya - I'm having difficulty connecting to the database with the mysql.inc.php. Here's the error message: <-- error message ========== An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/index.php' on line 9: require(/home/users/web/b1384/moo.laissezfairelondonco/wolfcut/wolfcut/includes/mysql.inc.php) [function.require]: failed to open stream: No such file or directory ========= --> Really basic, I know, but I'm trying to follow an examples between pages 49-71 in the ecommerce book and the above error keep happening. As far as I can
  23. Hiya - I'm having difficulty connecting to the database with the mysql.inc.php. Here's the error message: <-- error message ========== An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/index.php' on line 9: require(/home/users/web/b1384/moo.laissezfairelondonco/wolfcut/wolfcut/includes/mysql.inc.php) [function.require]: failed to open stream: No such file or directory ========= --> Really basic, I know, but I'm trying to follow an example in another book and the above error keep happening. As far as I can gather, the 'user, password
  24. ..... begining of code goes like this: <?php require ('./includes/config.inc.php'); require (MYSQL); if ($_SERVER['REQUEST_METHOD'] == 'POST') { include ('./includes/login.inc.php'); } include ('./includes/header.html'); ?> <h3>Welcome</h3> <p>Welcome to Knowledge is Power, a site dedicated to keeping you up to date on the Web security and programming information you need to know. Blah, blah, blah. Yadda, yadda, yadda.</p> ========================== I've paid up for a hosting company 'Fatcow', so do I still need that open?
×
×
  • Create New...