Jump to content
Larry Ullman's Book Forums


  • Content count

  • Joined

  • Last visited

  • Days Won


Necuima last won the day on June 13 2017

Necuima had the most liked content!

Community Reputation

15 Good

About Necuima

  • Rank
    Advanced Member

Recent Profile Visitors

546 profile views
  1. Necuima

    Checking MIME Type

    Hi Larry, I have found a function 'FindMimeFromData' and will see if I can figure out how to use it. Will let you know how I get on. Cheers, Necuima
  2. Hi, If anyone has some C++ code to check a file's MIME type, I'd really appreciate a copy or a URL to find it. I am specifically trying to verify that if a file that I am reading (from a Windows file system) has a jpg file suffix, or variants thereof, that the file is indeed of MIME type image/jpeg. The development environment in this instance is Visual Studio 2017. I have scoured Google and Stack Overflow but haven't come up with anything. Many thanks in anticipation, Cheers, Necuima
  3. Found the issue :-) Somehow when Win 10 was 'upgraded', the auto-start for XAMPP itself got 'lost'. Have re-instated it and all OK now. Whew!! Cheers from Oz.
  4. Hi Larry, I did some more investigating and found that Apache no longer starts automatically even though the auto-starts are set for MariaDB and the server. If you manually start them, then everything is OK. I will continue investigating. Cheers from Oz.
  5. Hi Larry, Have you come across a restriction re access to localhost in the latest version of Windows 10? Prior to the latest version, my XAMPP/localhost scripts were all running perfectly but since the 'upgrade' to the latest version of Windows 10, now there is no access to localhost at all, not even to phpinfo.php. I have tried several different browsers and they all exhibit the same restriction so it seems nothing to do with the browser. I have Googled extensively and it seems that it is a known 'feature' of the latest incarnation of Windows 10 with lots of suggestions on how to deal with the restriction but so far anyway, all the 'fixes' that I have tried are to no avail. Are you aware of this? If so, do you have any advice on how to fix this? Thanks, Necuima
  6. Yes, I did not know that the 'with www' and 'without www' environments are separate. What initially threw me was that the session cookie was there in the browser in both situations. I have added some code in the site's .htaccess to remove the www if one is there. Thanks as always for your insights. Cheers from Oz.
  7. Hi Larry, I eventually found the root cause. If the initial URL uses the www prefix, the MVC redirect (via index.php) redirects without the www and the issue shows. If the initial URL does not use the www prefix, then all works OK. I think will use .htaccess to remove any wwws if they are there in the initial URL. Looking forward to your insights. Cheers from Oz, Necuima
  8. In the end I followed some advice you have given, no doubt many times. I set up a new (temporary) test website using the same hosting folks as the production site. I pared the code right back and implemented it step by step and the problem has 'gone away'! I wish I knew though what the root cause of the problem was, but I've not finished my step-by-step process yet so as I add more and more modules the problem may recur. But at least then I'll know which module was causing the problem. Thanks as always for your advice. Necuima P.S., I am using your model-view-controller architecture as per your 'advanced' book.
  9. P.S., the same code runs perfectly in my XAMPP/Localhost test/development environment. As per "The King of Siam" - 'Tis a mystery.
  10. Re your other suggestion, I can see that the session cookie is getting set on the first try and is still there on the second try and gets deleted properly when I log out. And a new session gets set OK when I then log in again after logging out. A new session cookie is getting set OK without the problem as in this case I have not re-started the browser.
  11. Hi Larry, because I keep getting no session data when I test for its presence (the first time) I thought that I could use $GLOBALS instead. I am setting the values in $_SESSION, checking that they are set immediately afterwards, but in the second script my !isset test on the $_SESSION data says that the data are not set the first time I try to log in. But, without closing the browser down, the second time I try to log in I always get in - i.e., the second time the !isset test indicates that the $_SESSION data are indeed set and I can use them OK. I don't understand this at all! Again, your thoughts will be welcomed.
  12. Hi Larry, I am having the strangest issue with $_SESSION, which I have used many times before following the guidance in your books, and have never had a problem like this. For several days now I have been trying to debug an issue in a login script in a website. In a nutshell, a $_SESSION gets set in one module but even though I check that the $_SESSION (session_start())starts OK in another module in the same domain, and the $_SESSION (PHPSESSID) cookie is in the browser OK, the $_SESSION data are not there via if (!isset($_SESSION['MGCC_member_data'])) check. BUT if I log in again, without closing the browser down, then everything works fine! As far as I can tell, I have not sent anything to the browser before the $_SESSION data are checked. I have raised this with the hosting folks but would appreciate any insights that you may have. Thanks as always, Necuima
  13. Sorry, It is there but like this: [GLOBALS] => Array *RECURSION* I don't understand how to get the actual variables values here? Thanks as always, Neciuma
  14. Thanks for getting back to me. I think it is something to do with timing - maybe some JS code that runs at the bottom of the module interfering with the setting of the $_SESSION variables. But before I send you a whole bunch of code, can you please help me to understand why $GLOBALS array variables are not getting passed from script to script even though the PHP manual seems to indicate that $GLOBLS are super-globals? In the second script, still within the same domain, I do a dump of the variables but the ones I have set are not in there. $_SERVER; print_r($GLOBALS); The ones following are not there. Here's the setting code: $GLOBALS['MEMBER_KEY'] = $member_key; $GLOBALS['MEMBER_NUMBER'] = $member_number; $GLOBALS['MEMBER_FN'] = $member_first_name; $GLOBALS['MEMBER_LN'] = $member_last_name; Again, any advice will be most appreciated. Thanks, Necuima
  15. Hi Larry, I have encountered a really weird problem (well weird to me) re the server not being able to write a session cookie reliably but it always gets set first go in localhost. I had to include a do-while loop in the production version until the session data were available but I don't know how many times the loop gets executed before the session cookie gets set. Can you offer any guidance on how to debug this? Am using IE11 and Firefox 62.0 Thanks as always, Necuima