Jump to content

Syphon

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Syphon's Achievements

Member

Member (2/5)

0

Reputation

  1. Hmm, the problem seems to have fixed itself. On our live testing servers I can't seem to download the file; however if the code is executed on the live site (just a different directory on the same server) it works as expected. I wonder if SSL is some how to blame. If it works on my live site then I'm not concerned anymore. It'd be nice to figure out why it doesn't work in a different directory on the same server though.
  2. // This script is within a class. The variables values are below // $this->FileLocation = /var/www/html/files/testfile.txt // $this->FileMIME = application/octet-stream // $this->FileName = "My File" // $this->FileSize = 1233 $FileLocation = APPROOT."files/".$this->FileLocation; $FileExt = strrchr($this->FileLocation, "."); header("Content-Type: ".$this->FileMIME); header("Content-Transfer-Encoding: Binary"); header("Content-Length: ".$this->FileSize); header("Content-Disposition: attachment; filename=\"".basename(str_replace(" ", "", $this->FileName).$FileExt)."\""); readfile($FileLocation); exit;
  3. I've got a simple file download script that runs great on my localhost. When I'm testing on our live server it takes forever (1-2 min or so) for the FireFox save dialogue to pop up. When it eventually does and I download the file, the size is 0KB and the file is completely blank! Any ideas on what's causing this? The actual size of the file I'm downloading is less than 5KB.
  4. If it's not meant to be then I'll work without it. FYI The scenario was if an administrator edited a users (currently logged in) personal information. A user object with all that users information is stored in the session and would be out of sync with the database. Not a huge issue, but I was curious if there was a proper solution. Sounds like it's not worth the trouble. Thanks.
  5. Can a session variable created for user A be accessed by user B? Much like the way .NET handles sessions in global.asax
  6. Found the issue. It's a little complicated to explain, but I'll give it a shot. Each table of the database has it's respective class in php. Each class has a load function, which will take the parameter give and load itself The DAL object which every single class uses, is referenced to one object. In other words, every single class uses the exact same object to talk to the database. One connection and tons of queries When a class is serialized (the only one that is serialized currently is the user object), the DAL class is serialized along with it. Now the user navigates to another page. A new DAL is constructed right off the bat. The session is checked and if someone exists, the page user object is instantiated and the session is unserialized. That's the problem. The unserialized DAL in the newly created user object and the DAL object constructed on the page first load are not the same objects. It unserializes successfully, but I'm guessing that something inside the mysqli object needed to be refreshed. Simply adding a __wakeup() and pointing the user object DAL back to the newly constructed one fixed this issue. Hope that made sense.
  7. I'm experiencing a very odd error. I'm converting our Data Access object to use the mysqli api. The conversion went through fine and the object uses the new api as expected. There is one page, with one query in particular that seems to "unset" the mysqli object. A null result set is returned. When I try to access the $MySQLi->errno property, I get this error Unknown Error: Couldn't fetch mysqli Suddenly my object becomes broken! I'm not calling ANY close methods on the result objects or mysqli objects. Many of the other pages work fine, and executing the query in phpmyadmin yields valid results. Google turned up only a handful of links related to this issue. Is there obscure issues with the mysqli api that aren't documented? As I mentioned before, I'm not closing any of the returned result objects. Could it be a reached a limit and broke mysqli?
  8. For the sake of argument lets say MySQL does convert all of the keywords to lowercase. Would a query with all lowercase keywords theoretically execute faster because no conversion would be needed? I don't think you'd see much of a performance gain, but I just like to know that my queries are running as fast as possible.
  9. When MySQL parses a query, does it convert all the syntax to uppercase or lowercase? I know that it converts table names to lower case (if the option is turned on) when they're created, but does it do the same thing for queries? Thanks in advance.
  10. Here's my scenario: Two classes, one is called the "baseclass" and the other is called "myClass" which extends the "baseclass". When a new instance of "myClass" is created only the constructor in "myClass" is run. I thought OOP worked by the "baseclass" running it's constructor and then the class that extends it would run it's constructor. Am I doing something wrong or is this just the limitations of php? Thanks in advance.
  11. As is stands, this is everything that's running srand(); $td = mcrypt_module_open('tripledes', '', 'cbc', ''); $Key = substr(md5('very secret key'), 0, mcrypt_enc_get_iv_size($td)); $initializationVector = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); echo "Initialization Vector:".$initializationVector."<br />"; mcrypt_generic_init($td, $Key, $initializationVector); /* Encrypt data */ $encrypted = mcrypt_generic($td, 'This is some very important data'); echo "Encrypted: ".$encrypted."<br />"; $encoded = urlencode($encrypted); echo "URL Encoded: ".$encoded."<br />"; echo "URL Decoded: ".urldecode($encoded)."<br />"; mcrypt_generic_deinit($td); mcrypt_generic_init($td, $Key, $initializationVector); $decrypted = mdecrypt_generic($td, $encrypted); mcrypt_generic_deinit($td); mcrypt_module_close($td); echo "Decrypted: ".$decrypted."<br />"; //Do everything again to see if it decrypts properly $td = mcrypt_module_open('tripledes', '', 'cbc', ''); $initializationVector = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $Key, $initializationVector); $decrypted = mdecrypt_generic($td, $encrypted); mcrypt_generic_deinit($td); mcrypt_module_close($td); echo "2nd Decryption: ".$decrypted."<br />"; echo "Rand: ".MCRYPT_RAND; It seems that MCRYPT_RAND is always staying the same. This should probably be fixed first, but that's a predefined constant. I remember reading on another forum that MCRYPT_RAND wasn't working in windows and the author recommended their own function to create a vector.
  12. It seems that this code is invalid $ivSize = mcrypt_enc_get_iv_size($td); $initializationVector = mcrypt_create_iv($ivSize, MCRYPT_RAND); If just won't work unless the code looks like this: $initializationVector = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); Although this fixes one issue, it still doesn't create a different encryption result each time the page is hit. I understand what you mean with using an array to store the result and vector in; however, wouldn't this require that I put both my encryption result and vector into the querystring? UPDATE: If the vector is always the same, wouldn't that mean that MCRYPT_RAND isn't working, or always providing the same random number? Tried with srand() and the vector still is the same.
  13. I'm using 5.2.1. When I try to use mcrypt_create_iv() this message is displayed. mcrypt_generic_init() [function.mcrypt-generic-init]: Iv size incorrect; supplied length: 24, needed: 8 I can't understand why that warning would show up if I'm using the function mcrypt_enc_get_key_size() to determine the key size. At any rate, this is what the code looks like using mcrypt_create_iv() //srand(); $td = mcrypt_module_open('tripledes', '', 'cbc', ''); $keySize = mcrypt_enc_get_key_size($td); echo $keySize; //outputs 24 $initializationVector = mcrypt_create_iv($keySize, MCRYPT_RAND); As for using the same IV, if I don't use the same IV to decrypt then the message doesn't decrypt properly. Depending on the mode used, the whole message or the beginning part still looks encrypted.
  14. I've tried ecb, cbc, cfb, ofb, and nofb. The encrypted result is still the same every time. It almost seems like mcrypt is using the same algorithm to encrypt every time, regardless of what I put. Every encryption method and mode yields a suspiciously similar result. Not that I'm an expert in encryption, but I'd expect some sort of pattern that is different than the last encryption method.
×
×
  • 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.