Jump to content

Simmo

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by Simmo

  1. Thanks for reply I may be way off and apologise for being hard work, but does this look about right: ini_set('session.cookie_domain', '.subdmonain.maindomain.co.uk'); I have tried this before each session_start(); when creating the session and trying to read it, though it didn't work. Thanks
  2. Hi I have tried various snippets settings from searching smilar to what you have said. I have also tried snippets of code in the htaccess but it didn't like that at all. Could you post one that you know works and tell me how it should be use e.g. is it on each page you call the session. I can't post the code I have tried because I have tried a few and didn't save them Thanks
  3. Hi I have written a server session on login in the main domain and am trying to read it when they are sent to their sub domain. Unfortunately it won't read the session. I have searched for a solution, which points to altering the php ini. Is there another option that anyone knows about. Thanks
  4. Hi This is the senario: User logs in, if successful connection details for his database are stored in a session variables which are used to access information. Are there any precautions I need to make sure the data in the sessions are safe? Thanks
  5. Thanks for your comments. I should have started with the basics first and used the +1 day, I seemed to have over complicated things. All solutions have been great, adding date_default_timezone_set('UTC'); sorted the problem out straight away, so I'll use that. It’s been interesting to see how time zone settings need to be considered. I have also learned that the first Sunday in November is when the American clocks change. Thanks again
  6. Hi I use strtotime to add 7 dates into my database, so if the user selects a weeks holiday I can see what the next 6 days are and store them in a table. This was working well, so I thought. Until I put the script on another server. For some reason it wouldn't increment from Oct 30 2010 to Nov 5, it would go 31, 01, 01, 01, 01, 01. I asked them to update PHP which they did, this didn't make any difference. Though I am in England I asked them to change the time zone to that of my testing server which was Chicago. This then worked for Oct 2010, but made me worry that there could be a problem, so I ran the following script to see how the dates would look in October for the next 5 years: <?phpecho "Date Test";echo "<br />";for($k=10; $k<16; $k++){for($j=01; $j<13; $j++){ $varDate = "29-".$j."-20".$k.""; for($i=1; $i<7; $i++){ $varDate = date('Y-m-d',(strtotime($varDate) + 1*24*3600)); echo $varDate."<br />"; } echo "<br />";}}?> On both servers there is now problem in October 2014 and 2015, here are the results of those month’s: 2014-10-30 2014-10-31 2014-11-01 2014-11-02 2014-11-02 2014-11-02 and 2015-10-30 2015-10-31 2015-11-01 2015-11-01 2015-11-01 2015-11-01 Any help would be appreciated. Thanks
  7. Hi Is there anything wrong with opening several database connections depending on if statements as long as there is a mysql_close() tag at the bottom of the page. I have seen a neater way of opening and closing using a function call but it will take ages the go through all my pages to change them. Thanks Neil
  8. Hi I use this code [code]$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } $url .= '/new_page.php'; // Add the page. header("Location: $url"); mysql_close(); exit();[/code] hth Neil
  9. Hi I  plan to use this function to encrypt and decrypt: function encryptData($data, $p) {   $iIV = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256,MCRYPT_MODE_ECB), MCRYPT_RAND);   $sEncrypted = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, $p, $data, MCRYPT_MODE_ECB, $iIV);   return(base64_encode($sEncrypted)); } function decryptData($data, $p) {   $data = base64_decode($data);   $iIV = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);   $sDecrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $p, $data, MCRYPT_MODE_ECB, $iIV);   return(trim($sDecrypted)); } I read somewhere that using the base64_encode is easily decrypted.  I have not used this sort of code before but from what I see it is encrypted first with mcrypt and then the base64 is added for good measure. If I am right then it is encrypted really well and is just what I am after, so if someone can put me straight I would be greatful. Thanks
×
×
  • 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.