php-general Digest 29 Nov 2011 14:28:52 -0000 Issue 7590 Topics (messages 315861 through 315871):
Re: Finding and reading firefox bookmarks with PHP 315861 by: Paul M Foster Re: PHP run from console - automatic password input 315862 by: shiplu 315867 by: Peter 315868 by: shiplu Common way to store db-password of open session? 315863 by: Andreas 315870 by: Nilesh Govindarajan 315871 by: Al Re: PHPExcel 315864 by: Ege Sertçetin 315866 by: Adam Balogh Re: [PHP-WIN] 5.3.9RC2 and 5.4RC2 315865 by: Tommy Pham PayPal : Message Alert. 315869 by: paypal.paypal.com Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net ----------------------------------------------------------------------
--- Begin Message ---On Mon, Nov 28, 2011 at 10:59:03AM -0500, David McGlone wrote: > On Sun, 2011-11-27 at 22:20 -0500, Paul M Foster wrote: > > On Sun, Nov 27, 2011 at 06:47:36PM -0500, David McGlone wrote: > > > > > Hi all, I am wondering if it's possible to find the bookmarks file in > > > firefox and output the contents on a page with PHP.. I'm wanting to do > > > this so I can use it as my home page. > > > > The answer to this is not in PHP; it can be done in Firefox by itself. > > It's been a long time since I set this up, but if I'm not mistaken, the > > procedure goes like this: > > > > 1. In Firefox, enter about:config in the URL bar. (Ignore warnings.) > > 2. You are now in the raw configs. Search for a key called > > browser.bookmarks.autoExportHTML. Set this to 2. This should cause > > Firefox to dump the contents of it places.sqlite file to a file called > > bookmarks.html when Firefox is closed. > > 3. Find another key called browser.startup.homepage. Set this to the > > absolute path of a file called bookmarks.html in your Firefox file tree. > > The path will be something like (in Linux): > > /home/<username>/.mozilla/firefox/<random string>.default/bookmarks.html. > > (Obviously, you'll have to locate this file ahead of time.) > > > > If this isn't the exact procedure, it's close. You can dig into the > > Firefox docs to get the exact values or keys if these aren't right. (For > > example, I don't know why the first key I mentioned is 2 instead of 1.) > > > > Anyway, I have my Firefox set up this way. > > Hi Paul. The drawback I have found so far with this setup is that the > page will not update until firefox is restarted. do you have a > workaround for this? Yeah, that's the rub. When I found the instructions for doing this, they were clear that Firefox wouldn't update the file until the browser was closed. Outside of that, you'd just have to read the actual SQLite file, I suppose. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com
--- End Message ---
--- Begin Message ---On Tue, Nov 29, 2011 at 8:21 AM, asdf zxcv <jazdatest...@gmail.com> wrote: > I'm trying to make my php script (run from console) to input nesesary data > when console asks for it. > > For example, i want to automatically manage revoking self-signed > certificates, but when i exec("command") then system asks me to give the > pass phrase. I dont want to do that. Instead, I want my script to input the > password automatically. > > Is there any way to achieve that? > > Regards > Peter > You could try, $pass = "1285@"; exec("echo $pass | command"); But if its a privilege issue on your linux system, its better to start the php script with proper privilege. -- Shiplu Mokadd.im Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---Unfortunately, this method doesnt work. I algo tried working with pipes: #!/usr/bin/php -q <?php require_once("_cert-manage-functions.php"); //$config = parse_ini_file("/var/www/config.ini", true); $userId = userCertId("fredfa"); // create descriptors for R/W-pipes $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), ); $proc = "openssl ca -keyfile ca.key -cert ca.pem -revoke ".$userId.".pem"; // open process with bidirectional interaction $process = proc_open($proc, $descriptorspec, $pipes); // if success, continue if (is_resource($process)) { // read until prompt while (trim(fgets($pipes[0])) != 'Using configuration from /usr/lib/ssl/openssl.cnf') { } fscanf($pipes[0], "Enter pass phrase for ca.key:"); // enter pass phrase fwrite($pipes[1], "password\n"); // read until EOF stream_get_contents($pipes[0]); // release resources fclose($pipes[0]); fclose($pipes[1]); proc_close($process); } ?> ...but the above doesnt work either and i still get "enter the passphrase" prompt 2011/11/29 shiplu <shiplu....@gmail.com> > > > On Tue, Nov 29, 2011 at 8:21 AM, asdf zxcv <jazdatest...@gmail.com> wrote: > >> I'm trying to make my php script (run from console) to input nesesary data >> when console asks for it. >> >> For example, i want to automatically manage revoking self-signed >> certificates, but when i exec("command") then system asks me to give the >> pass phrase. I dont want to do that. Instead, I want my script to input >> the >> password automatically. >> >> Is there any way to achieve that? >> >> Regards >> Peter >> > > > You could try, > > $pass = "1285@"; > exec("echo $pass | command"); > > But if its a privilege issue on your linux system, its better to start the > php script with proper privilege. > > -- > Shiplu Mokadd.im > > Innovation distinguishes between follower and leader > >
--- End Message ---
--- Begin Message ---Did you try -passin, -passout options of openssl command? See the man page here http://linux.die.net/man/1/openssl Specially the "Pass phrase arguments" section. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---Hi, is threre a most advisble way to store db-passwords of an open user-session?As far as I get it, a common login strategy is to let the user login by name&password, check it, store a login=TRUE as php-session variable and later use a common dbuser+pw to query data provided "login" is TRUE.This way one wouldn't have to store the users pw or actually the user wouldn't have a real db-account but rather an application account.Is this really better or equal than using real db-accounts? Should I rather store the db-credentials in a session or cookies? Session is vulnerable as any host-user could look into /tmp. This would generally be a trusted few though.On the other hand cookies could be manipulated by the user or at least be spied upon on the way between user and web-host everytime the credentials are needed for a query.
--- End Message ---
--- Begin Message ---On Tue 29 Nov 2011 01:34:08 PM IST, Andreas wrote: > Hi, > > is threre a most advisble way to store db-passwords of an open > user-session? > As far as I get it, a common login strategy is to let the user login > by name&password, check it, store a login=TRUE as php-session variable > and later use a common dbuser+pw to query data provided "login" is TRUE. > > This way one wouldn't have to store the users pw or actually the user > wouldn't have a real db-account but rather an application account. > > Is this really better or equal than using real db-accounts? > > Should I rather store the db-credentials in a session or cookies? > > Session is vulnerable as any host-user could look into /tmp. > This would generally be a trusted few though. > > On the other hand cookies could be manipulated by the user or at least > be spied upon on the way between user and web-host everytime the > credentials are needed for a query. > What exactly do you mean by db-account? I didn't understand your question, but this is what I do in my applications- When the user submits the login form, validate POST data (for mischevious stuff) and check if username & password query works out successfully. If it does, store a session variable login=true and let the user work on the private parts of the site. The cookie essentially, contains just the session id. I never use cookies to store data, only sessions. I also add ip and user-agent filtering to my auth systems. -- Nilesh Govindarajan http://nileshgr.com
--- End Message ---
--- Begin Message ---On 11/29/2011 7:40 AM, Nilesh Govindarajan wrote:On Tue 29 Nov 2011 01:34:08 PM IST, Andreas wrote:Hi, is threre a most advisble way to store db-passwords of an open user-session? As far as I get it, a common login strategy is to let the user login by name&password, check it, store a login=TRUE as php-session variable and later use a common dbuser+pw to query data provided "login" is TRUE. This way one wouldn't have to store the users pw or actually the user wouldn't have a real db-account but rather an application account. Is this really better or equal than using real db-accounts? Should I rather store the db-credentials in a session or cookies? Session is vulnerable as any host-user could look into /tmp. This would generally be a trusted few though. On the other hand cookies could be manipulated by the user or at least be spied upon on the way between user and web-host everytime the credentials are needed for a query.What exactly do you mean by db-account? I didn't understand your question, but this is what I do in my applications- When the user submits the login form, validate POST data (for mischevious stuff) and check if username& password query works out successfully. If it does, store a session variable login=true and let the user work on the private parts of the site. The cookie essentially, contains just the session id. I never use cookies to store data, only sessions. I also add ip and user-agent filtering to my auth systems.Sounds like $_SESSION buffer is what you need. I use the buffer extensively in most of my designs.
--- End Message ---
--- Begin Message ---Wish I had heard PHPExcel before. I'm using a class to read excel files. Ege. Alinti Floyd Resler <fres...@adex-intl.com>Does anyone have much experience with PHPExcel? I'm having difficulties in getting multiple sheet workbooks to work properly. I haven't been able to find any practical examples.Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---Hi, *Heres the documentation:* http://phpexcel.codeplex.com/releases/view/45412#DownloadId=212183 In user doc: *4.2 Reading Only Named WorkSheets from a File* * * and you can get all the sheet names: http://www.auditbureau.org.au/a/Documentation/API/PHPExcel/PHPExcel.html#methodgetSheetNames
--- End Message ---
--- Begin Message ---On Mon, Nov 28, 2011 at 1:34 AM, Pierre Joye <pierre....@gmail.com> wrote: > On Mon, Nov 28, 2011 at 5:51 AM, Tommy Pham <tommy...@gmail.com> wrote: > >> Can someone please confirm if you're able to create/drop MySQL >> database on using phpMyAdmin with PHP 5.3.9RC2 or PHP5.4RC2? > > Please use the sqlsrv or mysql functions directly with CREATE/DROP > queries in a little script, it will be easier to debug. > > Cheers, > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > I don't know what happened last night. After about 2 hours trying to make some progress but failed, I called it a night. I just tried again to see if I had the same problems as last night. Apparently, I don't, even after several attempts to duplicate last night problems. Anyway, I got a few things setup to facilitate troubleshooting the compatibilities, including bug report Doc #60404. Here comes a wall of text from about 5-6 hours of testing, mostly for sqlsrv ... LOL. 5.3.5 5.3.9RC2 5.4.0RC2 error_reporting E_ALL & ~E_DEPRECATED & ~E_STRICT 22527 22527 22527 file_uploads On On On log_errors On On On log_errors_max_len 0 0 0 max_execution_time 300 300 300 max_input_time 60 60 60 memory_limit 128M 128M 128M post_max_size 20M 20M 20M upload_max_filesize 20M 20M 20M Drupal 7.9 + MySQL 5.5-rc >> install OK OK OK Drupal 7.9 + MySQL 5.5-rc >> using1 OK OK OK Drupal 7.9 + SQL Server 10.50.2500 >> install OK Error[3] Error[4] Drupal 7.9 + SQL Server 10.50.2500 >> using1 OK partial[2] partial[2] SQL Server install - Working Set (memory) 186,636K SQL Server install - Private Working Set (memory) 145,760K SQL Server install - Commit Size (memory) 147,736K MySQL install - Working Set (memory) 123,552K MySQL install - Private Working Set (memory) 86,332K MySQL install - Commit Size (memory) 87,648K 1. Create and Edit the short article in the home page in each PHP version. 2. Sometimes generates HTTP Error 500.0 when reading/creating/editing a new article. 3. Always receive HTTP Error 500.0 after creating about 25 tables out of 73 max. 4. SQLSTATE[IMSSP]: An error occurred substituting the named parameters. For 5.3.5 and 5.3.9RC2, sqlsrv driver is the same (ExtensionVer) version 2.0.1802.200 and I have xdebug trace logs of every execution. I didn't bother with the memory comparison for 5.3.9RC2 and 5.4.0RC2 since Drupal 7.9 failed to install for sqlsvr. There error_log file doesn't have any errors prior to and when PHP crashed suddenly, generating the HTTP 500. 5.3.5 has 62 extensions: Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, com_dotnet, ctype, curl, date, dom, enchant, ereg, exif, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlsrv, pgsql, session, shmop, soap, sockets, sqlsrv, standard, tidy, tokenizer, wddx, wincache, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib 5.3.9RC2 has 63 extensions: Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, com_dotnet, ctype, curl, date, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlsrv, pgsql, session, shmop, soap, sockets, sqlsrv, standard, tidy, tokenizer, wddx, wincache, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib 5.4.0RC2 has 60 extensions: Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, com_dotnet, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlsrv, pgsql, session, shmop, soap, sockets, sqlsrv, standard, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib If anyone is interested, here's my code for cleaning the db automatically and reporting PHP version, the database (server & client) version - specifically for Drupal 7.9: function exceptionHandler($e) { echo $e->getMessage(); print_r($e->getTrace()); } set_exception_handler('exception_handler'); $settings = 'sites/default/settings.php'; /** broken - file locking by IIS ** if (isset($_GET['use'])) { // if (!unlink($settings)) // throw new Exception('Error removing old settings'); $source = "sites/default/settings.{$_GET['use']}.php"; switch ($_GET['use']) { case 'mysql': case 'mssql': if (file_exists($source)) copy($source, $settings); // if (!copy(__DIR__.'/sites/default/settings.mysql.php', __DIR__.'/'.$settings)) // throw new Exception('Error copying MySQL settings.'); break; } } */ require_once ($settings); $driver = $databases['default']['default']['driver']; $host = $databases['default']['default']['host']; $database = $databases['default']['default']['database']; $user = $databases['default']['default']['username']; $pwd = $databases['default']['default']['password']; $dsn = ''; $sql = array(); $sql['ShowTables'] = ''; $sql['DropTables'] = 'DROP TABLE '; $dbTables = array(); echo '<pre>'; switch ($driver) { case 'mysql': $dsn = "mysql:dbname={$database};host={$host}"; $sql['ShowTables'] = "SHOW TABLES FROM {$database}"; break; case 'sqlsrv': $dsn = "sqlsrv:database={$database};server={$host}"; $sql['ShowTables'] = "exec sp_tables @table_owner = 'dbo', @table_qualifier='{$database}'"; break; default: throw new Exception("Database driver {$driver} not supported."); } $dbh = new PDO($dsn, $user, $pwd); if (!($dbh instanceof PDO)) throw new Exception("PDO failed to connect using dsn: {$dsn}"); if (($sth = $dbh->query($sql['ShowTables'])) === false) throw new Exception("SHOW TABLES: PDO query failed {$sql['ShowTables']}"); switch ($driver) { case 'mysql': foreach ($sth as $row) $dbTables[] = $row['Tables_in_'.$database]; break; case 'sqlsrv': foreach ($sth as $row) $dbTables[] = $row['TABLE_NAME']; break; default: throw new Exception("Database driver {$driver} not supported."); } echo PHP_VERSION." >> Driver: {$driver} | Server: {$host} | Database: {$database}".PHP_EOL; echo "Server Version: ".$dbh->getAttribute(PDO::ATTR_SERVER_VERSION).' | Client Version: '; switch ($driver) { case 'mysql': echo $dbh->getAttribute(PDO::ATTR_CLIENT_VERSION); break; case 'sqlsrv': print_r($dbh->getAttribute(PDO::ATTR_CLIENT_VERSION)); break; default: throw new Exception("Database driver {$driver} not supported."); } echo PHP_EOL; print_r($dbTables); if (!empty($dbTables)) { $sql['DropTables'] .= implode('; DROP TABLE ', $dbTables); if (($sth = $dbh->query($sql['DropTables'])) === false) throw new Exception("DROP TABLES: PDO query failed {$sql['DropTables']}"); if (($sth = $dbh->query($sql['ShowTables'])) === false) throw new Exception("SHOW TABLES (check): PDO query failed {$sql['ShowTables']}"); echo "Number of tables in database {$database}: ".$sth->rowCount(); }
--- End Message ---
--- Begin Message ---Dear Customer PayPal , From: pay...@paypal.com Subject: PayPal Online : Message Alert ! Resolution Center: Your account is limited. Regarding this, please follow the link below to resolve this issue: http://dtecables.com/www.paypal.com/account.htm PayPal - NUMBER: ID831959-PayPal/2011 Please allow us 1 to 3 days to your resolve problem. Thank you, PayPal
--- End Message ---