Friday, 26 January 2007
|
| Send Email to Mobiles Marcelo Ferrufino Murillo 12:42:28 |
| | Hi guys, I need to send a email to mobiles I don t know if I have to use the function "mail( )" or if I have to use other one. Thanks your help
|
| | 2 answer | Add comment |
|
| php from address Chantal Rosmuller 12:07:30 |
| | Hi everyone,
In November I sent a mail to this list asking how to get the mail From header right, I solved that but I still have a problem. The solution was using the -f option like this:
$frommail = "user@domain.com"; mail("$to", "$subject", "$message", "$headers","-f$frommail");
The from address is correct now but the displayed name is still www-data (or apache, depends on the server configuration). The header looks like this:
From: user@domain.com (www-data)
Is there anyway to change this? Thanks, regards Chantal
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 2 answer | Add comment |
|
| PHP 5.2.0 + qmail problem Bc. Radek Krejca 11:01:25 |
| | Hello,
I had to change my mailserver from sendmail to qmail. After it I saw that the mail generated by function mail() has 2 newlines in body except 1. I have this konfiguration on server with php4xx and no problem is there. Also if I change back sendmail so it is working too.
The output with this problem is: ------------------------------------------------------------------------------ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 X-Qmail-Scanner-1.25: added fake MIME-Version header MIME-Version: 1.0
SVA6IDEwLjQuMjQuMjQyClRhcmlmOiBBS0NFIC0gSU5URVJORVQgMTAyNDAvMTAyNDAgLSAyMDQ4
TUIgRlVQIDM4NApVxb5pdmF0ZWw6IEphbiBMVUvDgcWgCkZpcm1hOiBKYW4gTFVLw4HFoApBZHJl
c2E6IEouQmVuZHkgMjgKMzcwIDA1IMSMZXNrw6kgQnVkxJtqb3ZpY2UKQnJhbmE6IDEyCkJvZDog ------------------------------------------------------------------------------
but should be ------------------------------------------------------------------------------ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 X-Qmail-Scanner-1.25: added fake MIME-Version header MIME-Version: 1.0
SVA6IDEwLjQuMjQuMjQyClRhcmlmOiBBS0NFIC0gSU5URVJORVQgMTAyNDAvMTAyNDAgLSAyMDQ4 TUIgRlVQIDM4NApVxb5pdmF0ZWw6IEphbiBMVUvDgcWgCkZpcm1hOiBKYW4gTFVLw4HFoApBZHJl c2E6IEouQmVuZHkgMjgKMzcwIDA1IMSMZXNrw6kgQnVkxJtqb3ZpY2UKQnJhbmE6IDEyCkJvZDog ------------------------------------------------------------------------------
It makes me problem if I use Content-Transfer-Encoding: 8bit.
My idea is that qmail doesn't trim body of message and newer PHP too bud I don't know if I am right.
Where could be a problem?
-- S pozdravem, Bc. Radek Krejca ICQ: 65895541
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | Add comment |
|
| Validating a link in php Guest 08:47:03 |
| | Hi all,
I'm hoping y'all can help me with a bit of a php code problem I'm having.
What I'm trying to do is link to YouTube videos (more than one in a single webpage). However, because I'm worried about the videos going away and the links going bad, I'd like to use PHP to check if the link is good; if it's good, display the video link, else display a static image that I have on my servers.
Where I'm having troubles is in the checking of whether the url is good. I think part of the problem is YouTube itself. I've tried file() and fsockopen(), but neither seem to work.
Below is an example of the block of code I'm trying to write.
<? error_reporting(E_ALL ^ E_NOTICE); if (the "http://www.youtube.com/v/JqO8ZevPJNk" url is valid) <-- ??? { echo " <object height=\"400\" width=\"475\">\n"; echo " <param name=\"movie\" value=\"http://www.youtube.com/v/JqO8ZevPJNk\">\n"; echo " <embed src=\"http://www.youtube.com/v/JqO8ZevPJNk\"\n"; echo " type=\"application/x-shockwave-flash\" height=\"400\" width=\"475\">\n"; echo " </object>\n"; } else { echo " <a href=\"10538overturevideo.jpg\"><img SRC=\"10538overturevideo.jpg\" height=\"130\"></a>\n"; } ?>
Many thanks for any assistance you can provide.
Robert Porter
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 6 answers | Add comment |
|
| Parsing AJAX post data -- The Way M5 08:02:31 |
| | Just wondering what smart people do for parsing data sent by the Javascript XMLHTTP object--e.g., http.send("post",url,true)...
In a normal form submit, the $_POST global nicely allocates form elements as array elements automatically. But with the AJAX way, the data get stuffed inside $HTTP_RAW_POST_DATA as a string, thereby making extraction more tedious.
Any ideas?
...Rene
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 9 answers | Add comment |
|
| how to use odbc??? Bedul 07:55:56 |
| | can u give me url to have odbc example..
or i give the problem..
i want to connect to this odbc.. u may click http://indoupload.net/files/view/803/odbc%20problem.jpg
how to connect to the odbc and then execute sql. any question about the problem.. i will gladly answer
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | Add comment |
|
| JPEG info needed Gerry D 04:19:03 |
| | I need PHP to find out if a jpeg file uses progressive encoding. None of the standard exif or image functions seem to be able to tell me that. (please correct me if I'm wrong)
Can anybody help me?
TIA
Gerry
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 6 answers | Add comment |
|
| preg_match problem Chris N 00:41:04 |
| | Ok heres the situation, I have a string like this
$this->_item["title"] = "28.09.02 - Some silly Text (First) (Second)";
Im trying to do a preg_match on it to check it to make sure its in a certian format. Heres my preg_match
preg_match("/^(\d+)\.(\d+)\.(\d+)\s+\-\s+(.+)\s+\((.+)\)$", $this->_item["title"], $matches); list($all, $one, $two, $three, $four, $five) = $matches;
What Im getting returned in this
$one = 28 $two = 09 $three = 02 $four = Some silly Text $five = First) (Second
What I want is
$four = Some silly Text (First) $five = Second
Can anyone see where Im going wrong? The match may be really crude, Im still pretty new to regular expressions. But it works just fine as long as there is only one set of ().
Chris N.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 34 answer | Add comment |
|
| Version Info David Jenzen 00:41:04 |
| | How can I tell what versions of phpGroupware I really have installed? This may be a stupid question, but you never know until you ask. I have or think I have upgraded to 0.9.14.RC3 via tar ball, but when I login it shows "Powered by phpGroupware version 0.9.13.018 on the screens. I also have: Would you like phpGroupware to check for a new version when admins login ?: Yes Would you like to show each application's upgrade status ?: Yes
in my Admin setup. When I login as an administrator it shows:
The API is current This application is current
on the screens. I have run the cvs -z3 update -dP also and still have the same version numbers. Shouldn't I show something like "Powered by phpGroupWare version 0.9.14.RC3" on my screens?
Thanks
|
| | 3 answer | Add comment |
|
| most powerful php editor Vinicius C Silva 00:41:04 |
| | hi everyone!
i'd like to ask something maybe commonly asked here. what is the most powerful php editor?
|
| | 53 answer | Add comment |
Thursday, 25 January 2007
|
| [PHP-DEV] PHP 5.2.1RC3 Released Ilia Alshanetsky 22:14:00 |
| | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
The 2nd release candidate for PHP 5.2.1 is now available for download. The tarballs can be found here:
http://downloads.php.net/ilia/php-5.2.1RC3.tar.bz2 (d3889eda8c3471ce7cf2adb35a4de736) http://downloads.php.net/ilia/php-5.2.1RC3.tar.gz (c5b3e5540d1951d4c4b976b8a39c09ab)
and the Win32 binaries will be available in short order.
Since the last release, there are over 20 different bug fixes resolving some annoying engine issues such as the tempval leak inside foreach(). We do not anticipate any regressions to be introduced by this RC, but I would still like to ask everyone to take a few minutes and test it against their code base. If you come across any issues please report them at http://bugs.php.net/.
Depending on the stability of this release it may either be followed by a final release or another RC, therefor your feedback is critical to determining whether or not the code is stable enough to warrant the 5.2.1 final.
Ilia Alshanetsky 5.2 Release Master
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin)
iD8DBQFFsBJOLKekh381/CERAq/MAKCKg7buIpB9hXWrtnfHN7hQPB6akgCeJy8q Q/HBl5G15afjTjebEaILHlE= =tsFU -----END PGP SIGNATURE-----
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 24 answer | Add comment |
|
| [PHP-DEV] COM extension defects: Possible patch for defect 35464 Andy Wharmby 20:10:59 |
| | Hi Internals Attached is a suggested patch for COM defect 35464 (http://bugs.php.net/bug.php?id=34564) Any comments; good or bad welcome. Regards Andy
Andy Wharmby IBM United Kingdom Limited Winchester, England SO21 2JN E-mail: andy_wharmby@uk.ibm.com
COM defect 35464 ================
The following details 2 reasons why in/out parameters don't work; one caused by a problem with tetscase another a defect in COM extension code. The testcase supplied by the raiser implements the DWebBrowserEvents2 interface to register an handler for the BeforeNaviagte2 event. This handler is passed just one in/out parameter; a VARIANT_BOOL which can be set to TRUE by the handler to cancel the navigation operation. Doing so in PHP currently has no affect, for the 2 reasons I will describe below, so the navigation completes and the specified page is displayed by IE.
Issue 1 ====== The users code is attempting to modify the variant directly in PHP code as follows:
$cancel = true;
rather than using the COM method variant_set as follows:
variant_set($cancel, true);
With this correction to the PHP script in place the variant for $cancel is correctly changed to TRUE but IE still navigates to the requested page so the modification is having no effect. The reason for this is the subject of issue 2 below. Issue 2 ====== When an event notification is received by the COM extension disp_invokeex() processes the incoming parameters (variants) by taking each one and wrapping it in a php_com_dotnet_object object. At this time a COPY of the incoming variant is embedded into the php_com_dotnet_object so we immediately have 2 copies of the variant and it is this copy in the php_com_dotnet_object which is processed (get and set) by the PHP code. I see no code that checks for modification to our copy in the php_com_dotnet_object before returning to the caller (in this case IE) so modification to in/out parameters by the PHP code has no affect.
Given that the code copies an incoming variant in php_com_wrap_variant() I would have expected to see some code prior to return in disp_invokeex() which checks for modifications to in/out parameters and copies any modified values back to the callers copy of the variant.
I have hacked some code as follows: com_wrapper.c: http://www.pastebin.ca/328026 com_variant.c: http://www.pastebin.ca/328022 com_misc.c: http://www.pastebin.ca/328025 php_com_dotnet_internal.h: http://www.pastebin.ca/328027 The new code works as follows: (1) When a variant is modified by a call to variant_set() in com_variant.c a new flag (obj->modified) is set in the php_com_dotnet_object.
(2) After a successful call to a event handler new code in com_wrapper.c function disp_invokeex() checks each of the event handlers arguments (php_com_dotnet_object's ) to see if any of their embedded variants have been modified. If so and the argument passed into the event handler was passed by reference then the value in the embedded variant is copied to the callers copy by a call to a new function php_com_copy_variant() defined in com_variant.c.
With this patch applied when the supplied testcase is run the navigation is now cancelled as expected.
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 1 answer | Add comment |
|
| sortind arrays William Stokes 17:54:28 |
| | Hello,
How can I sort an array like this so that it would be ASC ordered by the [1] key in subarrays? I need to maintain only the subarray key - value pairs. (Do I make sense?)
Array ( [0] => Array ( [0] => Logo [1] => NameC [2] => Home [3] => url )
[1] => Array ( [0] => Logo [1] => NameA [2] => Home [3] => url )
[2] => Array ( [0] => Logo [1] => NameG [2] => Home [3] => url ) }
Cheers! -Will
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 5 answers | Add comment |
|
| Unserialize problem (and or bug) Sancar Saran 11:57:37 |
| | Hi,
After updating company test server to dotdeb 5.2.0 it star to give memory problems (even 32mb session). I tought it was because of suhosin. And I cannot update that server to vanilla debian php5 package because it was a sarge so today my company gives me another debian etch (like my home pc). I setup latest php 5.2.0.8 for debian etch.
Then unserialize gives another problem
Message: unserialize(): Error at offset 1384 of 3177 bytes Code: 8 Line: 419
My pc uses debian etch and have php 5.1.6-5 my scripts working normally.
Is there any suggestion for handle this ?
Regards
Sancar
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 5 answers | Add comment |
|
| [PHP-DEV] OWASP Spring of Code 2007 - tentative call for PHP security
proposals Andrew van der Stock 08:58:57 |
| | Hi there,
OWASP has just concluded the Autumn of Code 2006, which was very successful in getting some great security projects matured or completed, including the Testing Guide, which is a great resource for penetration testers.
http://www.owasp.org/index.php/Owasp_Autumn_Of_Code_2006
It was so successful, we are about to launch OWASP's Spring of Code 2007. We will be funding approximately 10-15 projects with approximately $80-100k USD between them. We are trying to increase both the number and dollars by gaining corporate sponsorships (see last paragraph if you can help with that), but we will spend at least $80k USD this time around.
As PHP applications make a large percentage of CVE entries (for whatever reason), I'd like to invite those active in PHP security to consider working on ways to improve the PHP security story for all PHP apps, regardless of the skill / knowledge of the devs pumping out PHP apps.
Some ideas - please take these as a starting point, not an end point:
* Hack on, mature and hopefully ship open source projects already someway along the security path, (such as Zend Framework or CodeIgnitor or your project here) which plug known webappsec gaps, like input and output validation, prevent SQL injection by default, and provide robust logging and authC/authZ services etc.
* Research root causes of "typical" PHP application security issues, and develop materials, new / improved API's, recommend deprecation or attack surface reduction for certain interfaces or features and so on to *actually* eliminate these issues once and for all
* ... Your idea here ...
We are looking at funding ideas / projects with concrete deliverables over a three-four month time frame starting around the beginning of the northern hemisphere spring. We look favorably upon submissions which completely remediate webappsec issues for a wide swathe of PHP apps, but we will also be looking at assisting those who wish to pursue basic research to make PHP safer in the medium to long term.
The only restriction is that the work has to be released under an acknowledged open source license, which goes for documentation, too. We cannot fund closed source or proprietary projects. We can provide incubator space if you have nowhere else to work (CVS or SVN, mail lists, web space, blogs, forum, etc).
We will be providing access to security mentors so you can bounce ideas or collaborate as you see fit. Why a webappsec specialist? We simply want to provide you with enough information and a way to bounce your ideas to avoid things like safe mode or similar which aren't actually that secure.
The SoC effort has not kicked off yet as we have not finalized many details - including some really interesting ones. We will be accepting submissions starting sometime in February for at least a month. Please discuss amongst yourselves as appropriate, and if at all possible, consider submitting a proposal or three when the OWASP SoC opens up.
If you are in a position to help fund any submission (outright or dollar for dollar, etc) or just wish to help the OWASP Spring of Code program, please contact owasp@owasp.org for more details. The typical commitment to a particular project is $2.5 to $10k USD, depending on how many folks are being funded / complexity of effort. This is your chance to get your favorite PHP security project matured / finished!
Andrew van der Stock Executive Director, OWASP
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
|
| | Add comment |
|
| where match question Don 03:56:00 |
| | I have a db field that contains zip codes separated by comas.
I am trying to get php to return all of the rows that contain a particular zip code.
$query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip')";
$result = mysql_query($query)
or die ("could not connect to db");
$row = mysql_fetch_row($result);
this works if there is only one row that contains that zip code.
If there is more than one row that contains the zip, it returns 0 rows. ('It' being MYSQL that returns 0 rows. I checked this by running the query directly to the DB)
Any ideas are very much appreciated.
Thanks,
Don
|
| | 17 answers | Add comment |
|
| How to make Browse Folder Dialog Aslam Bari 03:45:10 |
| | Dear All, I m new in this Forum. I m making a project in which i need to show user a Browse Folder Dialog Box, In which he can select a folder and after this i will do some manipulation on that folder's content. So the problem is that i could not found any sample on Web , how to show "Folder Dialog" in any way (HTML, JavaScript, PHP etc). Plz has anybody some idea how to do some work around this.
Thanks... -- View this message in context: http://www.nabble.com/How-to-make-Browse-Folder-Dialog-tf3079100.html#a8554729 Sent from the PHP - General mailing list archive at Nabble.com.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 6 answers | Add comment |
|
| Regular Expression Problem Martin Clifford 00:39:13 |
| | Hey all!
I'm trying to get this darn eregi_replace() to work, but it doesn't produce any results at all.
I want it to find all occurances of PHP variables. Here is the regexp
$output = eregi_replace("^[\$]{1,2}[a-zA-Z][0-9]+$", "<b>\\1</b>", $var);
As you might guess this is for a syntax highlighting function I am trying to write. Anyone have any ideas why it's not working? Please copy me directly, as I'm on the digest. Thanks!
Martin
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 21 answer | Add comment |
|
| [PHP-DEV] technical question Oliver Block 00:39:13 |
| | Hello,
As far as I understood, php loads requires modules at startup. Which impact does that have on which function a developer can call from within an extension. I mean, is it possible to call functions from other extensions besides ext/standard? And how?
Regards,
Oliver
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 1 answer | Add comment |
|
| Debugging itpc Skip Evans 00:39:13 |
| | Hey all,
I'm working on a site that allows users to build libraries of podcasts, and one of the calls to a PHP file is itpc, not http.
Hence I don't have the ability to echo data for debugging, and I also don't have write access to any dirs to fopen and fwrite data.
Any suggestions for other ways to debug this script file? -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL development framework. http://phpenguin.bigskypenguin.com/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 4 answer | Add comment |
|
| Package php code Peter Lauri 00:39:13 |
| | Hi,
Is there any similar way to package PHP software as Java with a jar file or similar? I have never seen it, because then would probably Smarty for example be packaged already This question came out of the blue when I was thinking about how to deliver some plugins to a customer.
Best regards,
Peter Lauri
<http://www.dwsasia.com/> www.dwsasia.com - company web site
<http://www.lauri.se/> www.lauri.se - personal web site
<http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free
|
| | 3 answer | Add comment |
Wednesday, 24 January 2007
|
| To many connections error message Kevin Murphy 22:13:51 |
| | I'm working with my host to resolve why I am getting these error messages, but in the meantime, I am getting this message on the website:
Warning: mysql_connect(): Too many connections in /path/number/user/ code/connect.php on line 10 Sorry: Could not connect to database. Please contact the webmaster at murphy63@wncc.edu
Where my connection code is:
$con = mysql_connect($host, $dbuser, $pw) or die("Sorry: Could not connect to database. Please contact the webmaster at murphy63@wncc.edu"); @mysql_select_db($db,$con);
The questions is, since I don't have error reporting turned on, why am I getting an error message that includes the complete path to my connect script.... something I would like to not be telling the general public? Is there a way to suppress that?
-- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326
|
| | 4 answer | Add comment |
|
| [PHP-DEV] [Patch] mysql_set_charset for mysql ext Scott MacVicar 20:51:37 |
| | Hi,
Attached is a patch that adds a mysql_set_charset function to the MySQL extension, its for all branches at the moment and ideally it should be applied to all.
Before anyone starts advocating that everyone upgrades to PHP5 and use MySQLi its not always realistic for some and other people are just stubborn.
The reason for the patch is that the mysql_set_character_set function provided by the MySQL API sets the internal MySQL character set for the connection which is referenced by functions such as mysql_real_escape_string.
Without the ability to change the character set on the connection users use the SET NAMES 'charset' query which lacks the ability to update the internal character set.
In certain cases this can lead to an SQL Injection. I'll simply refer everyone to a blog entry by Ilia http://ilia.ws/archives/103-mysql_real_escape_string-versus-Prepared-Statements.html
I'd like this consider this a security issue and get it applied to the PHP 4 branch even though active development is more or less finished.
Cheers, Scott
Index: ext/mysql/php_mysql.c =================================================================== RCS file: /repository/php-src/ext/mysql/php_mysql.c,v retrieving revision 1.226 diff -u -r1.226 php_mysql.c --- ext/mysql/php_mysql.c8 Oct 2006 13:34:22 -00001.226 +++ ext/mysql/php_mysql.c18 Oct 2006 12:09:40 -0000 @@ -94,6 +94,10 @@ #define MYSQL_HAS_YEAR #endif +#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +#define MYSQL_HAS_SET_CHARSET +#endif + #define MYSQL_ASSOC1<<0 #define MYSQL_NUM1<<1 #define MYSQL_BOTH(MYSQL_ASSOC|MYSQL_NUM) @@ -166,6 +170,9 @@ PHP_FE(mysql_thread_id,NULL) PHP_FE(mysql_client_encoding,NULL) PHP_FE(mysql_ping,NULL) +#ifdef MYSQL_HAS_SET_CHARSET +PHP_FE(mysql_set_charset,NULL) +#endif #ifdef HAVE_GETINFO_FUNCS PHP_FE(mysql_get_client_info,NULL) PHP_FE(mysql_get_host_info,NULL) @@ -1119,6 +1126,48 @@ /* }}} */ #endif +#ifdef MYSQL_HAS_SET_CHARSET +/* {{{ proto bool mysql_set_charset(string csname [, int link_identifier]) + sets client character set */ +PHP_FUNCTION(mysql_set_charset) +{ +zval **cs_name, **mysql_link; +int id; +php_mysql_conn *mysql; + +switch(ZEND_NUM_ARGS()) { +case 1: +if (zend_get_parameters_ex(1, &cs_name)==FAILURE) { +RETURN_FALSE; +} +id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); +CHECK_LINK(id); +break; +case 2: +if (zend_get_parameters_ex(2, &cs_name, &mysql_link)==FAILURE) { +RETURN_FALSE; +} +id = -1; +break; +default: +WRONG_PARAM_COUNT; +break; +} + + +ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); + +convert_to_string_ex(cs_name); + +if (!mysql_set_character_set(&mysql->conn, Z_STRVAL_PP(cs_name))) { +RETURN_TRUE; +} else { +RETURN_FALSE; +} +} +/* }}} */ +#endif + #ifndef NETWARE/* The below two functions not supported on NetWare */ #if MYSQL_VERSION_ID < 40000 /* {{{ proto bool mysql_create_db(string database_name [, int link_identifier]) Index: ext/mysql/php_mysql.h =================================================================== RCS file: /repository/php-src/ext/mysql/php_mysql.h,v retrieving revision 1.38 diff -u -r1.38 php_mysql.h --- ext/mysql/php_mysql.h1 Jan 2006 13:09:52 -00001.38 +++ ext/mysql/php_mysql.h18 Oct 2006 12:10:02 -0000 @@ -91,6 +91,9 @@ PHP_FUNCTION(mysql_thread_id); PHP_FUNCTION(mysql_client_encoding); PHP_FUNCTION(mysql_ping); +#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +PHP_FUNCTION(mysql_set_charset); +#endif ZEND_BEGIN_MODULE_GLOBALS(mysql) long default_link;
Index: ext/mysql/php_mysql.c =================================================================== RCS file: /repository/php-src/ext/mysql/php_mysql.c,v retrieving revision 1.174.2.29.2.2 diff -u -r1.174.2.29.2.2 php_mysql.c --- ext/mysql/php_mysql.c1 Jan 2006 13:46:55 -00001.174.2.29.2.2 +++ ext/mysql/php_mysql.c18 Oct 2006 11:54:02 -0000 @@ -93,6 +93,10 @@ #define MYSQL_HAS_YEAR #endif +#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +#define MYSQL_HAS_SET_CHARSET +#endif + #define MYSQL_ASSOC1<<0 #define MYSQL_NUM1<<1 #define MYSQL_BOTH(MYSQL_ASSOC|MYSQL_NUM) @@ -162,6 +166,9 @@ PHP_FE(mysql_thread_id,NULL) PHP_FE(mysql_client_encoding,NULL) PHP_FE(mysql_ping,NULL) +#ifdef MYSQL_HAS_SET_CHARSET +PHP_FE(mysql_set_charset,NULL) +#endif #ifdef HAVE_GETINFO_FUNCS PHP_FE(mysql_get_client_info,NULL) PHP_FE(mysql_get_host_info,NULL) @@ -1123,6 +1130,48 @@ /* }}} */ #endif +#ifdef MYSQL_HAS_SET_CHARSET +/* {{{ proto bool mysql_set_charset(string csname [, int link_identifier]) + sets client character set */ +PHP_FUNCTION(mysql_set_charset) +{ +zval **cs_name, **mysql_link; +int id; +php_mysql_conn *mysql; + +switch(ZEND_NUM_ARGS()) { +case 1: +if (zend_get_parameters_ex(1, &cs_name)==FAILURE) { +RETURN_FALSE; +} +id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); +CHECK_LINK(id); +break; +case 2: +if (zend_get_parameters_ex(2, &cs_name, &mysql_link)==FAILURE) { +RETURN_FALSE; +} +id = -1; +break; +default: +WRONG_PARAM_COUNT; +break; +} + + +ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); + +convert_to_string_ex(cs_name); + +if (!mysql_set_character_set(&mysql->conn, Z_STRVAL_PP(cs_name))) { +RETURN_TRUE; +} else { +RETURN_FALSE; +} +} +/* }}} */ +#endif + #ifndef NETWARE/* The below two functions not supported on NetWare */ #if MYSQL_VERSION_ID < 40000 /* {{{ proto bool mysql_create_db(string database_name [, int link_identifier]) Index: ext/mysql/php_mysql.h =================================================================== RCS file: /repository/php-src/ext/mysql/php_mysql.h,v retrieving revision 1.33.2.2.4.1 diff -u -r1.33.2.2.4.1 php_mysql.h --- ext/mysql/php_mysql.h1 Jan 2006 13:46:55 -00001.33.2.2.4.1 +++ ext/mysql/php_mysql.h18 Oct 2006 11:41:37 -0000 @@ -91,6 +91,9 @@ PHP_FUNCTION(mysql_thread_id); PHP_FUNCTION(mysql_client_encoding); PHP_FUNCTION(mysql_ping); +#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +PHP_FUNCTION(mysql_set_charset); +#endif ZEND_BEGIN_MODULE_GLOBALS(mysql) long default_link;
Index: ext/mysql/php_mysql.c =================================================================== RCS file: /repository/php-src/ext/mysql/php_mysql.c,v retrieving revision 1.213.2.6.2.5 diff -u -r1.213.2.6.2.5 php_mysql.c --- ext/mysql/php_mysql.c2 Aug 2006 10:04:11 -00001.213.2.6.2.5 +++ ext/mysql/php_mysql.c18 Oct 2006 12:05:41 -0000 @@ -101,6 +101,10 @@ #define MYSQL_HAS_YEAR #endif +#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +#define MYSQL_HAS_SET_CHARSET +#endif + #define MYSQL_ASSOC1<<0 #define MYSQL_NUM1<<1 #define MYSQL_BOTH(MYSQL_ASSOC|MYSQL_NUM) @@ -173,6 +177,9 @@ PHP_FE(mysql_thread_id,NULL) PHP_FE(mysql_client_encoding,NULL) PHP_FE(mysql_ping,NULL) +#ifdef MYSQL_HAS_SET_CHARSET +PHP_FE(mysql_set_charset,NULL) +#endif #ifdef HAVE_GETINFO_FUNCS PHP_FE(mysql_get_client_info,NULL) PHP_FE(mysql_get_host_info,NULL) @@ -1126,6 +1133,48 @@ /* }}} */ #endif +#ifdef MYSQL_HAS_SET_CHARSET +/* {{{ proto bool mysql_set_charset(string csname [, int link_identifier]) + sets client character set */ +PHP_FUNCTION(mysql_set_charset) +{ +zval **cs_name, **mysql_link; +int id; +php_mysql_conn *mysql; + +switch(ZEND_NUM_ARGS()) { +case 1: +if (zend_get_parameters_ex(1, &cs_name)==FAILURE) { +RETURN_FALSE; +} +id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); +CHECK_LINK(id); +break; +case 2: +if (zend_get_parameters_ex(2, &cs_name, &mysql_link)==FAILURE) { +RETURN_FALSE; +} +id = -1; +break; +default: +WRONG_PARAM_COUNT; +break; +} + + +ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); + +convert_to_string_ex(cs_name); + +if (!mysql_set_character_set(&mysql->conn, Z_STRVAL_PP(cs_name))) { +RETURN_TRUE; +} else { +RETURN_FALSE; +} +} +/* }}} */ +#endif + #ifndef NETWARE/* The below two functions not supported on NetWare */ #if MYSQL_VERSION_ID < 40000 /* {{{ proto bool mysql_create_db(string database_name [, int link_identifier]) Index: ext/mysql/php_mysql.h =================================================================== RCS file: /repository/php-src/ext/mysql/php_mysql.h,v retrieving revision 1.37.2.1 diff -u -r1.37.2.1 php_mysql.h --- ext/mysql/php_mysql.h1 Jan 2006 12:50:09 -00001.37.2.1 +++ ext/mysql/php_mysql.h18 Oct 2006 12:02:50 -0000 @@ -91,6 +91,9 @@ PHP_FUNCTION(mysql_thread_id); PHP_FUNCTION(mysql_client_encoding); PHP_FUNCTION(mysql_ping); +#if (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005 +PHP_FUNCTION(mysql_set_charset); +#endif ZEND_BEGIN_MODULE_GLOBALS(mysql) long default_link;
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php |
| | 5 answers | Add comment |
|
| Re: Encoding issue with Tedd 19:17:50 |
| | At 5:55 PM +0000 1/23/07, Dave Goodchild wrote:>This may be more of a mysql issue, but I am using php for my app so here>goes...>
I have a fee field in the database, and when users post events they can>specify entrance fee in . In some, not all, of the fields I am getting, for>example, 7 rather than . Is this an encoding issue? My guess is that it is. There are difference between browsers, OS's, and thus support for multilingual code-points. Not all allow the user to submit those types of characters and worse yet, some allow to them to be submitted incorrectly.
As such, if it were me and I wanted a form for the end user to indicate what currency s/her was entering, I would make it a selection control of some type and thereby control the user's input.
My $0.02.
tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
| | 5 answers | Add comment |
|