[PHP] Roadsend (was Re: PHP Source code protection)
zerof [EMAIL PROTECTED] 7/02/2008 12:04 p.m. Try Roadsend, now as Open Source: http://www.roadsend.com/home/index.php?SMC=1pageID=compiler Hey, that looks cool. Do many people use this? Has anyone built any standalone GUI apps with it? Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Generating Random Numbers with Normal Distribution
Ha ha, it does! Admittedly, I haven't read every line of every post in this thread, but so far I haven't seen any mention of Nazis (until now). Godwin's Law breaking down Regards, Bruce Jay Blanchard [EMAIL PROTECTED] 19/12/2007 4:39:15 a.m. [snip] This is the thread that doesn't end. Yes, it goes on and on, my friend. Some people started typing here, not knowing what it was, and they'll just keep replying-all forever just because this is the thread that doesn't end [/snip] This thread lacks order. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.2 and MySQL
I have just installed PHP 5.2.4 on Windows 2003 machine running IIS. Everything is fine except when I try to enable the MySQL extension (either php_mysqli.dll or php_mysql.dll), when I do a php_info(), at the bottom I get the message Error in my_thread_global_end(): 1 threads didn't exit. All my other extensions (curl, MSSQL, Oracle, etc.) load fine. It's only when trying to enable this one. I did a manual install, using the php-5.2.4-Win32.zip. This contains versions 5.2.4.4 of php_mysql.dll and php_mysqli.dll. I found a thread where someone said they fixed this by disabling php_iisfunc in the php.ini, but my php.ini doesn't even have this in it. Any ideas? Thanks. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and daylight savings
I'm using PHP 5.1.2 on IIS. Here in New Zealand, our daylight savings started a week earlier than usual and went into affect this past weekend. The time on my machine is correct. The timezone settings on my machine are correct. But if I display the time on a PHP page, it is 1 hour behind. Setting the timezone with date_default_timezone_set() doesn't make any difference. If I display the time on an ASP page, it shows the correct time so it can't be an IIS problem I don't think. Why would PHP be showing the time as if it hadn't changed? Where is it getting the time from? Here is the code I'm using: date_default_timezone_set('Pacific/Auckland'); echo time is . date(h:i:s); Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and daylight savings
I discovered that we needed to update the php_timezonedb.dll. This worked fine on our servers and time is now correct. But in my dev environment on my machine, when I put the same dll in (with the same version of PHP), I get a CGI error when PHP tries to do anything. Anyone know why? Regards, Bruce Bruce Cowin [EMAIL PROTECTED] 1/10/2007 11:02 a.m. I'm using PHP 5.1.2 on IIS. Here in New Zealand, our daylight savings started a week earlier than usual and went into affect this past weekend. The time on my machine is correct. The timezone settings on my machine are correct. But if I display the time on a PHP page, it is 1 hour behind. Setting the timezone with date_default_timezone_set() doesn't make any difference. If I display the time on an ASP page, it shows the correct time so it can't be an IIS problem I don't think. Why would PHP be showing the time as if it hadn't changed? Where is it getting the time from? Here is the code I'm using: date_default_timezone_set('Pacific/Auckland'); echo time is . date(h:i:s); Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and daylight savings
Yet another update! I managed to get rid of the CGI error by turning off error logging to the syslog. But now I get this message: PHP Warning: PHP Startup: Unable to load dynamic library 'c:\php\ext\php_timezonedb.dll' - Access is denied. in Unknown on line 0 As I say, this same dll works fine on a server running the same PHP version (5.1.2). Any ideas? Regards, Bruce Bruce Cowin [EMAIL PROTECTED] 1/10/2007 12:13 p.m. I discovered that we needed to update the php_timezonedb.dll. This worked fine on our servers and time is now correct. But in my dev environment on my machine, when I put the same dll in (with the same version of PHP), I get a CGI error when PHP tries to do anything. Anyone know why? Regards, Bruce Bruce Cowin [EMAIL PROTECTED] 1/10/2007 11:02 a.m. I'm using PHP 5.1.2 on IIS. Here in New Zealand, our daylight savings started a week earlier than usual and went into affect this past weekend. The time on my machine is correct. The timezone settings on my machine are correct. But if I display the time on a PHP page, it is 1 hour behind. Setting the timezone with date_default_timezone_set() doesn't make any difference. If I display the time on an ASP page, it shows the correct time so it can't be an IIS problem I don't think. Why would PHP be showing the time as if it hadn't changed? Where is it getting the time from? Here is the code I'm using: date_default_timezone_set('Pacific/Auckland'); echo time is . date(h:i:s); Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and daylight savings
That was it, thanks! I compared the permissions on this dll to another dll extension that loads fine. When I made it the same, it worked. Thanks again! Regards, Bruce Jeffery Fernandez [EMAIL PROTECTED] 1/10/2007 1:23 p.m. On Monday 01 October 2007 10:08, Bruce Cowin wrote: Yet another update! I managed to get rid of the CGI error by turning off error logging to the syslog. But now I get this message: PHP Warning: PHP Startup: Unable to load dynamic library 'c:\php\ext\php_timezonedb.dll' - Access is denied. in Unknown on line 0 I don't know if this will make a difference.. have you checked the permissions of the file. I think you need to grant the extentions folder Full Control for IUSR_COMPUTERNAME As I say, this same dll works fine on a server running the same PHP version (5.1.2). Any ideas? Regards, Bruce Bruce Cowin [EMAIL PROTECTED] 1/10/2007 12:13 p.m. I discovered that we needed to update the php_timezonedb.dll. This worked fine on our servers and time is now correct. But in my dev environment on my machine, when I put the same dll in (with the same version of PHP), I get a CGI error when PHP tries to do anything. Anyone know why? Regards, Bruce Bruce Cowin [EMAIL PROTECTED] 1/10/2007 11:02 a.m. I'm using PHP 5.1.2 on IIS. Here in New Zealand, our daylight savings started a week earlier than usual and went into affect this past weekend. The time on my machine is correct. The timezone settings on my machine are correct. But if I display the time on a PHP page, it is 1 hour behind. Setting the timezone with date_default_timezone_set() doesn't make any difference. If I display the time on an ASP page, it shows the correct time so it can't be an IIS problem I don't think. Why would PHP be showing the time as if it hadn't changed? Where is it getting the time from? Here is the code I'm using: date_default_timezone_set('Pacific/Auckland'); echo time is . date(h:i:s); Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internet Vision Technologies Level 1, 520 Dorset Road Croydon Victoria - 3136 Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database includes
Thanks to everyone who responded. Some really interesting ideas. I'll try them out. Regards, Bruce Wouter van Vliet / Interpotential [EMAIL PROTECTED] 28/08/2007 8:34 a.m. On 27/08/07, Stut [EMAIL PROTECTED] wrote: I use a slightly different approach to prevent the need to mess about with files when moving to production. At the end on config.php I have this... if (file_exists('config_dev.php')) require 'config_dev.php'; I've got my own variation on this, came to use it to prevent overwriting config files for stage/dev/live or other versions of a site. I've got a general purpose constants file, which defines a lot of constants which are generally used a lot in my applications (file rootdir, DAY, HOUR, database passwords, some regexes, these things). Instead of just defining them there, I define them using a simple conditional define function (if (!defined($constantName) define($constantName, $value)). On top of my constants.inc.php (as I chose to call it) I use the following: if (isset($_SERVER['SERVER_NAME'])) { $_config_file = dirname(__FILE__).'/../eg/'.$_SERVER['SERVER_NAME'].'.inc.php'; @include($_config_file); } The included hostname specific config file would then define some constants, and because they are already defined the default values from constants.inc.php don't get set anymore. Hope this is of help to anybody, it has certainly relaxed my deployment process.. Wouter In config_dev.php I override anything defined in config.php that needs to be different on the current server. The config_dev.php file is *not* in source control so it doesn't exist in production but each development and test environment has a version that modifies the production environment. There is a hit involved in the call to file_exists, but PHP caches it so the effect is minimal. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Interpotential.com Phone: +31615397471 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Database includes
I'm curious as to how everyone organises and includes their classes in PHP5. Let's take a simple example that has 3 classes: customer, order, and database. The database class has a base sql db class (I know there is PDO and other things but this class is already written and working) and classes that inherit from the base class for dev, test, and prod, passing the associated logins. The customer and order will both use the appropriate database class depending on which environment its in (e.g., SalesDevDB, SalesTestDB, SalesProdDB). I don't want to have to go into the customer and order class code and change which db class it uses when I move it from dev to test and from test to prod. What's the proper way to handle this? Or am I way off base? Thanks. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loss of precision in intval()
Richard's right. You get the same result if you do the equivalent in ASP. Regards, Bruce Richard Lynch [EMAIL PROTECTED] 8/08/2007 3:29:16 p.m. On Wed, August 1, 2007 11:52 am, Mark Summers wrote: This sort of thing really isn't helpful... ?php $a = 75.82 * 100; echo intval($a); ? What did you get? What did you expect? Do you have ANY idea how floats are actually represented internally in every computer language? [*] If you expect to have a specific precision, then you need to write code to have that precision. For simple money just use cents instead of dollars and keep everything as an int except for final output. For anything more complicated, you have http://php.net/gmp or, in lder versions of PHP, BC Math. * Yeah, okay, there ARE languages where 75.82 really IS 75.82 and not some close approximation... But they are pretty esoteric languages, really. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get stored procedure return values via PDO?
I had a similar problem using PDO on MS Sql Server where I was trying to return the id of an inserted row. I ended up giving up and doing a second query to get @@IDENTITY. Regards, Bruce Richard Davey [EMAIL PROTECTED] 27/07/2007 12:51 a.m. Hi, I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3) $stmt = $dbh-prepare('CALL forum_post(?, ?, ?, ?, ?, @status, @thread_id, @message_id)'); At the moment in order to get the values of status, thread_id and message_id I need to issue a second query: $sql = SELECT @status AS status, @thread_id AS thread_id, @message_id AS message_id; and then foreach my way through it: foreach ($dbh-query($sql) as $row) { $status = $row['status']; $thread_id = $row['thread_id']; $message_id = $row['message_id']; } Which seems a bit insane.. is there no way to do a bindValue at the same time as I do my bindParams? Now I write this I really can't remember why I am even putting that second query into a foreach loop, even so it's still a step I'd like to remove entirely if possible? Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error reporting
I'm running PHP 5.1 on IIS. My dev environment is all local on my machine. My php.ini has the following error reporting settings: error_reporting = E_ALL display_errors = Off display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = Off error_log = syslog To test, I've written a little script that divides by 0. When I run the script from the command line, I get entries in my Event Log as expected, but if I load the page into my browser (Firefox), no error is reported in the Event Log. I've checked http://www.php.net/manual/en/ref.errorfunc.php but can't find anything there. I figure I must be missing something pretty obvious but not sure what it is. The script and logged error from the command line are below. Thanks for any help. script: html titlehead/head/title body ?php $a = 5; $b = 0; $c = $a / $b; echo $c; ? /body /html logged error from command line: The description for Event ID ( 2 ) in Source ( PHP-5.1.2 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: php[2132], PHP Warning: Division by zero in C:\Inetpub\wwwroot\PHP\Testing\error.php on line 11. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strange stripos behavior
Thanks for the suggestion. I ended up not building the search string and checking each part individually. FYI, I had noticed that it also depended on what order I built the search string; e.g., $searchstring = $msg-Body() . $msg-Subject()... worked ok but if I put $msg-Subject first it didn't. Is it possible that if $msg-Subject is null that it does something funny to the value in the $searchstring variable? Anyway, it's working now by not using a variable. Thanks again. Regards, Bruce Shawn McKenzie [EMAIL PROTECTED] 25/07/2007 12:33 p.m. Too much beer to think through the logical progression of the operators, but maybe try: if (stripos($searchtext, '') !== false) { -Shawn Bruce Cowin wrote: I'm using PHP 5.1 on IIS. I have an app that uses MimeDecode to load mime files and I've built an object to parse them into their various parts; i.e., $msg-Body(), $msg-Sender(), etc. I'm using stripos() to look for a string (that I know is in my test files). It works if I search in $msg-Body(), but doesn't work if I build a variable and search it. i.e., this works: if (!stripos($msg-Body(), '') === false) { echo \n found in Body()\n; } but this doesn't (I've tried it with and without htmlentities()): $searchtext = htmlentities($msg-Sender()) . htmlentities($msg-To()) . htmlentities($msg-Cc()) . htmlentities($msg-Subject()) . htmlentities($msg-Body()); if (!stripos($searchtext, '') === false) { echo \nstring found!\n; } Does anyone have any ideas? Thanks. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strange stripos behavior
I'm using PHP 5.1 on IIS. I have an app that uses MimeDecode to load mime files and I've built an object to parse them into their various parts; i.e., $msg-Body(), $msg-Sender(), etc. I'm using stripos() to look for a string (that I know is in my test files). It works if I search in $msg-Body(), but doesn't work if I build a variable and search it. i.e., this works: if (!stripos($msg-Body(), '') === false) { echo \n found in Body()\n; } but this doesn't (I've tried it with and without htmlentities()): $searchtext = htmlentities($msg-Sender()) . htmlentities($msg-To()) . htmlentities($msg-Cc()) . htmlentities($msg-Subject()) . htmlentities($msg-Body()); if (!stripos($searchtext, '') === false) { echo \nstring found!\n; } Does anyone have any ideas? Thanks. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] text field truncation with sql server
Thanks Richard for pointing me in the right direction. Yes, it is mssql I'm using. And changing the mssql.textlimit and mssql.textsize in the php.ini file fixed my problem. You suggested not using all those echo statements. What do you suggest I use instead? Thanks again! Regards, Bruce Richard Lynch [EMAIL PROTECTED] 13/07/2007 5:58 p.m. What is the 3981st character? Does your database driver, whatever it is, which you've told us is not PDO, have any kind of limit in the buffer size of query data back/forth? What driver ARE you using? I see mssql in the code, so assume that's it, right?... Does it happen on every record at 3980? If you don't know, add more records with enough length to find out. PS Using all those echo statements probably a pretty bad habit to get into, and you probably should be using htmlentities() on each element, before you do the nl2br... If the 3981st character happens to be a '' that would explain why you aren't seeing our data... Use View Source in your browser if you don't understand the preceding sentence. :-) On Thu, July 12, 2007 11:37 pm, Bruce Cowin wrote: I have a simple page that displays a record from the sql server database. One of the fields is a text field and keeps getting truncated at 3980 characters. I searched and saw someone had reported this as a PDO bug so I'm not using PDO anymore, but I'm still getting the truncation. Anyone know about this or have a work around? Here is the code. It's the body field that is a text field. I've checked the field in the database and it definitely has more data than is displayed. $cn = mssql_connect($myserver, $myuser, $mypwd); mssql_select_db($mydb, $cn); $result = mssql_query(select * from emails where id = $emailid, $cn); $row = mssql_fetch_array($result, MSSQL_ASSOC); echo ul; echo libId:/b . $row['id'] . /li; echo libFrom:/b . $row['mailfrom'] . /li; echo libTo:/b . $row['mailto'] . /li; echo libCc:/b . $row['mailcc'] . /li; echo libSubject:/b . $row['subject'] . /li; echo libDate:/b . $row['sentdate'] . /li; echo libBody:/bbr . nl2br($row['body']) . /li; echo /ul; Thanks for any help. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] text field truncation with sql server
I have a simple page that displays a record from the sql server database. One of the fields is a text field and keeps getting truncated at 3980 characters. I searched and saw someone had reported this as a PDO bug so I'm not using PDO anymore, but I'm still getting the truncation. Anyone know about this or have a work around? Here is the code. It's the body field that is a text field. I've checked the field in the database and it definitely has more data than is displayed. $cn = mssql_connect($myserver, $myuser, $mypwd); mssql_select_db($mydb, $cn); $result = mssql_query(select * from emails where id = $emailid, $cn); $row = mssql_fetch_array($result, MSSQL_ASSOC); echo ul; echo libId:/b . $row['id'] . /li; echo libFrom:/b . $row['mailfrom'] . /li; echo libTo:/b . $row['mailto'] . /li; echo libCc:/b . $row['mailcc'] . /li; echo libSubject:/b . $row['subject'] . /li; echo libDate:/b . $row['sentdate'] . /li; echo libBody:/bbr . nl2br($row['body']) . /li; echo /ul; Thanks for any help. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mailparse_msg_extract_part_file error
I have written a PHP (v5.1) app to parse a bunch of MIME files. It works for the vast majority, but sometimes I get this error: mailparse_msg_extract_part_file(): mbstring doesn't know how to decode plain transfer encoding! It appears to be when messages have Content-Type: text/plain; charset=us-ascii or Content-Transfer-Encoding: plain or a combination of the two. I've searched on the error message and only found a url that times out. Does anyone have any experience with this? The code in question is this (it's part of a function that gets the email body): foreach ($this-_sectiondata as $index = $data) { $contdisp = $this-_getHeaderData($index, 'content-disposition'); if ($contdisp == $data['content-type'] != 'multipart/mixed') { $sec = mailparse_msg_get_part($this-_mimehandle, $index); ob_start(); /* extract the part from the message file and dump it to the output buffer */ mailparse_msg_extract_part_file($sec, $this-_filename); $contents = ob_get_contents(); ob_end_clean(); $this-_body = $contents; } } Thanks! Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML in database
I am writing code to store a bunch of email files, in MIME format, into a database. The body of some of these emails, but not all, are in HTML format. If I use addslashes (after checking get_magic_quotes_gpc()), the database record won't get saved. There's no error message, just no record saved. But if I use htmlentities(), it saves the record no problem. I would have thought that addslashes would have been enough to format the data correctly. Why would I need to use htmlentities? And will using htmlentities cause me any problems? here's the code in question: $from = $this-SentFrom(); $to = $this-To(); $cc = $this-Cc(); $subject = $this-Subject(); $body = htmlentities($this-Body()); // this works //$body = $this-Body(); if (get_magic_quotes_gpc() == 0) { echo bradding slashes...; $body = addslashes($body); // this runs but doesn't work } $sql = insert emails(projectid, mailfrom, mailto, mailcc, subject, body) values(1, '$from', '$to', '$cc', '$subject', \$body\); echo brsql:precode$sql/code/pre; $link = mssql_connect($server, $user, $pwd) or die('Could not connect: ' . mysql_error()); mssql_select_db('EmailDB') or die('Could not select database'); try { $result = @mssql_query($sql); } catch (Exception $e) { echo brError: . $e-getMessage; } Thanks. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML in database
Thanks. Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function. Regards, Bruce Chris [EMAIL PROTECTED] 5/07/2007 12:10:17 p.m. Bruce Cowin wrote: I am writing code to store a bunch of email files, in MIME format, into a database. The body of some of these emails, but not all, are in HTML format. If I use addslashes (after checking get_magic_quotes_gpc()), the database record won't get saved. There's no error message, just no record saved. But if I use htmlentities(), it saves the record no problem. I would have thought that addslashes would have been enough to format the data correctly. Why would I need to use htmlentities? And will using htmlentities cause me any problems? You shouldn't use either method. htmlentities is completely changing your data (sure you can change it back but you're still changing it from it's original state). Use mysql_real_escape_string - it handles your quoting and escaping all for you. See http://www.php.net/mysql_real_escape_string -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[3]: [PHP] HTML in database
Oh, thanks very much. I didn't know about PDO before. I wish I had before I had written my own db class! :-) Thanks again and I'll try it out. Regards, Bruce Richard Davey [EMAIL PROTECTED] 5/07/2007 12:38:02 p.m. Thanks. Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function. MSSQL treats '' as an escaped ', not \' like MySQL does. So you can't addslashes it. Perform your own ' to '' conversion. And to reply to my own reply :) ... If you can, use PDO with the PDO MSSQL driver instead. Then let PDO worry about escaping for you! Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML in database
Me too. :-) I appreciated your quick response, though. Regards, Bruce Chris [EMAIL PROTECTED] 5/07/2007 1:14:58 p.m. Bruce Cowin wrote: Thanks. Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function. Ahh - sorry, missed that in your original post. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] HTML in database
I was still having the same problems even with PDO, but doing my own replace: $body = str_replace(', \, $body); fixed the problem. Thanks again! Regards, Bruce Richard Davey [EMAIL PROTECTED] 5/07/2007 12:34:29 p.m. Hi Bruce, Thursday, July 5, 2007, 1:26:01 AM, you wrote: Thanks. Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function. MSSQL treats '' as an escaped ', not \' like MySQL does. So you can't addslashes it. Perform your own ' to '' conversion. Also check to see if you've got RUNTIME Magic Quotes on, because that will auto-escape data (\'), which is pointless for MSSQL. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS vs. Tables OT
And makes for very clean code. Very nice! Regards, Bruce Lori Lay [EMAIL PROTECTED] 19/04/2007 5:02:33 a.m. Wolf wrote: OK, so I like sticking my nose in sometimes... Accessibility Standards and being bobby approved. http://webxact2.watchfire.com/report.asp?t=2#priority3 on http://lonewolf.homelinux.net/ Is just about as good as http://www.csszengarden.com Just the same 1 error :) At least show something that looks like a table! Check out http://home.tiscali.nl/developerscorner/ontario-dwic/test-ontario-step11.htm This was a collaboration between me and a CSS expert - francky kleyneman http://home.tiscali.nl/developerscorner/index.html. Not a table to be seen and it expands if you increase or decrease the font. The final version also meets section 508 and WAI guidelines for accessibility and works on Lynx (text browser) and screen readers. Now contrast that with the Drinking Water Ontario http://www.ontario.ca/ONT/portal51/drinkingwater/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLd4oPMATJgFjugfqRaCIBcJEgfW99X4_83FT9AP2C3NCIckdHRQDMbRp9/delta/base64xml/L3dJdyEvd0ZNQUFzQUMvNElVRS82X0JfUDI%21?lang=en site. Link is on the right side of the above page if it doesn't come through in the previous sentence. Takes 300 sec to load, when it loads at all. Table soup! Now can we please close this thread! There are better forums to discuss this - it has nothing to do with PHP!! Lori -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure database info in different environments
Ok, thanks for the feedback. I'll check it out. Regards, Bruce Jochem Maas [EMAIL PROTECTED] 3/04/2007 9:12 p.m. Bruce Cowin wrote: Hi, I have a generic database class that I built to connect to our different databases. From other posts that I've read, I think the safe thing is for me to put this file outside the web root, ensure it has a .php extension, set the include path to include this folder and include it in any pages that require it. Is this correct? Also, how do you handle the different environments: dev, test, and prod? I don't want to have to change the code every time I copy the file over. Do I have an independent file that determines if that folder should point to dev/test/prod? I generally use CVS to store my work and also to 'publish' stuff onto different setups/machines for testing/production, rather than moving/copying files manually - I find it alot easier to type 'cvs up -r SOME_TAG' and just have all the files updated with out having to think about which exactly files I must copy. I usually end up with a small config file that is not included in the [cvs] project (so it must be created manually for/in each installation) and have the project 'init' code check for the config file, require it and then test for the existance of some required constants/variables/etc - if the file is missing, not readable or expected constants/vars/etc are missing then the app dies with a suitable error message. Thanks for your help. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] secure database info in different environments
Hi, I have a generic database class that I built to connect to our different databases. From other posts that I've read, I think the safe thing is for me to put this file outside the web root, ensure it has a .php extension, set the include path to include this folder and include it in any pages that require it. Is this correct? Also, how do you handle the different environments: dev, test, and prod? I don't want to have to change the code every time I copy the file over. Do I have an independent file that determines if that folder should point to dev/test/prod? Thanks for your help. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running PHP on a windows server-your views
Yes, there is a PHP-WIN list. Much less volumn than this list. We run PHP on Windows using IIS. So far haven't had any problems. But we've been using it on intranet only sites and not very intensive or complicated. Regards, Bruce Richard Lynch [EMAIL PROTECTED] 20/03/2007 11:28:14 a.m. On Mon, March 19, 2007 3:39 am, Angelo Zanetti wrote: I would like some honest answers and if you have any experience with problems or no problems running PHP on a windows server. Let me put it this way: Core PHP will not make Windows any less stable than it already is. That means that if you have one of the 0.01% of Windows SysAdmins who actually is competent, then you should be fine. If not, then PHP isn't going to help matters. If you start adding in some seldom-used DLL extensions... No promises. :-) Check with people who actually USE PHP on Windows with heavy volume, if you can find any... Is there still a php-windows@ list from php.net? Basically we are interested to know if there are any problems/security issues/stability issues/performance issues or any other issues running a production site (big live site) on a windows server. Im assuming it will be running IIS. You really shouldn't, as Apache on Windows is a good way to transition to a real server. :-) Disclosure: I hate MS and have a severe bias. YMMV -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals and passing variables
Hi Jeff, You want to leave register_globals OFF. Depending on how $charid is passed, you want to use $_POST or $_GET: $charid = $_POST['charid']; or $charid = $_GET['charid']; I think you'll need to do the same for your $db_select variable. Is that what you're after? Regards, Bruce Jeff [EMAIL PROTECTED] 14/03/2007 4:01 p.m. Ok, all I am new to PHP MySQL. (please don't let this scare you off) I had my site hosted with Gisol.com and due to their very poor service and tech support I left them for Lunarpages.com who so far have a better service and their tech support is excellent!! But my pages won't pass variables any more. When I started I purchased two books MySQL and PHP MySQL both published by O'Riely. So far the are excellent help and instructors. I wote some pages where I track users and their characters from an on-line game called World of Warcraft. On the Gisol server they were working EXCELLENT!! Once I moved to Lunarpages, the pages load ok but they don't pass the variables from one page to another. The below code queries the db and list's the user's in a table, and has a hyperlink to the right of each, on Gisol I could click the link and it would load the view_char.php page and it listed their character and the info i needed, and gave options to delete and edit. Again it was working beautifully. VIEW USERS PAGE CODE: $sql=SELECT f_name, l_name, char_id, char_name, char_level FROM t_char, t_users where t_users.user_id = t_char.user_link ORDER BY char_name ASC; mysql_select_db($db_select,$db); $result = mysql_query($sql,$db); echo TABLE border=2; echoTRTDBCharacter Name/BTDBCharacter Level/BTDBOwner/B/TR; while ($myrow = mysql_fetch_array($result)) { echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$myrow[f_name]. .$myrow[l_name]; echo TDA href=\view_char.php?charid=.$myrow[char_id].\View/A; } //$charid=[.$myrow[char_id].]; - I tried this line with no success. Possibly have it in the wrong place?? echo/TABLE; VIEW_CHAR PAGE CODE $sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '$charid'; -- now all this does is produce a blank page... used to work great! //$sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '21'; - i used this code to test the page w/o the $charid string and it works FINE!! $result=mysql_query( $sql ); if (!$result) { die(Could not query the database: br /.mysql_error()); } I wrote a help ticket to Lunarpages where I am now hosted and asked them to set the register_globals to ON thinking this was the problem based on what I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. So I created this file: [PHP] register_globals = on named it php.ini and dropped it in the folder with all of my files. It didn't help any. So I added this line to the first file include ('php.ini'); all it does is add :[PHP] register_globals = on as text at the top of my page now. At this point im lost!! I don't know what to do to get my A href=\view_char.php?charid=.$myrow[char_id]. to equal $charid in the following pages. Any help you could provide me would GREATLY be APPRECIATED!!! Signed, I'm trying -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Classes in PHP5 || Puzzling Problem || Trying to Set $this-$name = $value
I don't know the details of your app, but you might want to reconsider a resdesign. Having said that, your code actually works for me. If I use your class as is, foo is 1. That is: $x = new test; echo $x-foo; outputs 1. Isn't that what you want? Regards, Bruce PHP [EMAIL PROTECTED] 9/03/2007 6:10:49 p.m. Hey all. Problem: Class test { var $foo = 0; function __construct() { $this-myfunc(foo, 1); } function myfunc($name, $val) { $this-$name = $val; } } Now, PHP correctly evaluates $this-$name as 0; i.e. the default property value of $this-foo. However, what I really need to have happen is for $this-$name = $val to be evaluated as $this-foo = 1; I have tried variations of $this-$$name = $val, $this-${$name} = $val, etc., but none of them work -- I keep getting an Undefined variable: foo error from PHP, when very clearly foo has been defined. This is a very simple example of what I'm actually attempting to implement, so please do not reply with, Well, why not just do: $this-foo = $val I'm sure intermediate to advanced PHP developers have run across this issue before -- feel free to chime in ;--) Thanks! --Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] curlopt_timeout default
I'm using PHP 5.1.2 on IIS. From time to time, my cURL response is empty (i.e., strlen($response) == 0). I'm wondering if it is a timeout issue. If cURL timed out, would you expect an empty response? Also, I want to change curlopt_timeout to see if this helps. But what I can't find is what the default for this setting is. Does anyone know? Thanks. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curlopt_timeout default
Thanks Richard. I'll look into that. And yes, I'm looking at capturing the curl_getinfo() as well. Thanks again. Regards, Bruce Richard Lynch [EMAIL PROTECTED] 2/03/2007 1:36 p.m. On Thu, March 1, 2007 5:16 pm, Bruce Cowin wrote: I'm using PHP 5.1.2 on IIS. From time to time, my cURL response is empty (i.e., strlen($response) == 0). I'm wondering if it is a timeout issue. If cURL timed out, would you expect an empty response? Also, I want to change curlopt_timeout to see if this helps. But what I can't find is what the default for this setting is. Does anyone know? If nothing else is stated anywhere, it's probable that the default timeout is the same as the one for any socket connection in php.ini... But also check the docs over at the curl site. hexx.se or somesuch. There's a curl_error() function of some sort that you should be using, if you are not already, and I would expect it to have something useful in it in the scenario you are describing. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curlopt_timeout default
For anyone who is interested, I found this: libcurl has no default timeouts for these. When you don't use them, you will be in the hands of your operating system's timeouts. at http://curl.haxx.se/mail/lib-2004-04/0027.html Regards, Bruce Bruce Cowin [EMAIL PROTECTED] 2/03/2007 1:59 p.m. Thanks Richard. I'll look into that. And yes, I'm looking at capturing the curl_getinfo() as well. Thanks again. Regards, Bruce Richard Lynch [EMAIL PROTECTED] 2/03/2007 1:36 p.m. On Thu, March 1, 2007 5:16 pm, Bruce Cowin wrote: I'm using PHP 5.1.2 on IIS. From time to time, my cURL response is empty (i.e., strlen($response) == 0). I'm wondering if it is a timeout issue. If cURL timed out, would you expect an empty response? Also, I want to change curlopt_timeout to see if this helps. But what I can't find is what the default for this setting is. Does anyone know? If nothing else is stated anywhere, it's probable that the default timeout is the same as the one for any socket connection in php.ini... But also check the docs over at the curl site. hexx.se or somesuch. There's a curl_error() function of some sort that you should be using, if you are not already, and I would expect it to have something useful in it in the scenario you are describing. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WHERE problem
Are you getting an error or just nothing returned? The first thing I'd check is if index is a numeric field and if it is, remove the single quotes from around $randi in the where clause. Regards, Bruce Mike Shanley [EMAIL PROTECTED] 20/02/2007 9:23:08 a.m. I'd like to think I understood code a little better than this, but I've got a problem with my WHERE... I know it's the WHERE because I get a good result when I leave it out. And the random function is also working... I honestly can't figure it out. Thanks in advance for help with this laughable prob. --- // How many are there? $result = mysql_query(SELECT count(*) FROM fortunes); $max = mysql_result($result, 0); // Get randomized!... the moderated way... $randi = mt_rand(1, $max-1); $q = SELECT text FROM fortunes WHERE index = '$randi'; $choose = mysql_query($q); $chosen1 = mysql_fetch_array($choose); // Ready to ship... $fortune = 'span class=quotecycquot;' . $chosen1[0] . 'quot;br/-Omniversalism.com/span'; mysql_close(); -- Mike Shanley ~you are almost there~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/PEAR
that reminds me: a woman walks into a bar carrying a duck. the bartender says hey, you can't come in here with that pig. the woman says it's not a pig, it's a duck. and the bartender says i was talking to the duck. Regards, Bruce Jochem Maas [EMAIL PROTECTED] 15/02/2007 3:36:56 a.m. Robert Cummings wrote: On Wed, 2007-02-14 at 15:02 +0100, Jochem Maas wrote: Malcolm Pickering wrote: Hello there, As a new user of PHP I am finding it extremely useful, very fast, and rewarding. I was also delighted to find the already proven and maintained extensions in PEAR. I have recently downloaded one of these extensions (HTML_Table) which is proving to be a great time saver, but can you tell me, please, why every time I access one of the associated pages or scripts my computer tries to dial out. Yes, I am still on Dial-Up. Is this some vital function that is required by your extension, or is there some information you need which has not already been given? If it is neither of these, how do I stop it because I find it infuriating. it's nothing to do with php - it's your POS browser - it thinks that your connecting to the internet because your sahooting out a http connection (which is actually aimed at the localhost) and therefore tries to connect (because it thinks that is required) ... either fix the browser settings or download a 'better' browser: http://www.mozilla.com/en-US/firefox Why be half-assed about choosing a better browser... http://www.opera.com/download/ *ducks* ;) which reminds me ... man walks into a doctors office wityh a duck stuck to his face. doctor says what can I do for you?. ducks says get the man off my ass or something like that. :-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spam using email on website
Yikes, so besides disabling the mail() function, how do you check for all that? Regards, Bruce Richard Lynch [EMAIL PROTECTED] 8/11/2006 8:14 a.m. On Tue, November 7, 2006 12:42 am, Pieter du Toit wrote: I have a website that is being crawled or whatever and i have a submission form for an event. I keep on getting random mail from this form. I have even disabled the submit button on the form, but keep on getting it. What can i do? Disable the mail() function bit in your code that processes the FORM submission. The Bad Guys are probably cramming your $subject and $from data with an ENTIRE eamil, so your mail() function is, in effect, and Open Relay. (That's very very very bad.) Example: Normal Input $subject = Hi!; Bad Guy Input $subject = Hi!\r\nCc: [EMAIL PROTECTED]@example.com; If you do: mail($to, $subject, $body); then you are letting THEM control the headers of your email, which lets them splice in 1000 recipients to their junk. Plus then can also splice in MIME headers and a new body to send virus-laden emails, and the $body you thought you were sending is just tacked on to the end of their body. Or not, if they splice in something to convince SMTP to end the email at the end of their body (which you've crammed into $subject in your mail() function call). -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pass value to next page
Hi, In search.php3, you'd need to save the values into inputs of type hidden. You can then query them in result.php as per usual. I hope that helps. Regards, Bruce Wang Chen [EMAIL PROTECTED] 8/11/2006 11:57 a.m. Hi , Newbie question, I have a form, form acttion=search.php3 method=post input . input... ... /form The search.php3 goes to query mysql database to see if the infomation is new or existed, if new, will promt two radio buttons ( Yes or No) to confirm if you like to enter the info inot DB .The form will action=result.php My question is how we can passwd the values which are entered in first page to result.php page. Thank you for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Frameworks
Hi Tony, On the installation instructions for Radicore, I see a lot of mention of Apache but no mention of IIS set up. Does Radicore work on IIS? Thanks. Regards, Bruce Tony Marston [EMAIL PROTECTED] 3/11/2006 11:10:12 p.m. It totally depends on what type of application you are writing, and what features you want out of the box so that you don't have to design and write them yourself. For example, if you are writing an administrative web application and you want user authentication, dynamic menus, role based access control, audit logging without database triggers, built-in workflow, and internationalisation facilities then you might want to take a look at Radicore (http://www.radicore.org/) As well as having all the above features it has a custom built Data Dictionary which can generate all the basic code for you. This enables you to start with nothing more than a database schema which you then import into the Data Dictionary, and from there you can press buttons to generate the database table classes and also buttons to generate the scripts to view and maintain those tables. All this without having to write a single line of code. It uses a catalog of transaction patterns which deal with single tables, one-to-many relationships and even many-to-many relationships. There is a massive amount of documentation and sample code, and a tutorial is available at http://www.tonymarston.net/php-mysql/radicore-tutorial.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I know this subject has been covered in the past, but my question is why use them? I'm hoping to not create a religious war... I see that frameworks would probably help you develop some things faster, but most of the time they don't do the things the way I would want them to work. If I did use one, it almost seems like I would use it to get through something until I had time to do things the way I wanted/needed to do them. There's a lot of talk about frameworks lately, and especially the Zend Framework, so I'd like to look into what it's all about. I think I might be missing out the framework issue, so I'd like to hear other people's opinions. I do like the mail, pdf, and a few other parts of the Zend Framework. I also like that it's more like a set of tools than a monolithic beast that would take a lot of memory just to load up into your application. Your thoughts? Thanks, Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php