Re: [PHP] Re: Preg_match - Find URL and convert to lower case
In that case you could use the /e trailing option to use strtolower on the subpattern.
Re: [PHP] [PHP 4.4.5 / Apache 2.2.3] Abrupt and unrepeatable Segmentationfault (11)
Chris wrote: If nobody provides information then try the -internals list, they'll probably be able to help a bit more. Thanks a lot! I've done so, because it's very urgent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mssql conflict with sybase...
Dear all, I use php version 4.4.2. When i use mssql and sybase extention, they are conflict together. I don't know how to using them together. Please help me... Thanks & Best Regard
Re: [PHP] Tidy HTML source?
This is getting too philosophical for my taste. There are many reasons to justify different ways of programming and each user, according to his/her requirements, experience and circumstances weights them differently and may decide in a different way. I am not about argue in favor of any one method. I just developed a program that might help one of those particular methods, which anyone is free to choose or not to. If you find it useful, I am happy to help, if you don't, that is fine with me. Satyam - Original Message - From: "Paul Novitski" <[EMAIL PROTECTED]> To: Sent: Friday, December 01, 2006 1:47 AM Subject: Re: [PHP] Tidy HTML source? On Thursday 30 November 2006 18:51, Paul Novitski wrote: > With respect to separating code and markup, you said "sometimes there > are reasons not to do so, for example, web services." What are some > of those reasons? At 11/30/2006 10:57 AM, Sancar Saran wrote: What about performance ? Web services tend to be quite small applications, but even for larger ones I've never found performance to be an issue. Servers are fast and built for this kind of work: opening and reading files, running software. They have fast chips and big RAM. Regardless of which technique you use, you're going to utilize server resources and get your results in however many milliseconds. A templating system requires the processor to merge content with template. An inline markup assembly system requires the processor to build the markup from function calls. Where is the technique that doesn't take machine cycles? What about compexity ? I separate logic from markup in order to reduce complexity. I find both PHP logic and HTML markup easier to write, read, proofread, and modify when they're separate from one another (I use the word 'clean'). Those SO nice seperated template system produces lots of mini TPL files. I'm not talking about "those template systems," whichever ones you're referring to, I'm talking about programming style and practice. I don't use any templating system you've ever seen. I roll my own code. I can make my templates as few or many as the project deserves. You only need to produce as many template files as you need and want. Separation of markup from logic doesn't necessarily mean separate files: when I'm doing somethign quick & dirty I'll include the markup in the PHP file as a heredoc. What's most helpful to me is to remove the markup tags and attributes from the PHP logic structures as much as possible. I haven't seen any templating system out there in the world that I like, mostly because they mix the markup & logic too much for my taste or because they don't let me design the markup precisely the way I want. You have to include them... Includes are easy. Actually I usually use file_get_contents() in a function that selects accompanying CSS & template files programmatically. You have to parse them. Not necessarily. But if you do need to parse them, you need to write the parsing engine only once. Also you have to track and manage them. Yes, as you must manage all the files that make up a project. Adding a few more isn't a burden, especially if they bring clarity and efficiency to the work. And I'm not sure those template system gives you freedom. Because you cannot change your site design with this tpl files. If you change them too much you have to change your php code. I beg to differ: you *can* change your site design if you're using templates. That's part of the purpose of layer separation and templating in the first place, to enable markup changes without necessarily requiring software changes. You're free to change the template and/or change the stylesheet and/or change the data source according to your needs. Although we talk of separating logic from markup from presentation, these are not absolutely clean separations -- each component must have hooks in the others, otherwise there's no basis for a merge! Therefore if you change one component greatly enough, at least one other component must change as well. This is true of HTML and CSS, it's true of HTML and JavaScript, it's true of HTML and PHP. It's true of any interactive components in any system. It's true of PHP itself -- if you change a function's arguments or return type or a class's methods, you'll have to change the parts of your code that call that function or invoke that class. That's just the way it is. I'm sure you wouldn't argue that we write our software as one long mainline stream just to avoid includes and function calls. But it sounds as though you're suggesting that logic & markup should be combined in the same statements simply because you don't want to have to change more than one component. Really good website designs can make modification less onerous. Layer separation is one of those techniques. Fortunately there are many ways to accomplish similar goa
Re: [PHP] EZ array problem - What's wrong with my brain?
Well, I've only just fallen out of bed, but I'd say you'd be able to access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 to something else and $var["1.2"]["status"][0] to set/change "new". I must say this looks like an overly complicated array for what it serves. A little OOP could come in handy to organize all that in more friendly and efficient way ... Brian Dunning wrote: > var_dump() gives me this: > > array(1) { > ["1.2"]=> > array(2) { > ["code"]=> > array(1) { > [0]=> > string(3) "111" > } > ["status"]=> > array(1) { > [0]=> > string(3) "new" > } > } > } > > I'm trying to set a variable to that "1.2". Shouldn't I be able to get > it with $var = $arr[0][0]? > > --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] Help with strange include problem in PHP 5.2.0
Hi Richard, Hi all, The include path is correct. That was one of the first things I played around with. At the moment, it's include_path = ".". I also tried renaming the php.ini file to php.ini.off so that it wasn't found and took all the defaults, but with no success. Last night I built PHP 5.1.6 and took the same php.ini file. Everything worked. The build environment was the same, the configure arguments were the same, only the php version was different. I'm guessing that I've done something wrong somewhere because I haven't found any references to this problem from any one else. I just have no idea what it could be. I don't know if it's any help in locating the problem, my build environment is Solaris 10, Sun Studio 10 with the Sun C and C++ compilers. # cc-V Sun C 5.7 2005/01/07 # CC -V CC: Sun C++ 5.7 2005/01/07 LDFLAGS=-L/opt/sfw/lib -L/usr/sfw/lib -L/usr/lib -R/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/opt/oracle/instantclient_10_2 CPPFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include CFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include And to your "rant" about the code developers make - I totally agree with you. As the administrator of a server with close to 600 users who all put their own applications in their own accounts up, then ask me why it "doesn't work", I get annoyed at such things too. regards Markus On Thursday 30 November 2006 19:04, Richard Lynch wrote: > On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: > > I have a strange problem including files in PHP 5.2.0 running on Unix. > > If I > > try to include a file using include 'filename.inc';, everything is > > fine. As > > soon as I try to put a "." in front of the file name, for example > > include './filename.inc';, I get a "failed to open stream: No such > > file or > > directory" error. Does anyone have any suggestions as to what is > > going > > wrong?` This all works with php 4.4.4 built with the same environment > > and > > compiler on the same system. > > What is your include path in PHP 5.2.0? > > I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 > include_path has "." as one element within the list and that the PHP > 5.2.0 include_path does NOT have "." within the list. > > I.e.: > 4.4.4 include_path ".:include_test_dir" > 5.2.0 include_path "include_test_dir" > > In the first case, 4.4.4, you've got . in there, so . combined with ./ > will "find" the file you want. > > In the second case, 5.2.0, you've got no . in there, so ./ is looking > in a directory, not the directory you expect, and it ain't finding the > file because it's not there. > > Rant #24, not directed at Markus, but the world at large :-) > PHP developers should understand and use include_path instead of > hacking up their source with hard-coded paths and weird sub-directory > / parent-directory hacks in include/require statements. > > It drives me nuts when I install nice software packages, but I can't > put their components where I want them. > > End result: > rm -rf [insert your nifty project directory name here] > > -- > 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] Help with strange include problem in PHP 5.2.0
On Thursday 30 November 2006 19:04, Richard Lynch wrote: [snip...] And of course I forgot to put in the configure arguments './configure' \ '--without-pear' \ '--with-apxs2=/usr/local/apache2/bin/apxs' \ '--enable-mm=shared' \ '--with-mysql=/usr/local/MySQL/mysql-standard-5.0.27-solaris10-sparc' \ '--with-ldap=/usr/local/open-ldap' \ '--with-openssl=/usr/sfw/' \ '--with-zlib' \ '--enable-inline-optimization' \ '--enable-mm=shared' \ '--with-libxml-dir=/usr/local/lib/libxml-2.6.27' \ '--with-oci8=/opt/oracle/instantclient_10_2' \ "$@" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tidy HTML source?
Dear Paul, Many thanks for replaying my message, It was very helpful and now I really understood why I so negative for templating systems... I haven't got programer background or education. I'm self learner. Many of php programmers have other programming experiences, and if I understand correctly their thinking was very different than me. They taking html elements as programming variables. And because of this they want to use tpl files, because that html vas broken their code structure. And In my aproach, I thinking php and html are combined. When thinking code in my mind I realize it with HTML. And my aproach uses combination both of them. This is about to how I educade my mind. And thats why I jumped satyam idea, because html doesn't fit in php naturally, I have to to some ".." things to combine php and HTML and his aproach very close to use html tags naturally in php code. Also you are right that bad tpl experience, I spend my last 3 months to understand a project uses heavy tpl thing. I was very very messed. Of course this programmer responsibility. And one thing. If I remember correctly one of the Larsmus web presentation (its about to performance, Getting rich via php or someting like that) says reducing includes gives some kind of edge about performance. Regards. Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EZ array problem - What's wrong with my brain?
Youri LACAN-BARTLEY wrote: > Well, I've only just fallen out of bed, but I'd say you'd be able to > access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 > to something else and $var["1.2"]["status"][0] to set/change "new". > > I must say this looks like an overly complicated array for what it > serves. A little OOP could come in handy to organize all that in more > friendly and efficient way ... efficient? overly-complicated? php arrays are made for stuff like this. > > Brian Dunning wrote: >> var_dump() gives me this: >> >> array(1) { >> ["1.2"]=> >> array(2) { >> ["code"]=> >> array(1) { >> [0]=> >> string(3) "111" >> } >> ["status"]=> >> array(1) { >> [0]=> >> string(3) "new" >> } >> } >> } >> >> I'm trying to set a variable to that "1.2". Shouldn't I be able to get >> it with $var = $arr[0][0]? >> >> --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] problem with register globals on new server
> [EMAIL PROTECTED] wrote: >> hi, >> I had to move my osComerce store to new hosting company. new server runs >> on php5/mysql5. >> >> got this error: >> FATAL ERROR: register_globals is disabled in php.ini, please enable it! >> >> since evenon old server globals was Off I was adding >> >> php_value register_globals 1 >> >> >> Now, I tried with >> >> >> php_value register_globals On >> >> >> but it doesn't work. > > Maybe your host doesn't allow it to be changed through a htaccess.. > > Is htaccess support enabled? > > Put garbage in the file (random chars) and if you get a 500 internal > server error, htaccess files work.. if you don't, that's the problem. yup! that was the problem. though, after I talked to administrator, he is not happy to reconfigure Apache to allow .htaccess because of security issue. Is this REALLY so big issue? I have several osComerce carts and in some (most) of them I did some changes in code. Means, I have to move all carts to other shopping cart app and it's HUGE work?!? btw, any free cart that is well supported in php5/mysql5/apache2 and register globals off etc. to recomend? thanks. -afan > > Also I think apache is case sensitive: > > > ^ > > (not 100% sure but worth a try). > > -- > 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: [PHP] EZ array problem - What's wrong with my brain?
That seems right to me too - but everything I try returns NULL. I set $try=$var[0], and $try ends up being null; print_r($try) gives blank. I even tried $try=$var[1] and it was the same result. Am I in the Twilight Zone? On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I've only just fallen out of bed, but I'd say you'd be able to access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 to something else and $var["1.2"]["status"][0] to set/change "new". Brian Dunning wrote: var_dump() gives me this: array(1) { ["1.2"]=> array(2) { ["code"]=> array(1) { [0]=> string(3) "111" } ["status"]=> array(1) { [0]=> string(3) "new" } } } I'm trying to set a variable to that "1.2". Shouldn't I be able to get it with $var = $arr[0][0]? --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub pKYeQqK4FcNhmTdEIm41kic= =PSbi -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EZ array problem - What's wrong with my brain?
Try $try = $var["1.2"]; If your array looks like the one below then there is no $var[0] and therefore you get NULL /Thunis Brian Dunning skrev: That seems right to me too - but everything I try returns NULL. I set $try=$var[0], and $try ends up being null; print_r($try) gives blank. I even tried $try=$var[1] and it was the same result. Am I in the Twilight Zone? On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I've only just fallen out of bed, but I'd say you'd be able to access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 to something else and $var["1.2"]["status"][0] to set/change "new". Brian Dunning wrote: var_dump() gives me this: array(1) { ["1.2"]=> array(2) { ["code"]=> array(1) { [0]=> string(3) "111" } ["status"]=> array(1) { [0]=> string(3) "new" } } } I'm trying to set a variable to that "1.2". Shouldn't I be able to get it with $var = $arr[0][0]? --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub pKYeQqK4FcNhmTdEIm41kic= =PSbi -END PGP SIGNATURE- --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] EZ array problem - What's wrong with my brain?
Hi Jochem, I meant "overly-complicated" in this specific context. If each key of this array is going to contain only one value why not reduce the array to something like this : array(1) { ["1.2"]=> array(2) { ["code"]=> string(3) "111" ["status"]=> string(3) "new" } } That's all I was referring to ... Jochem Maas wrote: > Youri LACAN-BARTLEY wrote: >> Well, I've only just fallen out of bed, but I'd say you'd be able to >> access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 >> to something else and $var["1.2"]["status"][0] to set/change "new". >> >> I must say this looks like an overly complicated array for what it >> serves. A little OOP could come in handy to organize all that in more >> friendly and efficient way ... > > efficient? overly-complicated? > > php arrays are made for stuff like this. > >> Brian Dunning wrote: >>> var_dump() gives me this: >>> >>> array(1) { >>> ["1.2"]=> >>> array(2) { >>> ["code"]=> >>> array(1) { >>> [0]=> >>> string(3) "111" >>> } >>> ["status"]=> >>> array(1) { >>> [0]=> >>> string(3) "new" >>> } >>> } >>> } >>> >>> I'm trying to set a variable to that "1.2". Shouldn't I be able to get >>> it with $var = $arr[0][0]? >>> >>> --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] EZ array problem - What's wrong with my brain?
That works, but the value 1.2 is unknown, I can't hardcode it. On Dec 1, 2006, at 6:52 AM, Fredrik Thunberg wrote: Try $try = $var["1.2"]; If your array looks like the one below then there is no $var[0] and therefore you get NULL /Thunis Brian Dunning skrev: That seems right to me too - but everything I try returns NULL. I set $try=$var[0], and $try ends up being null; print_r($try) gives blank. I even tried $try=$var[1] and it was the same result. Am I in the Twilight Zone? On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I've only just fallen out of bed, but I'd say you'd be able to access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 to something else and $var["1.2"]["status"][0] to set/change "new". Brian Dunning wrote: var_dump() gives me this: array(1) { ["1.2"]=> array(2) { ["code"]=> array(1) { [0]=> string(3) "111" } ["status"]=> array(1) { [0]=> string(3) "new" } } } I'm trying to set a variable to that "1.2". Shouldn't I be able to get it with $var = $arr[0][0]? --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub pKYeQqK4FcNhmTdEIm41kic= =PSbi -END PGP SIGNATURE- --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] EZ array problem - What's wrong with my brain?
http://www.php.net/manual/en/language.types.array.php If you check out the documentation on arrays, you will see the second code example shows the expected behavior of arrays in this case. $arr = array("foo" => "bar", 12 => true); echo $arr["foo"]; // bar echo $arr[12];// 1 Now, since each element can be indexed by either a string or an integer, then you can do something like this: $arr = array("1.2" => array(1,2,3,4)); $arr[0] = & $arr["1.2"]; That would set up your doubly indexed array so that you could use either associative keys or numeric keys. http://www.php.net/manual/en/language.references.php PHP.net can explain how references work better than I can. Basically it creates a "symbolic link" (to use a *nix term) to the key "1.2". It shouldn't take up too much memory to do that. -- Ray Hauge Application Development Lead American Student Loan Services www.americanstudentloan.com -Original Message- From: Fredrik Thunberg [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 8:52 AM To: Brian Dunning; php-general@lists.php.net Subject: Re: [PHP] EZ array problem - What's wrong with my brain? Try $try = $var["1.2"]; If your array looks like the one below then there is no $var[0] and therefore you get NULL /Thunis Brian Dunning skrev: > That seems right to me too - but everything I try returns NULL. I set > $try=$var[0], and $try ends up being null; print_r($try) gives blank. > I even tried $try=$var[1] and it was the same result. Am I in the > Twilight Zone? > > > On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Well, I've only just fallen out of bed, but I'd say you'd be able to >> access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 >> to something else and $var["1.2"]["status"][0] to set/change "new". >> >> Brian Dunning wrote: >>> var_dump() gives me this: >>> >>> array(1) { >>> ["1.2"]=> >>> array(2) { >>> ["code"]=> >>> array(1) { >>> [0]=> >>> string(3) "111" >>> } >>> ["status"]=> >>> array(1) { >>> [0]=> >>> string(3) "new" >>> } >>> } >>> } >>> >>> I'm trying to set a variable to that "1.2". Shouldn't I be able to get >>> it with $var = $arr[0][0]? >>> >>> --PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.5 (MingW32) >> >> iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub >> pKYeQqK4FcNhmTdEIm41kic= >> =PSbi >> -END PGP SIGNATURE- > > --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] EZ array problem - What's wrong with my brain?
I forgot to mention that you won't be able to use "0", "1", etc. as PHP will convert those to integers. If you do use them, then they will replace [0] with whatever you put in there, and if you are using the references, it will replace both instances with your new ["0"] HTH -- Ray Hauge Application Development Lead American Student Loan Services www.americanstudentloan.com -Original Message- From: Ray Hauge Sent: Friday, December 01, 2006 9:21 AM To: Fredrik Thunberg; Brian Dunning; php-general@lists.php.net Subject: RE: [PHP] EZ array problem - What's wrong with my brain? http://www.php.net/manual/en/language.types.array.php If you check out the documentation on arrays, you will see the second code example shows the expected behavior of arrays in this case. $arr = array("foo" => "bar", 12 => true); echo $arr["foo"]; // bar echo $arr[12];// 1 Now, since each element can be indexed by either a string or an integer, then you can do something like this: $arr = array("1.2" => array(1,2,3,4)); $arr[0] = & $arr["1.2"]; That would set up your doubly indexed array so that you could use either associative keys or numeric keys. http://www.php.net/manual/en/language.references.php PHP.net can explain how references work better than I can. Basically it creates a "symbolic link" (to use a *nix term) to the key "1.2". It shouldn't take up too much memory to do that. -- Ray Hauge Application Development Lead American Student Loan Services www.americanstudentloan.com -Original Message- From: Fredrik Thunberg [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 8:52 AM To: Brian Dunning; php-general@lists.php.net Subject: Re: [PHP] EZ array problem - What's wrong with my brain? Try $try = $var["1.2"]; If your array looks like the one below then there is no $var[0] and therefore you get NULL /Thunis Brian Dunning skrev: > That seems right to me too - but everything I try returns NULL. I set > $try=$var[0], and $try ends up being null; print_r($try) gives blank. > I even tried $try=$var[1] and it was the same result. Am I in the > Twilight Zone? > > > On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Well, I've only just fallen out of bed, but I'd say you'd be able to >> access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 >> to something else and $var["1.2"]["status"][0] to set/change "new". >> >> Brian Dunning wrote: >>> var_dump() gives me this: >>> >>> array(1) { >>> ["1.2"]=> >>> array(2) { >>> ["code"]=> >>> array(1) { >>> [0]=> >>> string(3) "111" >>> } >>> ["status"]=> >>> array(1) { >>> [0]=> >>> string(3) "new" >>> } >>> } >>> } >>> >>> I'm trying to set a variable to that "1.2". Shouldn't I be able to get >>> it with $var = $arr[0][0]? >>> >>> --PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.5 (MingW32) >> >> iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub >> pKYeQqK4FcNhmTdEIm41kic= >> =PSbi >> -END PGP SIGNATURE- > > --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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EZ array problem - What's wrong with my brain?
Well if the key of your array is unknown, you could always gather the key names with array_keys() and fiddle something from there or just change the structure of you array to be more adapted to you needed or use what Ray just proposed in another post concerning references and the creation of a numeric key as a "symbolic link" towards your string key ... Good luck ! Brian Dunning wrote: > That works, but the value 1.2 is unknown, I can't hardcode it. > > > On Dec 1, 2006, at 6:52 AM, Fredrik Thunberg wrote: > >> Try >> >> $try = $var["1.2"]; >> >> If your array looks like the one below then there is no $var[0] and >> therefore you get NULL >> >> >> /Thunis >> Brian Dunning skrev: >>> That seems right to me too - but everything I try returns NULL. I set >>> $try=$var[0], and $try ends up being null; print_r($try) gives blank. >>> I even tried $try=$var[1] and it was the same result. Am I in the >>> Twilight Zone? >>> >>> >>> On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: >>> > Well, I've only just fallen out of bed, but I'd say you'd be able to > access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 > to something else and $var["1.2"]["status"][0] to set/change "new". > > Brian Dunning wrote: >> var_dump() gives me this: >> >> array(1) { >> ["1.2"]=> >> array(2) { >> ["code"]=> >> array(1) { >> [0]=> >> string(3) "111" >> } >> ["status"]=> >> array(1) { >> [0]=> >> string(3) "new" >> } >> } >> } >> >> I'm trying to set a variable to that "1.2". Shouldn't I be able to get >> it with $var = $arr[0][0]? >> >> --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 >> > --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] Re: mail header questions
> > The strange thing is that even the fifth parameter solution doesn't work. > > I use Postfix as MTA by the way. > > Strange - I use postfix on my dev server and it works fine. Are you > running anything non-default in postfix (eg chroot) ? > > -- > Postgresql & php tutorials > http://www.designmagick.com/ Hi Chris, the fifth parameter did work when I tested it later on my webserver, so there's something wrong with postfix on my local machine. regards, Chantal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with register globals on new server
[EMAIL PROTECTED] wrote: > yup! that was the problem. > btw, any free cart that is well supported in php5/mysql5/apache2 and > register globals off etc. to recomend? > > thanks. > > -afan Well I would really be tempted to say, MINE ! Although it's still in a sick state alpha version right now ... It's been under development for 8 months now and aims primarily at handling large amounts of products imported for CSV files. Ie retrieving catalogs from distributors and handling all that in relatively automated way. I might be putting the project up under some free license at some point. All works with PHP 5 and register_globals Off. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: FW: [PHP] Re: Please hack my app
Hi Jordan, Thank you for your offer. As you know, I've signed up a couple of days ago. I ran a scan yesterday and have gotten a big PDF file out of it. I've quickly scanned through the results and it appears there are a lot of times when I use one of my own functions (sometimes even without an argument) it finds a vulnerability. I will analyze the results more detailed later on. Would you appreciate comments on the service? Thanks again, Ivo On Tue, 28 Nov 2006 14:19:30 +0800, Jordan Forssman wrote: > Hi, > > My name is Jordan Forssman, I am representing a company called Armorize > Technologies. We have developed a source code analysis platform for PHP, > called CodeSecure, which scans source code for SQL injection, cross site > scripting, command injection, etc, vulnerability. The tool will tell you > exactly which line the vulnerability is on, explain the propagation of > the tainted variables, and assist you in fixing the bug. I believe this > tool will help you verify the security of your application and will be > able to do so very quickly. At the moment we are scanning around 20 000 > lines in under 5 minutes, or 1M in about 2 minutes, depending on the > application. > > Currently we are accepting applications for trial accounts, if you would > like to use our tool to scan your code please log on to > http://www.armorize.com/events/trialapplication and submit the form. > We are just starting our sales and marketing effort so I hope you can > use our product and give us some feedback. > > If you want to know more about our company and product you can find us > at: www.armorize.com , download our datasheets and whitepapers at > www.armorize.com/resources/download . > > The trial is free and can be accessed over the Web, we are using the > trials as a test case for offering the product as a service and also to > promote the product. Once I receive your application I will send you an > e-mail with a quickstart guide and login details. > > If you have any questions, please feel free to contact me anytime. > > Best Regards, > > Jordan Forssman > Sales Manager > Armorize Technologies > Tel. +886-2-6616-0100 ext. 201 > Cell. +886-938-100-214 > Fax. +886-2-6616-1100 > Skype: jordan4z > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > > -Original Message- > From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] > Sent: Monday, November 27, 2006 6:01 PM > To: php-general@lists.php.net > Subject: [PHP] Re: Please hack my app > > On Wed, 22 Nov 2006 09:57:50 +0100, Ivo F.A.C. Fokkema wrote: > >> Hi List, >> >> As this subject may start you wondering what the hell I'm thinking, > let me >> clearify: >> >> I've been rewriting an GPL'ed PHP/MySQL app from scratch for the last > 12 >> months or so. It facilitates storage of DNA mutations and the >> corresponding patient data. Because patient data is involved, privacy > is >> very important. >> Now of course I read lots of pages on SQL injection and whatnot, and I >> strongly believe my application is protected from this kind of abuse. >> However, believing is not enough. I've had some comments in the past > about >> security (previous version of the software) and although I didn't > agree to >> the critic, I want to be able to say the new app went though various > forms >> of attacks. This month, I want to release 2.0-alpha-01... >> >> *** THIS IS NOT ABOUT HACKING THE SERVER *** >> But about getting in the application when you're not allowed to! >> >> If you feel like helping me out, it's located at >> http://chromium.liacs.nl/LOVDv.2.0-dev/ >> >> 1) Please try to get in. There's one account in the system, a database >> administrator, capable of doing anything. If you get in, you can > easily >> create a new user using the setup tab. This will be the prove of you >> breaking my security rules. >> >> 2) Can you manage to view unpublic data? Using the Variants tab, you >> can see there is currently one entry in the database (with two > mutations). >> This entry has a hidden column, called 'Patient ID'. There is a >> text-string in that column. If you can tell me what that string is, > you >> win :) >> >> 3) Feel free to register as a submitter to see if that gives you any >> rights that you shouldn't have. A submitter is only capable of adding > new >> data to the database (Submit tab), but that data will not be published >> immediately. >> >> 4) After a while, I will release login details of a curator account. > This >> user is allowed to see non-public data and handle the specific gene, > but >> NOT create new users or the like. >> >> >> If you have any questions, please ask. Thank you in advance for using > your >> expertise for the good cause :) > > In case anyone is interested; I've created a low-level user > ('untrusted') > in the system. Password is equal to username. Feel free to try and do > stuff you're not supposed to, like creating a new user or creating a > gene. > > Ivo -- PHP General Mailing List (http://ww
Re: [PHP] Re: mail header questions
Hi there Chantal, Hi all, have you ever thought of using phpMailer or swiftmailer? That has solved me a lot of hassle with time, especially as far as correctly setting the Return-Path is concerned. Good luck ! Chantal Rosmuller wrote: >>> The strange thing is that even the fifth parameter solution doesn't work. >>> I use Postfix as MTA by the way. >> Strange - I use postfix on my dev server and it works fine. Are you >> running anything non-default in postfix (eg chroot) ? >> >> -- >> Postgresql & php tutorials >> http://www.designmagick.com/ > > Hi Chris, the fifth parameter did work when I tested it later on my > webserver, > so there's something wrong with postfix on my local machine. > > regards, Chantal > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Preg_match - Find URL and convert to lower case
On Nov 30, 2006, at 7:50 PM, Jonesy wrote: On Thu, 30 Nov 2006 14:16:16 -0800, Kevin Murphy wrote: I have some text that comes out of a database all in uppercase (old IBM Mainframe that only supports uppercase characters). I see via other followups that you have your kludge working. *But* , What do you mean by "old IBM Mainframe that only supports uppercase characters"? The EBCDIC codes X'81' > X'89' (a-i), X'91' > X'99' (j-r), and X'A2' > X'A9' (s-z) have been defined and used since probably before you were born. I have in front of me my first IBM Green Card (IBM System/360 Reference Data, GX20-1703-3) from 1966 which debunks that urban legend. If the data in the mainframe database is all upper case, it was sloppy programming or sloppy design that got it there. If it _is_ stored in the mainframe database in proper UC/lc form, then it is probably a sloppy extraction procedure that is to blame for your input. Jonesy -- Marvin L Jones| jonz | W3DHJ | linux 38.24N 104.55W | @ config.com | Jonesy | OS/2 *** Killfiling google posts: Yeah, that would be the problem. My website and its MySQL database are totally seperate from this data (its class schedule data). All the data in the database is uppercase and I've been told that all the data must remain as uppercase only. Why? I have no idea. Can I change that? Nope. Welcome to my world and the joys of working with governmental institutions. So I did misspeak before. The mainframe itself probably supports UC/ lc, but whatever program is on it, or maybe its just a procedure issue (its _always_ been done this way so we _must_ continue doing it that way). But, the data I see in my extract is all upper case and that's what I am dealing with. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326
Re: [PHP] hiding passwd in cmdlines that appear in the process list
On Thu, November 30, 2006 12:29 pm, Edwin Barrios wrote: > This is not triue because a shell vars declered on a shell is only > exposed > to its subshells, that means that only exec's and system functions > calls > into the php itself resive those vars declared into the php ! > > You can see this argument in the following code > >error_reporting(E_ALL); > > > echo "OLD "; > system("env"); > echo ""; > > putenv("DBNAME=sidf"); > putenv("DBUSER=p"); > putenv("DBPASSWD=p"); > > echo "NEW "; > system("env"); > echo ""; > > ?> > > and reloading these a couple of times. My point was that somebody who was doing: system("env"); in a different part of the script, to debug something else, will expose the password, probably without even realizing it. -- 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] hiding passwd in cmdlines that appear in the process list
If you did use ENV to set the username and password, you could always unset it using the same method after you ran the mysql command. So it'd only be exposed for a very brief period of time and slightly less accessible than just running a process list. It still falls under the category of "security through obscurity" which isn't a best practice scenario. But I can't think of another way to run mysql under these circumstances that's any better. -TG = = = Original message = = = On Thu, November 30, 2006 12:29 pm, Edwin Barrios wrote: > This is not triue because a shell vars declered on a shell is only > exposed > to its subshells, that means that only exec's and system functions > calls > into the php itself resive those vars declared into the php ! > > You can see this argument in the following code > >error_reporting(E_ALL); > > > echo "OLD "; > system("env"); > echo ""; > > putenv("DBNAME=sidf"); > putenv("DBUSER=p"); > putenv("DBPASSWD=p"); > > echo "NEW "; > system("env"); > echo ""; > > ?> > > and reloading these a couple of times. My point was that somebody who was doing: system("env"); in a different part of the script, to debug something else, will expose the password, probably without even realizing it. -- 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? ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remote MySQL connection via PHP file
Hi all, I've been searching around for a while, but cannot find a solution. For a project of mine, I need to keep the connection information to a MySQL server database on another server. Example remote file: Example local file: http://www.remoteserver.com/remote_file.php";; // Use variables $user and $pass somehow... ?> I've tried including the file which has the username/pass, etc information via HTTP, but this doesn't seem to work. I assume because it returns what a web browser would return if this file was loaded into one, a blank screen. I've tried using the return statement in the file which houses the information, but this seems to return a boolean value (1 or 0)... not sure what's up with that. Any help with this would be most appreciated. Thank you. Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: on OS X
Hello DC, Am 2006-11-27 02:43:41, schrieb Dotan Cohen: > Exactly for that reason I don't recommend that you use it. Just use > as it's portable and doesn't add that much > typing- certainly not enough to justify the headache. Thanks for this info. This is new for me and since I rewrite many of my scripts I will add the "print" command. Greetings Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: on OS X
Am 2006-11-27 03:28:08, schrieb Dotan Cohen: > Actually, it does. He can global replace "http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Remote MySQL connection via PHP file
i suggest you: database.conf (the file on another server) host=localhost user=test pass=test anothervar=anothervalue on your script: $temp = file(http://../database.conf); foreach($temp as $val) { $temp2 = explode("=",$val); $$temp2[0] = $temp[1]; } after that, you`ll have: $host = 'localhost' $user = 'test' $pass = 'test' $anothervar ='anothervalue'; mysql_connect($host,$user,$pass); (bla bla) hope this help; On 12/1/06, Scott <[EMAIL PROTECTED]> wrote: Hi all, I've been searching around for a while, but cannot find a solution. For a project of mine, I need to keep the connection information to a MySQL server database on another server. Example remote file: Example local file: http://www.remoteserver.com/remote_file.php";; // Use variables $user and $pass somehow... ?> I've tried including the file which has the username/pass, etc information via HTTP, but this doesn't seem to work. I assume because it returns what a web browser would return if this file was loaded into one, a blank screen. I've tried using the return statement in the file which houses the information, but this seems to return a boolean value (1 or 0)... not sure what's up with that. Any help with this would be most appreciated. Thank you. Scott -- 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] Detecting naughty sites
- Original Message - From: "Satyam" <[EMAIL PROTECTED]> The Wikipedia article of the day provides some interesting facts about when if became naughty: http://en.wikipedia.org/wiki/History_of_erotic_depictions -- May I add something that came to my mind related to this. As the Wikipedia article says, the idea of pornography was developed mostly in the Victorian era. It is fitting to mention that at the same time, those we would now call scientists (the term wasn't popular then) devoted much of their time to screwing. Pretty much as anybody else, you would say. Not quite, the term meant something else then. The Industrial Revolution was facing a big problem , the lack of standards. Each and every machine was unique, when something broke, a replacement had to be crafted, just like the original piece had been. One of the most important pieces, due to the quantity used in each and every machine, were screws, bolts and nuts. Thus, it was important to develop standards for screws, length, diameter, threads per inch, depth and profile of the thread and so on, so they could be manufactured in quantities. This subject was referred to as 'screwing' and I am sure Queen Victoria would have wholehartedly aproved of it. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting naughty sites
On Fri, 2006-12-01 at 20:41 +0100, Satyam wrote: > - Original Message - > From: "Satyam" <[EMAIL PROTECTED]> > > > > The Wikipedia article of the day provides some interesting facts about > > when if became naughty: > > > > http://en.wikipedia.org/wiki/History_of_erotic_depictions > > > > -- > > May I add something that came to my mind related to this. As the Wikipedia > article says, the idea of pornography was developed mostly in the Victorian > era. It is fitting to mention that at the same time, those we would now > call scientists (the term wasn't popular then) devoted much of their time to > screwing. Pretty much as anybody else, you would say. Not quite, the term > meant something else then. > > The Industrial Revolution was facing a big problem , the lack of standards. > Each and every machine was unique, when something broke, a replacement had > to be crafted, just like the original piece had been. One of the most > important pieces, due to the quantity used in each and every machine, were > screws, bolts and nuts. Thus, it was important to develop standards for > screws, length, diameter, threads per inch, depth and profile of the thread > and so on, so they could be manufactured in quantities. > > This subject was referred to as 'screwing' and I am sure Queen Victoria > would have wholehartedly aproved of it. That's really screwed up! :B Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Preg_match - Find URL and convert to lower case
On Fri, 1 Dec 2006, Kevin Murphy wrote: > On Nov 30, 2006, at 7:50 PM, Jonesy wrote: >> On Thu, 30 Nov 2006 14:16:16 -0800, Kevin Murphy wrote: >>> >>> I have some text that comes out of a database all in uppercase (old >>> IBM Mainframe that only supports uppercase characters). >> >> I see via other followups that you have your kludge working. *But* , >> >> What do you mean by "old IBM Mainframe that only supports uppercase >> characters"? The EBCDIC codes X'81' > X'89' (a-i), X'91' > X'99' (j-r), >> and X'A2' > X'A9' (s-z) have been defined and used since probably before >> you were born. I have in front of me my first IBM Green Card (IBM >> System/360 Reference Data, GX20-1703-3) from 1966 which debunks that >> urban legend. >> >> If the data in the mainframe database is all upper case, it was sloppy >> programming or sloppy design that got it there. If it _is_ stored in >> the mainframe database in proper UC/lc form, then it is probably a >> sloppy extraction procedure that is to blame for your input. > > Yeah, that would be the problem. My website and its MySQL database are totally > seperate from this data (its class schedule data). All the data in the > database > is uppercase and I've been told that all the data must remain as uppercase > only. Why? I have no idea. Can I change that? Nope. Welcome to my world and > the > joys of working with governmental institutions. > > So I did misspeak before. The mainframe itself probably supports UC/lc, but > whatever program is on it, or maybe its just a procedure issue (its _always_ > been done this way so we _must_ continue doing it that way). But, the data > I see in my extract is all upper case and that's what I am dealing with. Ahhh... So, it was sloppy design -- Way Back Then. Except, in MainFrame years, the arrival of the WWW and URL's was only weeks ago. There is no excuse for that DB design to be all uppercase, since that would pollute the data (URL's) and 'they' had to know it even then. Gov. work + lowest bidder . Good luck with the project. And, Happy Shopping Season. Jonesy -- Marvin L Jones | jonz | W3DHJ | linux Pueblo, Colorado | @ | Jonesy | OS/2 __ 38.24N 104.55W | config.com | DM78rf |SK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Remote MySQL connection via PHP file
That seems like it wouldn't be very secure at all. Maybe it's just because I don't understand the reason for *having* to do it that way. My first suggestion would be to see if there's any way you don't have to do that. If you have to do it, I would suggest maybe having it on an NFS share, or maybe FTP. Something that requires authentication would be best. -- Ray Hauge Application Development Lead American Student Loan Services www.americanstudentloan.com -Original Message- From: Scott [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 12:18 PM To: php-general@lists.php.net Subject: [PHP] Remote MySQL connection via PHP file Hi all, I've been searching around for a while, but cannot find a solution. For a project of mine, I need to keep the connection information to a MySQL server database on another server. Example remote file: Example local file: http://www.remoteserver.com/remote_file.php";; // Use variables $user and $pass somehow... ?> I've tried including the file which has the username/pass, etc information via HTTP, but this doesn't seem to work. I assume because it returns what a web browser would return if this file was loaded into one, a blank screen. I've tried using the return statement in the file which houses the information, but this seems to return a boolean value (1 or 0)... not sure what's up with that. Any help with this would be most appreciated. Thank you. Scott -- 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] Remote MySQL connection via PHP file
At 12/1/2006 10:17 AM, Scott wrote: For a project of mine, I need to keep the connection information to a MySQL server database on another server. I'm sure there are more efficient ways to do this, but here's a fall-back: Write a PHP program (web service) to run on the server where the database is located. From the other server, make an HTTP request that includes the connection details (obfuscated), some sort of password that can verify the authenticity of the requesting agent, and either the literal SQL query or a symbolic pointer to a stored query. http://example.com/sqlservice.php?u=HJDFH&p=hglkdl&a=1095673263&q=members or http://example.com/sqlservice.php?u=HJDFH&p=hglkdl&a=1095673263&q=SELECT%20Firstname... The web service validates the request and returns the dataset, in XML, as a serialized array, or in another easy-to-use format, for the requesting program to parse and utilize. The first thing I'd put in the return dataset would be a status code to communicate MySQL errors, perhaps also num_rows for SELECT queries to reduce the number of trans-server requests necessary for typical jobs. Regards, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote MySQL connection via PHP file
cajbecu wrote: i suggest you: database.conf (the file on another server) host=localhost user=test pass=test anothervar=anothervalue have you thought of the security implications of this, a text file with user names/passwords, thats rather insecure I would say, on your script: $temp = file(http://../database.conf); foreach($temp as $val) { $temp2 = explode("=",$val); $$temp2[0] = $temp[1]; } after that, you`ll have: $host = 'localhost' $user = 'test' $pass = 'test' $anothervar ='anothervalue'; mysql_connect($host,$user,$pass); (bla bla) hope this help; On 12/1/06, Scott <[EMAIL PROTECTED]> wrote: Hi all, I've been searching around for a while, but cannot find a solution. For a project of mine, I need to keep the connection information to a MySQL server database on another server. Example remote file: Example local file: http://www.remoteserver.com/remote_file.php";; // Use variables $user and $pass somehow... ?> I've tried including the file which has the username/pass, etc information via HTTP, but this doesn't seem to work. I assume because it returns what a web browser would return if this file was loaded into one, a blank screen. I've tried using the return statement in the file which houses the information, but this seems to return a boolean value (1 or 0)... not sure what's up with that. Any help with this would be most appreciated. Thank you. Scott -- 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] Remote MySQL connection via PHP file
Scott wrote: Hi all, I've been searching around for a while, but cannot find a solution. For a project of mine, I need to keep the connection information to a MySQL server database on another server. http://www.remoteserver.com/remote_file.php";; // Use variables $user and $pass somehow... ?> why do you need to do this, would it not be simpler for the db admin to give you a username and password for the database, or provide some sort of xml interface, on the remote server, to access the database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] magic_quotes
Hello, without trying to embarrass myself, but Here the "smart quoting" function off php.net |function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } From that Idea I implemented that into my MySQL class: public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return stripslashes($string); } else { return mysql_real_escape_string($string); } } I call up in in the following manner: $result= $mysql->query("SELECT * FROM [[prefix]]_users WHERE name = '".MySQL::smartQuote($_POST['username'])."' AND password = '".md5(MySQL::smartQuote($_POST['password']))."' "); Now, when magic_quotes is off and the user name is say Jingle'sBells - it works fine, because mysql_real_escape_string() kicks in. But if magic_quotes is on I get the error that something is invalid in my SQL syntax near 'sBells' - because of could it would look like name = 'Jingle'sBells' So I modified a little: public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return mysql_real_escape_string(stripslashes($string)); } else { return mysql_real_escape_string($string); } } That now works both with magic_quotes on and off for Inserts / Selects etc. etc. (of course I have to call on MySQL::smartQuote() for each value - but it's worth it. Or does my function defeat the point totally? I did notice that with both magic_quotes On or Off data is inserted correctly into the table as Jingle's Bells without slashes. I was wondering if my above function is correct and the website's documentation is off a little? Regards, Johannes I'm grateful for any help. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] magic_quotes
On 12/1/06, Johannes Lindenbaum <[EMAIL PROTECTED]> wrote: Hello, without trying to embarrass myself, but Here the "smart quoting" function off php.net |function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } From that Idea I implemented that into my MySQL class: public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return stripslashes($string); } else { return mysql_real_escape_string($string); } } I call up in in the following manner: $result= $mysql->query("SELECT * FROM [[prefix]]_users WHERE name = '".MySQL::smartQuote($_POST['username'])."' AND password = '".md5(MySQL::smartQuote($_POST['password']))."' "); Now, when magic_quotes is off and the user name is say Jingle'sBells - it works fine, because mysql_real_escape_string() kicks in. But if magic_quotes is on I get the error that something is invalid in my SQL syntax near 'sBells' - because of could it would look like name = 'Jingle'sBells' So I modified a little: public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return mysql_real_escape_string(stripslashes($string)); } else { return mysql_real_escape_string($string); } } That now works both with magic_quotes on and off for Inserts / Selects etc. etc. (of course I have to call on MySQL::smartQuote() for each value - but it's worth it. Or does my function defeat the point totally? I did notice that with both magic_quotes On or Off data is inserted correctly into the table as Jingle's Bells without slashes. I was wondering if my above function is correct and the website's documentation is off a little? Regards, Johannes I'm grateful for any help. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return stripslashes($string); } else { return mysql_real_escape_string($string); } } You almost have it. What you need to do is if magic quotes is on, then stripslashes and apply mysql_real_escape_string. If magic quotes is off only apply mysql_real_escape_string since php didn't escape values for you. Also in your mysql_real_escape_string I would suggest adding the second parameter to your connection. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] magic_quotes
Eric Butera schrieb: You almost have it. What you need to do is if magic quotes is on, then stripslashes and apply mysql_real_escape_string. If magic quotes is off only apply mysql_real_escape_string since php didn't escape values for you. Also in your mysql_real_escape_string I would suggest adding the second parameter to your connection. Isn't that what I have? Quote: So I modified a little: public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return mysql_real_escape_string(stripslashes($string)); } else { return mysql_real_escape_string($string); } } if the MQ runtime is on / 1 stripslashes from string then apply mysql_real_escape_string? [ So the documentation is wrong? http://ca.php.net/manual/en/function.mysql-real-escape-string.php - Example 3. A "Best Practice" query ] I will add the MySQL link identifier - cheers! Thanks again for the help. Regards, Johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] magic_quotes
On 12/1/06, Johannes Lindenbaum <[EMAIL PROTECTED]> wrote: Eric Butera schrieb: > > You almost have it. What you need to do is if magic quotes is on, > then stripslashes and apply mysql_real_escape_string. If magic quotes > is off only apply mysql_real_escape_string since php didn't escape > values for you. > > Also in your mysql_real_escape_string I would suggest adding the > second parameter to your connection. > > Isn't that what I have? Quote: So I modified a little: public function smartQuote( $string ) { if( get_magic_quotes_gpc() == 1 ) { return mysql_real_escape_string(stripslashes($string)); } else { return mysql_real_escape_string($string); } } if the MQ runtime is on / 1 stripslashes from string then apply mysql_real_escape_string? [ So the documentation is wrong? http://ca.php.net/manual/en/function.mysql-real-escape-string.php - Example 3. A "Best Practice" query ] I will add the MySQL link identifier - cheers! Thanks again for the help. Regards, Johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Blah sorry, I saw your second example not your final code. Some scripts I use have different database connections and because of that it is very important to always make sure I am using the correct link identifier. The php best practice example checks the string to see if it is a number. If it is there technically isn't any reason to escape because there won't be any quotes. Just out of curiosity how exactly are you going to put the link identifier in your method since it is static? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote MySQL connection via PHP file
On Fri, December 1, 2006 12:17 pm, Scott wrote: > I've been searching around for a while, but cannot find a solution. > For > a project of mine, I need to keep the connection information to a > MySQL > server database on another server. > > Example remote file: > > $user = "joe"; > $pass = "1234"; > ?> > > Example local file: > > include "http://www.remoteserver.com/remote_file.php";; > // Use variables $user and $pass somehow... > ?> > > I've tried including the file which has the username/pass, etc > information via HTTP, but this doesn't seem to work. It would work if your script on the other end wasn't a PHP script, but was plaintext which output the PHP source you want. BEFORE (you did) AFTER (you should do) [php source] [php source] ?>"; ?> echo $php; The difference being that one executes the PHP on the remote server, and outputs nothing, and the other composes PHP source to be output, which is then 'include'd on the local server and executed there. Obligatory Security Notes: You're opening up a giant can of worms in security here. If you're not doing this over SSL, a code injection attack is pretty easy. Plus, anybody who can surf to the remote machine will be seeing your password as output. You really need to think deep about whether you really want to do this, and why, and all the security implications. Start reading here: http://phpsec.org -- 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] Help with strange include problem in PHP 5.2.0
Try running it under some kind of debugger and see if you can figure out what directories it's even checking when it doesn't find the file... I dunno if Zend IDE (or whatever it's called now) or Komodo or XDebug or whatnot will do that, but it's definitely sounding very odd if your include_path has "." in it... Oooh... What does PHP think your cwd is? echo 'cwd: ', cwd(), "\n"; right before the include. On Fri, December 1, 2006 3:47 am, Markus Mayer wrote: > Hi Richard, > Hi all, > > The include path is correct. That was one of the first things I > played around > with. At the moment, it's include_path = ".". I also tried renaming > the > php.ini file to php.ini.off so that it wasn't found and took all the > defaults, but with no success. > > Last night I built PHP 5.1.6 and took the same php.ini file. > Everything > worked. The build environment was the same, the configure arguments > were the > same, only the php version was different. > > I'm guessing that I've done something wrong somewhere because I > haven't found > any references to this problem from any one else. I just have no idea > what > it could be. I don't know if it's any help in locating the problem, > my build > environment is Solaris 10, Sun Studio 10 with the Sun C and C++ > compilers. > # cc-V > Sun C 5.7 2005/01/07 > # CC -V > CC: Sun C++ 5.7 2005/01/07 > > LDFLAGS=-L/opt/sfw/lib -L/usr/sfw/lib -L/usr/lib > -R/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/opt/oracle/instantclient_10_2 > CPPFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl > -I/usr/local/BerkeleyDB/include -I/usr/include > -I/opt/oracle/instantclient_10_2/sdk/include > CFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl > -I/usr/local/BerkeleyDB/include -I/usr/include > -I/opt/oracle/instantclient_10_2/sdk/include > > And to your "rant" about the code developers make - I totally agree > with you. > As the administrator of a server with close to 600 users who all put > their > own applications in their own accounts up, then ask me why it "doesn't > work", > I get annoyed at such things too. > > regards > Markus > > > > On Thursday 30 November 2006 19:04, Richard Lynch wrote: >> On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: >> > I have a strange problem including files in PHP 5.2.0 running on >> Unix. >> > If I >> > try to include a file using include 'filename.inc';, everything is >> > fine. As >> > soon as I try to put a "." in front of the file name, for example >> > include './filename.inc';, I get a "failed to open stream: No such >> > file or >> > directory" error. Does anyone have any suggestions as to what is >> > going >> > wrong?` This all works with php 4.4.4 built with the same >> environment >> > and >> > compiler on the same system. >> >> What is your include path in PHP 5.2.0? >> >> I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 >> include_path has "." as one element within the list and that the PHP >> 5.2.0 include_path does NOT have "." within the list. >> >> I.e.: >> 4.4.4 include_path ".:include_test_dir" >> 5.2.0 include_path "include_test_dir" >> >> In the first case, 4.4.4, you've got . in there, so . combined with >> ./ >> will "find" the file you want. >> >> In the second case, 5.2.0, you've got no . in there, so ./ is >> looking >> in a directory, not the directory you expect, and it ain't finding >> the >> file because it's not there. >> >> Rant #24, not directed at Markus, but the world at large :-) >> PHP developers should understand and use include_path instead of >> hacking up their source with hard-coded paths and weird >> sub-directory >> / parent-directory hacks in include/require statements. >> >> It drives me nuts when I install nice software packages, but I can't >> put their components where I want them. >> >> End result: >> rm -rf [insert your nifty project directory name here] >> >> -- >> 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 > > -- 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] mssql conflict with sybase...
On Fri, December 1, 2006 2:28 am, Le Phuoc Canh wrote: > I use php version 4.4.2. When i use mssql and sybase extention, they > are > conflict together. I don't know how to using them together. It might be easiest to dump mssql and use sybase exclusively. Last I heard, Microsoft hasn't actually changed the low-level drives since they acquired Sybase code-base ages ago, and the sybase drivers go direct to that, while the mssql drivers, I THINK, are slower. [the rest of this email is pure speculation, based on heresay only] I SUSPECT that's because mssql drivers have followed the Microsoft codebase which has, over the years, wrapped the Jet API around the sybase, and then the OLE API around that and then some other layer I forgot around that, and... The net result being that you are comparing function call stacks: MSSQL SYBASE mssql_xyz sybase_xyz | | v . oledb_xyz. | . v . jet_xyz . | . v . iforgot_xyz . | . v . odbc_xyz . | . v v xyz() xyz() Multiply that by every db function call, across the entire application, and the minor performance hit of another function call on the stack adds up -- Especially if the queries/data being passed around get large... -- 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] EZ array problem - What's wrong with my brain?
There is no $var[0]; It's $var['1.2]; There is no $var[0][0]; It's $var['1.2']['code']; The remainder of this email composition is left as an exercise for the reader. On Fri, December 1, 2006 8:46 am, Brian Dunning wrote: > That seems right to me too - but everything I try returns NULL. I set > $try=$var[0], and $try ends up being null; print_r($try) gives blank. > I even tried $try=$var[1] and it was the same result. Am I in the > Twilight Zone? > > > On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Well, I've only just fallen out of bed, but I'd say you'd be able to >> access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change >> 111 >> to something else and $var["1.2"]["status"][0] to set/change "new". >> >> Brian Dunning wrote: >>> var_dump() gives me this: >>> >>> array(1) { >>> ["1.2"]=> >>> array(2) { >>> ["code"]=> >>> array(1) { >>> [0]=> >>> string(3) "111" >>> } >>> ["status"]=> >>> array(1) { >>> [0]=> >>> string(3) "new" >>> } >>> } >>> } >>> >>> I'm trying to set a variable to that "1.2". Shouldn't I be able to >>> get >>> it with $var = $arr[0][0]? >>> >>> --PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.5 (MingW32) >> >> iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub >> pKYeQqK4FcNhmTdEIm41kic= >> =PSbi >> -END PGP SIGNATURE- > > -- > 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 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] Preg_match - Find URL and convert to lower case
On Thu, November 30, 2006 5:04 pm, Kevin Murphy wrote: > Well the problem would be then that the entire string would be lower > case, and I only can have the link as lower case. Is there a way to > apply strtolower into the preg_match? Why not use lower(link) in SQL to get the link out in the first place? Also, the domain part cannot be case-sensitive, so you needn't worry about that part. For the 10% that don't work, a quick check with common variants on capitalization might help to fix those up. -- 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] EZ array problem - What's wrong with my brain?
On Fri, December 1, 2006 9:28 am, Ray Hauge wrote: > I forgot to mention that you won't be able to use "0", "1", etc. as > PHP > will convert those to integers. If you do use them, then they will > replace [0] with whatever you put in there, and if you are using the > references, it will replace both instances with your new ["0"] You can type-cast to (string) to force a string key. $foo[(string) '1'] = 'foo'; should, I think, have a string key... At least I know for sure that it works for float keys... You'll have to try it and see for '1' -- I could be way off base. -- 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] Acceptably Converting a 24bit PNG to a JPEG?
Is there some trick to getting PHP GD to properly convert a 24bit PNG [with alpha] into a JPEG without garbling the image output? The below will output the jpg image, but it appears that the alpha channel from the original png is garbling the jpeg a bit To no avail, I tried setting imageAlphaBlending and imageSaveAlpha to 'false' and 'true' I also tried setting the jpeg quality to 90 and 100. $image_output = "myimage.jpeg"; $image = imagecreatefrompng($original_24bit_png_image); imageAlphaBlending($image, true); imageSaveAlpha($image, true); header("Content-type: image/jpeg"); imagejpeg($image,'',100); imagedestroy($image); many thanks in advance g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tidy HTML source?
On Thu, November 30, 2006 6:47 pm, Paul Novitski wrote: > A templating system requires the processor to merge content with > template. An inline markup assembly system requires the processor to > build the markup from function calls. Where is the technique that > doesn't take machine cycles? You did NOT just compare a function call with an fstat and disk seek and disk read as if they were equal?!!! Show me *ANY* machine on the planet where those two options have similar performance metrics. >>You have to parse them. > > Not necessarily. But if you do need to parse them, you need to write > the parsing engine only once. You mean all those templating languages are still on version 1.0 of their parser? I think not. PHP at least has been fairly stable and BC in its development over the years, in regards to what matters to a decent code layout structure -- So PHP is *MY* templating language, thank you very much. >>Also you have to track and manage them. > > Yes, as you must manage all the files that make up a project. Adding > a few more isn't a burden, especially if they bring clarity and > efficiency to the work. Few? Try 10 X as many for most templating solutions. -- 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] magic_quotes
On Fri, December 1, 2006 2:32 pm, Johannes Lindenbaum wrote: > Here the "smart quoting" function off php.net > > |function quote_smart($value) > { >// Stripslashes >if (get_magic_quotes_gpc()) { >$value = stripslashes($value); >} >// Quote if not a number or a numeric string >if (!is_numeric($value)) { I personally would not test for is_numeric() to determine whether or not to call mysql_real_escape_string. I don't know UTF-8/UTF-16/Klingon well enough to know that it's going to Do The Right Thing. >$value = "'" . mysql_real_escape_string($value) . "'"; I also would not attempt to add the apostrophes at this layer of business logic, personally. Put them into the SQL string, rather than as part of the "data" being munged. >} >return $value; > } The easier and more clear way to do what you did: > From that Idea I implemented that into my MySQL class: > public function smartQuote( $string ) > { > if( get_magic_quotes_gpc() == 1 ) { > return stripslashes($string); > } //No matter what the data is/was, and no matter about GPC on or off //you still want to escape it for MySQL: > else { return mysql_real_escape_string($string); > } > } > > I was wondering if my above function is correct and the website's > documentation is off a little? The function you have is correct; The documentation is correct. Resolving those two inside your head is going to take a tiny bit more effort on your part, but you've obviously "got it" to about 99% now! Rock On! -- 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] Preg_match - Find URL and convert to lower case
On Dec 1, 2006, at 1:56 PM, Richard Lynch wrote: On Thu, November 30, 2006 5:04 pm, Kevin Murphy wrote: Well the problem would be then that the entire string would be lower case, and I only can have the link as lower case. Is there a way to apply strtolower into the preg_match? Why not use lower(link) in SQL to get the link out in the first place? Also, the domain part cannot be case-sensitive, so you needn't worry about that part. For the 10% that don't work, a quick check with common variants on capitalization might help to fix those up. Since these are mostly instructor's websites, that last 10% I figure it would be easier to just ask the instructors to change their site addresses. Since these are in the middle of the text, I don't think that lower will work. Doesn't it just do the same thing as strtolower? The query as is right now is (edited) "select note_text as note_text from classes" where note_text is many lines of text and in the middle of some are links and emails. What I ended up with, is this, which takes care of website addresses and emails as well (although those stay all-caps). The str_replace is there because some have the HTTP and some don't and I figured it was easier to just wipe them all out first. $section_notes = str_replace("HTTP://","",$section_notes); $section_notes = preg_replace('/WWW.(.*?) /e', '"www." . strtolower("$1") . "\" target=\"_blank\">http://www."; . strtolower("$1") . ""', $section_notes); $section_notes = eregi_replace("(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*) ([[:alnum:]-]))", "mailto:\\1\";>\\1",$section_notes); Anyone have a better idea on how to accomplish the same thing? -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] magic_quotes
Blah sorry, I saw your second example not your final code. Some scripts I use have different database connections and because of that it is very important to always make sure I am using the correct link identifier. The php best practice example checks the string to see if it is a number. If it is there technically isn't any reason to escape because there won't be any quotes. Just out of curiosity how exactly are you going to put the link identifier in your method since it is static? Hey Eric, The function standalone seems static, but it's implemented in a MySQL class I wrote. I can just add $this->connId as the link identifier And it should work no problem :) Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] signal handling
Hello Despite all of my results to succeed, i can not make this work. What i want to do is to write a simple socket server in PHP. My current example just prints the same character, you send to server from keyboard. It is successfull in forking, and generates child as people connect. However in any way the client exits, the child process remains defunct on system. I am trying to use signal handling, but some comments say through hanging sockets, it is not possible to handle signals. How can i stop this from happening, i am attaching the code i am working on, the 2 signals added at the bottom are just for test there, i tried all other signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process when the client exits does not kill it too, it still is defunct. My code: http://pastey.net/2910 Thanks! Aras -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tidy HTML source?
At 12/1/2006 02:22 PM, Richard Lynch wrote: On Thu, November 30, 2006 6:47 pm, Paul Novitski wrote: > A templating system requires the processor to merge content with > template. An inline markup assembly system requires the processor to > build the markup from function calls. Where is the technique that > doesn't take machine cycles? You did NOT just compare a function call with an fstat and disk seek and disk read as if they were equal?!!! Show me *ANY* machine on the planet where those two options have similar performance metrics. Actually I was referring to machine cycles, not disk access time. But on the topic of disc access, most mid-to-large PHP applications are going to be opening & reading various files -- PHP includes, databases, and not uncommonly images and text files. Even if a templating application had a somewhat higher different disk-access profile from the average PHP app, I wouldn't consider that by itself to be a reason not to open template files. I consider that to be good use of the resources, not abuse. >>You have to parse them. > > Not necessarily. But if you do need to parse them, you need to write > the parsing engine only once. You mean all those templating languages are still on version 1.0 of their parser? I think not. I think not, either. The person I was replying to said, "You have to parse them," as though parsing a lot of files meant a lot of human labor. My reply meant that once you write the parser, your work is done, and then the parser parses any and all files you give it for lunch. Of course you're going to improve a parser over time, just as you are going to improve all aspects of a maturing application. >>Also you have to track and manage them. > > Yes, as you must manage all the files that make up a project. Adding > a few more isn't a burden, especially if they bring clarity and > efficiency to the work. Few? Try 10 X as many for most templating solutions. Ten times as many templates as there are pages on the site? Wow, that's a lot. Fortunately I don't use any of those templating solutions you're referring to, and excessive templates isn't a problem for me. My own software usually takes three templates per page -- header, body, and footer, and the header and footer are generally global throughout the site. That seems quite reasonable to me. Warm regards, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tidy HTML source?
On Fri, 2006-12-01 at 17:51 -0800, Paul Novitski wrote: > > At 12/1/2006 02:22 PM, Richard Lynch wrote: > > > > Try 10 X as many for most templating solutions. > > Ten times as many templates as there are pages on the site? Wow, > that's a lot. Fortunately I don't use any of those templating > solutions you're referring to, and excessive templates isn't a > problem for me. My own software usually takes three templates per > page -- header, body, and footer, and the header and footer are > generally global throughout the site. That seems quite reasonable to me. This topic comes up so often... My template engine allows you to punt any chunk of content you want to an extra template. Then when you compile the page you get 1, yes, 1 php page that is directly accessed from the browser. Thus, contrary to the kinds of template engines to which Richard refers, my engine reduces the fstat call count while keeping your content in nice maintainable and re-usable sized chunks. layout.template --- layout/content.template --- contactUs.source Blah blah blah blah blah blah... please contact us. patterns.txt array ( 'target' => 'contactUs.php', 'source' => '//contactUs.source', 'template' => '//layout.template', 'title'=> 'Contact Us', ); contactUs.php - Everything defined in patterns.txt compiled together such that the tag is replaced by the source file. All and tags are imported during compile time to produce a single php file that IS the file accessed by visitors via their browser. If there's no need to have dynamic code, this does a great job of compiling static HTML files also... and I don't know many other template systems that can compile their templates to statically accessible HTML files. NYAH, NYAH! That said, in general my framework uses one source file for each class (or two classes if it's a factory and what the factory produces)... so I guess I save on content includes, and lose out on dynamic class includes. But then, other than 5 or 6 core classes, if you don't use the other classes, then they don't get loaded (on demand requests). Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems with exec() SOLVED
Thanks for the help. :) I posted to the freeBSD list and was given the answer there. in case anyone is interested and for the sake of the archive, I needed a path specified in the shell script. The following URL provides the necessary info for fixing the script. http://linux.dbw.org/shellscript_howto.html again thanks. Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php