Jump to content

RobertP

Members
  • Posts

    287
  • Joined

  • Last visited

Everything posted by RobertP

  1. Where ever you have your sessions stored, file, db, memory, etc.. the session data (_SESSION array) is stored as a string, similar to serialize, but its not at the same time (reefer to first post). I need to parse this back into an array for use.
  2. Just wondering if anyone has found a solution to the unserialization issue with the session data saved using the SessionHandlerInterface. http://php.net/manual/en/function.session-decode.php Looking through the comments on this page, I am yet to find a viable, and reliable solution.
  3. could be the image is not cached, so each time you hover, it loads the image the first time, but it doesn't load the image for the other times.
  4. its small in size, so downloading the who thing would not be an issue (unless called to many times).. I would split by line endings, usually "\n", then by ": "... hopefully that was not to confusing.
  5. One thing to remember, namespaces is a relatively new feature, and will most likely be improved.
  6. you will have to look at what your clients can do.. 1. how many websites can each client host? 2. is there a dedicated amount of ram for each client / site? 3. do you offer any other services that will be on the same machine, such as mysql, memcache, ect.. also keep any eye on bandwidth.. as it only takes 1 script to take off out of control and then you have tb's gone (happen to me once) (just some thinking material xD)
  7. Wow omg, from my previous post I realized that php was trying to load the extensions from "./" ... i added xdebug to the php.ini for apache manually, and i uncommented extension_dir = "./", commenting that line out (since extensions are loaded dynamically any ways) has solved my problem. thank you everyone that has helped, my problem is solved; also got xdebug working properly xD
  8. looks like i am missing more then just memcache not sure what happen tho.. [Fri Nov 30 12:12:17 2012] [notice] caught SIGTERM, shutting down PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './curl.so' - ./curl.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './gd.so' - ./gd.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './memcache.so' - ./memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './mysqli.so' - ./mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './pdo_mysql.so' - ./pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './mcrypt.so' - ./mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0 [Fri Nov 30 12:12:18 2012] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.6-1ubuntu1.1 configured -- resuming normal operations
  9. robert@ROBERT-PC ~ $ php -m [php Modules] bcmath bz2 calendar Core ctype curl date dba dom ereg exif fileinfo filter ftp gd gettext hash iconv json libxml mbstring mcrypt memcache mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql Phar posix readline Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib [Zend Modules]
  10. Ok, this is my site http://auth.gludoe.com/ Memcache is not a file, its loaded from an extension.. if i said i was receiving this error Fatal error: Class 'Memcache' not found, would it make more sense? The reason i get a different error is because i use 'spl_autoload_register'
  11. util now, i had never herd of milking.... don't complaint about 'spreaders' if your going to spread it.
  12. I had memcache working with php for almost 2 weeks, (since i set up the pc) i installed xdebug via these instructions http://ubuntuforums....ad.php?t=525257 now, memcache does not load, I get include(/var/www/sources/Memcache.php): failed to open stream: No such file or directory Its looking for the Memcache class there, as i am using spl_autoload_register(function($class) { include(_SOURCES . $class . '.php'); }); phpinfo: http://auth.gludoe.com/php-i-n-f-o.php
  13. i would start here .. http://www.php.net/manual/en/function.imagejpeg.php
  14. i recommend you serve a php file with a header for css, as the other method will probably cause you more head headaches in the end
  15. Thank you for the hint towards parse_ini_file, this might just be my solution.. is there a difference on the line-endings??
  16. Well, what is faster / performance-wise? 1. Include a file with an array already defined? (current implementation) 2. Include a file, then unserialize a variable and then populate the $config array? The configuration file does not change, unless an administrator changes a setting inside the admin panel, so if it takes 0.3 seconds longer each time the file is saved, verse 0.3 (over exaggerating a little) each time my site is accessed to parse the config array? My problem is not with my design (imho), it is with my reg-x pattern (is there a difference on what platform i execute preg_replace?)
  17. Thank you, i have noticed that my salt was a little to small Not sure how it changed from 21 to 8.. but that fixed my problem. Fix: public function setPassword($password) { $salt = Util::generateRndStr(21); $newPassword = self::encrypt($password, $salt); if(strlen($newPassword)!=60){ trigger_error('Internal issue with Member::encrypt.',E_USER_WARNING); return false; } $statement = $this->connection->prepare('UPDATE members SET passwrd = ?, sal_t = ? WHERE id = ? LIMIT 1;'); $id = $this->get('id'); $statement->bindParam(1, $newPassword, PDO::PARAM_STR); $statement->bindParam(2, $salt, PDO::PARAM_STR); $statement->bindParam(3, $id, PDO::PARAM_INT); $statement->execute(); return $statement->rowCount() == 1; }
  18. terribly sorry, here is the requested method. public static function generateRndStr($length, $type = 0) { if ($length < 1) return null; switch ($type) { case 1://captcha. $possible = '23456789bcdfghjkmnpqrstvwxyz'; break; case 2://sessions. $possible = 'abcdefghijklmnopqrstuvwxyz0123456789'; break; default://all. $possible = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; } $str = null; for ($i = 0; $i < $length; $i++) $str .= substr($possible, mt_rand(0, strlen($possible) - 1), 1); return $str; } this is my results during testing, just so everyone can see the problem outright.. pass=1234 salt=tvFvbjGG ePas=$2y$10$tvFvbjGG$
  19. Catchy title? well that is exactly my problem. i have 2 methods inside my 'Member' class (code below). As you an see, i am not getting the expected results from 'crypt'. What started this problem was i have switched my development pc's operating system from win7 to Ubuntu 14, and there was a few small case-sensitive issues i had to fix while moving my site, however this is a security issue that was allowing anyone to login using the wrong password, that is before i added the 'if(strlen($newPassword)!=60)' check. If anyone else has seen this issue, please let me know how you solved it public function setPassword($password) { $salt = Util::generateRndStr(; $newPassword = self::encrypt($password, $salt); echo 'pass='.$password.'<br />'; echo 'salt='.$salt.'<br />'; echo 'ePas='.$newPassword.'<br />'; if(strlen($newPassword)!=60){ trigger_error('Internal issue with Member::encrypt.',E_USER_WARNING); return false; } $statement = $this->connection->prepare('UPDATE members SET passwrd = ?, sal_t = ? WHERE id = ? LIMIT 1;'); $id = $this->get('id'); $statement->bindParam(1, $newPassword, PDO::PARAM_STR); $statement->bindParam(2, $salt, PDO::PARAM_STR); $statement->bindParam(3, $id, PDO::PARAM_INT); $statement->execute(); return $statement->rowCount() == 1; } public static function encrypt($string, $salt) { return crypt($string, '$2y$10$' . $salt . '$'); }
  20. i have coded a simple yet very diverse method to update an array inside configuration.php, while retaining comments / user notes. this method works no problem on a windows platform, but since my project needs to be cross-platform i need to figure out what the issue is on my ubuntu. i know that the issue is in the $replacements array (containing a key => value for a simple preg_replace) $keys argument is a simple string array eg: ['debug','siteUrl','defaultTimezone'] $config argument is a preloaded config array eg: ['debug'=>false,'siteUrl'=>'hxxp://127.0.0.1','defaultTimezone'=>'America/Toronto'] public static function saveConfigByKey($keys, $config) { if (!is_array($keys)) { trigger_error('Admin::saveConfigByKey: Invalid keys.', E_USER_NOTICE); return false; } $replacements = array(); foreach ($keys as $key) { if (!array_key_exists('f_' . $key, $_POST)) return false; $newVal = addslashes($_POST['f_' . $key]); $config[$key] = $newVal; if ($newVal != 'true' && $newVal != 'false' && !is_numeric($newVal)) $newVal = '\'' . $newVal . '\''; elseif ($newVal == '\'\'') { $newVal = 'null'; $config[$key] = null; } elseif ($newVal == 'true' || $newVal == 'false') $config[$key] = $newVal == 'true'; $replacements['#\'' . $key . '\'=>(.*),#'] = '\'' . $key . '\'=>' . $newVal . ','; } $rawConfig = file_get_contents(_SOURCES . 'Configuration.php'); $rawConfig = preg_replace(array_keys($replacements), array_values($replacements), $rawConfig); echo($rawConfig);exit; copy(_SOURCES . 'Configuration.php', _SOURCES . 'files' . _DS . 'Configuration.backup.php'); //exit($rawConfig);//test if (!file_put_contents(_SOURCES . 'Configuration.php', $rawConfig)) { trigger_error('Admin::saveConfigByKey: Internal error.', E_USER_NOTICE); copy(_SOURCES . 'files' . _DS . 'Configuration.backup.php', _SOURCES . 'Configuration.php'); return false; } return true; } Configuration.php <?php if (!defined('_ROOT')) exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found')); $this->config = array( //===> general 'debug' => false, 'siteUrl' => 'http://127.0.0.1', //no trailing slash. 'defaultTimezone' => 'America/Toronto', 'displayPageLoadInfo' => true, 'defaultLanguage' => 'english', 'enableSEFLinks' => true, 'defaultPage' => 'index', 'disable404' => false, ); ?>
  21. so i am not understanding this... i need my script to run every 2 hours, and it now runs every minute or so ... * */2 * * * /usr/local/bin/php -f $HOME/minecraft-backups/mcbackup.php > $HOME/minecraft-backups/backup.log 2>&1 any help would be greatly appreciated
  22. my forums Page created in 0.154 seconds with 74 queries. i think that is way to many. the only mod i have installed is Pretty URLs - 1.0 i have cache level 2 set with memcached with dedicated 64mb. i have no idea. also Pretty URLs is set to save in the cache not database!!
  23. What do you think? i have been looking around for something similar to use as a part of my cms. <?php class Git { private $_binPath = null; public function __construct($binPath = null){ $this->_binPath = stristr($binPath,' ') ? '"'.$binPath.'"' : $binPath; chdir(dirname(__FILE__)); } public function __call($method,$params = array()){ $addition = null; if(is_array($params)&&count($params)>0) $addition .= ' '.implode(' ',$params); exec($this->_binPath.' '.$method.$addition,$response); return $response; } } $git = new Git('C:\\Program Files (x86)\\Git\\cmd\\git.exe'); var_dump($git->init()); var_dump($git->add('.')); var_dump($git->commit('-m "Test Commit"')); var_dump($git->status()); ?>
  24. Is this a realistic approach? (this is not my code, just my structure) <?php class blowfish { private $key; private $iv; public function __construct($key,$iv){ $this->key = $key; $this->iv = $iv; } public function encrypt($data){ return mcrypt_encrypt(MCRYPT_BLOWFISH,$this->key,$data,MCRYPT_MODE_CBC,$this->iv); } public function decrypt($data){ return mcrypt_decrypt(MCRYPT_BLOWFISH,$this->key,$data,MCRYPT_MODE_CBC,$this->iv); } } ?> $blowfish = new blowfish('bnwoiueewoencwqoegnqoe','18282818'); $data = $blowfish->encrypt('testString'); echo $blowfish->decrypt($data); //Output: testString
×
×
  • 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.