php-general Digest 19 Jan 2003 15:28:36 -0000 Issue 1832 Topics (messages 132158 through 132180):
Re: 2 Qs: Passing current URL with session and how to avoid session timeout??? 132158 by: -<[ Rene Brehmer ]>- 132159 by: -<[ Rene Brehmer ]>- 132160 by: Justin French Re: Can I use php to load a icon?????(.ico .exe .....) 132161 by: hei Re: SQL+php 132162 by: John W. Holmes 132163 by: John W. Holmes 132165 by: Sean Malloy 132172 by: Thomas Seifert 132173 by: Sean Burlington 132178 by: Chris Hewitt Re: Free PHP Hosts? 132164 by: JJ Harrison CVS In PHP 132166 by: Trilochan 132171 by: JJ Harrison File Upload 132167 by: Trilochan 132169 by: John W. Holmes whois script or class 132168 by: Ashley M. Kirchner 132170 by: Jason k Larson How know how many sessions are active? 132174 by: Jeremías Grunge 132176 by: Justin French Re: PHP Encoders and GPL License 132175 by: Zeev Suraski 132177 by: Larry Brown 132179 by: michael kimsal Re: Changing order of just one array item? 132180 by: Leif K-Brooks Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---Hi Cal Evans, On Sat, 18 Jan 2003 10:17:01 -0600, you wrote about "RE: [PHP] 2 Qs: Passing current URL with session and how to avoid session timeout???" something that looked like this: >I guess I'm dense this morning. In response to 1: > >$_SESSION['mother']=$_SERVER['PHP_SELF']; Didn't know the server array existed ... where I'd find that in the manual??? Only doc I've got to run from... >and then > ><a href="<?PHP echo $_SESSION['mother'];?>">Go Back</a> > >or better yet... ><a href="<?PHP echo $_SERVER['PHP_SELF'];?>">Go Back</a> Wouldn't that produce a link to the current url, rather than the previous? >as to #2: >I usually just pass this kind of info around on the URL. > >http://mypage.com/mypage.php?prevURL=http://mypage.com/lastpage.php > >if I have to pass a full query string then I urlencode() it first and >urldecode() it on the other side. I can't do that reliably, my URLs are simply too long on some occasions ... so the URL ends up getting the end cut off... But apparently the sessions expiring isn't an issue afterall ... have had the page loaded for several hours, and the recursive linkage still works ... Will have to upload to my webhost though before I can be absolutely certain ... Retaining matching settings in my test-enviro is not entirely possible because their Apache is older than mine...and they run with globals on, and I design for them off, just to be safe... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net--- End Message ---
--- Begin Message ---Hi Justin French, On Sun, 19 Jan 2003 12:01:45 +1100, you wrote about "Re: [PHP] 2 Qs: Passing current URL with session and how to avoid session timeout???" something that looked like this: >1. If you require the back button to work forever, then do not use sessions, >because they're not designed to be a forever thing. I only need the session to pass the url on to the next page ... once there the old URL will be written into the HTML code... The only reasons I need to do it with sessions is because my urls are too long for the encoded url to be transfered reliably within the url... >2. I do this sort of stuff by building my own URL from $_SERVER components: I haven't found the server array in the manual (yet anyway), so I'm not sure what exactly it is you're doing ... so a bit of 'splaining would be nice ... I'm only on my 4th month of PHP'ing afterall ... ><? >$script = $_SERVER['PHP_SELF']; >$qs = $_SERVER['QUERY_STRING']; >$currentURL = base64_encode($script."?".$qs); >?> > >The reason why I base64_encode() it is so that the vars=values of the >previous page don't affect the next page. I don't have that problem. Variables aren't reausable because I'm doing divide and conquer design ... that way I can prevent the code from being too complex and requiring to many variables to work. Thus my variables differ from master page to master page, all the common ones are rewritten on each page load (as it only controls the menu links to be linked correctly up/down folder levels). >I the link to the second page might be something like: > ><a href="page.php?ref=<?=$currentURL?>">click</a> > >on page.php, to establish a back button: > ><? $ref = base64_decode($ref) ?> ><a href="<?=$ref?>">go back</a> > >3. This way, the referring/mother URL is always attached to that URL... if >they bookmark it, of give it to a friend, it's always there... sessions >don't achieve this, and cookies usually can, apart from the usual cookie >problems. Apparently the trans_sid being on (or 1 as it is) makes the sid transfer correctly everytime, atleast with my current setup ... which is this: On mother: $_SESSION['mother'] = "girlz.php?locat=$loc&list=$list&year=$year"; On child: if ($name != "") { $backlink = "<div align=\"center\"><a href=\"".$_SESSION['mother']."\" class=\"bldlink\" title=\"Get back to where you came from\">Back to where you came from</a></div><br />"; echo($backlink); } And before you ask, the reason the backlink is in a variable is because it's reused a couple times down the page. The above is, of course, only part of the code. It checks for alot more stuff in the child file. Still have to work out how to ensure that the backlink will produce a workable return link even when the page is launched without a call from a mother page... But that'll have to wait until morning ... it's 4.45 AM here now ;-) ... gotta get some snooze... Rene -- Rene Brehmer This message was written on 100% recycled spam. Come see! My brand new site is now online! http://www.metalbunny.net--- End Message ---
--- Begin Message ---on 19/01/03 2:45 PM, -<[ Rene Brehmer ]>- ([EMAIL PROTECTED]) wrote: > I haven't found the server array in the manual (yet anyway), so I'm not > sure what exactly it is you're doing ... so a bit of 'splaining would be > nice ... I'm only on my 4th month of PHP'ing afterall ... http://www.php.net/manual/en/language.variables.predefined.php Justin--- End Message ---
--- Begin Message ---I mean how can I edit icon???--- End Message ---
--- Begin Message ---> .....it's an log for a VoIp network, evrey voip has an ip and i whant > that instad of the VoIp's IP to put his name, instad of "1.1.1.1:xxx" must > be "jhon doe form yyy city", it's easier to read for the people who that > follow the logs. .. that's it ... So where do you get the name from. You're still not being descriptive enough. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/--- End Message ---
--- Begin Message ---> I see a lot of these type of answers on the list at the moment. > > I'm sick of receiving smart ass answers from people. It wastes my time, > and > my bandwidth. > > Either answer the fucking question, even if it hasn't been asked > correctly, > or don't reply at all. > > Given you are a 'PHP Professional' John, I would expect a little more from > you. It's _for_ PHP Professionals. If I read a Woman's magazine, does that make me a woman? Anyhow, answers like this are a good way for people to learn not to ask Yes or No questions. There's even a funny FAQ on this, but I can't find the link anywhere. ---John Holmes... > > -----Original Message----- > From: John W. Holmes [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 19 January 2003 11:42 AM > To: 'Paul Marinas' > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] SQL+php > > > > Dose anyone know how to search and replace a string in a > > mysql_query output. > > Yes. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > -- > 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--- End Message ---
--- Begin Message ---I apologise for calling you a PHP Professional, clearly I was mistaken. ;) -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, 19 January 2003 4:36 PM To: 'Sean Malloy'; [EMAIL PROTECTED] Subject: RE: [PHP] SQL+php It's _for_ PHP Professionals. If I read a Woman's magazine, does that make me a woman? Anyhow, answers like this are a good way for people to learn not to ask Yes or No questions. There's even a funny FAQ on this, but I can't find the link anywhere. ---John Holmes...--- End Message ---
--- Begin Message ---it doesn't change it in the database, just in the output. Thomas On Sun, 19 Jan 2003 03:17:04 +0200 (EET) [EMAIL PROTECTED] (Paul Marinas) wrote: > something like that only i don't whant to alter the database, the fields > in the database must remains unchanged, only, on page i whant to display > diferent data. > > On Sun, 19 Jan 2003, Sean Malloy wrote: > > > If you want to do it within the query itself, take a look at the mysql > > replace command > > > > REPLACE(str,from_str,to_str) > > > > SELECT REPLACE(<field>,<from>,<to>) FROM table > > > > or you can do it using PHP once the query has executed, on a record by > > record basis, within a while/for loop or whatever. > > > > -----Original Message----- > > From: Paul Marinas [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, 19 January 2003 11:07 AM > > Cc: [EMAIL PROTECTED] > > Subject: [PHP] SQL+php > > > > > > Dose anyone know how to search and replace a string in a > > mysql_query output. > > > > Thanks, Paul > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de--- End Message ---
--- Begin Message ---Sean Malloy wrote:I thought Johns response was humorous and to the point ...I see a lot of these type of answers on the list at the moment. I'm sick of receiving smart ass answers from people. It wastes my time, and my bandwidth. Either answer the fucking question, even if it hasn't been asked correctly, or don't reply at all. Given you are a 'PHP Professional' John, I would expect a little more from you.
John has shown a tremendous willingness to help people on this list - and I can undertsand him getting frustrated by the number of unclear questions...
I sometimes read this list and see if there is anything I can give back to the community ...
..but often give up trying to find questions I can answer in amongst the cryptic posts some people seem to think are a way of asking for help.
I think the bandwidth wasters are those who ask questions poorly (it takes several follow up mails to find out what the question was) and those who don't have a qucik look at the archives first (is someone puuting together an FAQ ?)
--
Sean
--- End Message ---
--- Begin Message ---John W. Holmes wrote:I'd probably put the ip address to name mapping in a separate table. If we call that table "nameip" and it has fields "name" and "ip", and if your other table is "othertable" with a "ip" field then you can begin your sql statement with something like:.....it's an log for a VoIp network, evrey voip has an ip and i whant that instad of the VoIp's IP to put his name, instad of "1.1.1.1:xxx"mustbe "jhon doe form yyy city", it's easier to read for the people whoSo where do you get the name from. You're still not being descriptive enough.
select nip.name
from nameip nip, othertable ot
where nip.ip = ot.ip
and ot.ip = whatever you need to get the right record.
The above is untested and you may need to modify it to suit your database's syntax (you do not tell us which), but it should give you the general idea.
Sean, the difficulty is that you were not explaining what you wanted clearly enough, not giving us enough information. It took several posts to do that. John's simple answer "yes" was a humourous hint to that. All we knew is the few lines of your original post, we don't know if you are ace programmer and database wizard or newbie. You know what you want to achieve and the backgroud to it, we do not. You know your response was out of line. I think a simple apology would be appreciated. John is a mainstay of this list and deals with many requests for help per day. Its a high volume list, please stay on it yourself and find out. See if you can help others.
Its also php-general so should really be for requests that do not fall into other catagories such as php-db, php-install or mysql, its not a database list. I feel that many people post to this list, even with off-topic questions, because they know they will receive help. Why? Simply because there are people such as John who wade through hundreds of posts every day, putting themselves out, and doing their best.
Regards
Chris
--- End Message ---
--- Begin Message ---I did do that, and have yet to turn up a useful result. That is why I asked. "David T-G" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...--- End Message ---
--- Begin Message ---Hello Every body , I have written some programs in c , I want to run those programs in my PHP script. Is there any way to do that . Any suggestion is highly appreciated. Regards Trilochan--- End Message ---
--- Begin Message ---Either use exec() to run a command line script. Or investigate creating a php module or something. -- --- JJ Harrison [EMAIL PROTECTED] "Trilochan" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello > Every body , I have written some programs in c , I want to run those > programs in my PHP script. Is there any way to do that . > > Any suggestion is highly appreciated. > > > Regards > Trilochan > >--- End Message ---
--- Begin Message ---Hello Every body , I want to make a provision for the suer , by which , they can select number of files from a list box and upload them to the server in PHP. Any suggestion is highly appreciated. Regards Trilochan--- End Message ---
--- Begin Message ---> Every body , I want to make a provision for the suer , by which , they can > select number of files from a list box and upload them to the server in > PHP. They have to select each file individually. Each file must be uploaded through it's own <input type="file"> input element. The details of how to do these things are in the manual, the chapter titled Handling File Uploads. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/--- End Message ---
--- Begin Message ---
I'm looking for a script, or class, that I can feed a domain name to and get back whois information, preferably already parsed into things like, the registrar, the registrant, ns servers, created/expire dates... Regardless of who the registrar is. Anyone?
--
M | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
--- End Message ---
smime.p7s
Description: S/MIME Cryptographic Signature
--- Begin Message ---http://phpwhois.org/ Ashley M. Kirchner wrote:
I'm looking for a script, or class, that I can feed a domain name to and get back whois information, preferably already parsed into things like, the registrar, the registrant, ns servers, created/expire dates... Regardless of who the registrar is. Anyone?
--- End Message ---
--- Begin Message ---Sorry I'm novice. There is a way to know how many sessions are active and to get variables or the id of them? Thanks--- End Message ---
--- Begin Message ---If you're on a dedicated server (no other sites on the server), you could just count the session files in /tmp. Otherwise, the general consensus seems to be that you need to decide how long a user is "active" for (say a minute, or 3, or an hour?), and save (eg) the SID and timestamp in a file or MySQL table. In theory, you then count the number of sessions that were created or reactivated (restamped) within your definition of "active" time (eg 3 mins). This has been discussed waaay too many time on the list... do a search on the archives for 'active users', perhaps also try a search with the word "ASP" too :) Justin on 19/01/03 10:27 PM, Jeremías Grunge ([EMAIL PROTECTED]) wrote: > Sorry I'm novice. > > There is a way to know how many sessions are active and to get variables or > the id of them? > > Thanks > >--- End Message ---
--- Begin Message ---At 02:45 18/01/2003, [-^-!-%- wrote:You're wrong for two reasons:Food for thought: As I look through the Zend website, and applaud their efforts to create 'protected' php applications, I can't help but wonder about the impact (or lagality) or their efforts. Doesn't the use of the Zend Encoder (or any other PHP Encoders out there) violate the GPL License or the whole Open Source Concept? As far as I understand it, the GPL License states that the source code of any product created from an open source solutions, or is derived from the work of an open solutions, must be made availabe to all users. Since PHP itself is open source, then wouldn't that prohibit a developer from encoding any PHP product? Please correct me, if I'm wrong. I'm just curious.
[1] As other people mentioned here, PHP (or in that case, the Zend Engine, PHP's core) is not under the GPL license. Since it is under a BSD style license, people are free to use it for commercial ventures in any and all levels.
[2] Even if the Zend Engine was under the GPL, the authors of the software always have the right to use their software in whatever way they see fit, and relicense it under any other licenses. In this case, the author of the Zend Engine is the same as one that publishes the Zend Encoder, so there's really no problem at all.
Zeev
--- End Message ---
--- Begin Message ---I just want to clarify this for myself. My impression was that the affects of GPL requiring software developed from the original GPL to also be free was only applicable to modifications of the program itself. So if php was GPL and I modified the source and built my own customized version of php I couldn't sell it but could only give it away, but if I used php to develop some other software that runs on php I could sell it without a problem. Similar to creating software that runs on Linux, the software can be sold but if I modify Linux itself and turn around and sell it, it would be against the license. Is this accurate? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -----Original Message----- From: Zeev Suraski [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 19, 2003 6:40 AM To: [-^-!-%- Cc: PHP general list Subject: Re: [PHP] PHP Encoders and GPL License At 02:45 18/01/2003, [-^-!-%- wrote: >Food for thought: > >As I look through the Zend website, and applaud their efforts to create >'protected' php applications, I can't help but wonder about the impact >(or lagality) or their efforts. Doesn't the use of the Zend Encoder (or >any other PHP Encoders out there) violate the GPL License or the whole Open >Source Concept? > >As far as I understand it, the GPL License states that the source code >of any product created from an open source solutions, or is derived from >the work of an open solutions, must be made availabe to all users. > >Since PHP itself is open source, then wouldn't that prohibit a developer >from encoding any PHP product? > >Please correct me, if I'm wrong. I'm just curious. You're wrong for two reasons: [1] As other people mentioned here, PHP (or in that case, the Zend Engine, PHP's core) is not under the GPL license. Since it is under a BSD style license, people are free to use it for commercial ventures in any and all levels. [2] Even if the Zend Engine was under the GPL, the authors of the software always have the right to use their software in whatever way they see fit, and relicense it under any other licenses. In this case, the author of the Zend Engine is the same as one that publishes the Zend Encoder, so there's really no problem at all. Zeev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---Larry Brown wrote:I just want to clarify this for myself. My impression was that the affects of GPL requiring software developed from the original GPL to also be free was only applicable to modifications of the program itself.The GPL is a ridiculously outdated and vague license which has rarely been tested in any courts (if ever) and therefore there's no clearly established caselaw to base decision on. 'outdated'? 'vague'? GPL speaks of 'linking'. How is this to be defined? The GPL has language (linking, binary, compiler, kernel, etc) which is not something which even enters into the consideration of most developers who use scripting langauges (perl, php, python, etc). The GPL was written almost exclusively with C and similar languages in mind, although it's not explicitly stated anywhere. "derivative works" is not clearly defined. If I distribute a PHP script, is calling a 'wordwrap' function somehow 'linking' to the original PHP code? My program's functionality certainly depends on the wordwrap code functioning properly. Is it a 'work based on the Program'? The definition states that 'a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language.' Whose copyright law? The original developer's? The 2nd generation developer's? Translated into another language is damn vague, imo. If I take the original wordwrap function code - in C - and translate that to Python, have I translated it to another language? I realize that the PHP code isn't GPL - I'm not speaking specifically to PHP, but to the GPL 'definition' of things. It's a shame so many people just write stuff and put it out under GPL without coming close to understanding the implications of the license, or the ambiguities. At some point, there will be larger legal cases which will invalidate some of the principles which developers though the GPL meant, but didn't really understand.So if php was
GPL and I modified the source and built my own customized version of php I
couldn't sell it but could only give it away,You can sell GPL software. Often there's not much point because you have to grant the right of redistribution to others, so the first person you sold it to would be able to redistribute the source code (because they're entitled to recieve the original source code), thereby being able to undermine your sales efforts. In practice, many people probably wouldn't bother redistributing something, but it would only take one person to do so to have the impact. Also, just because something is GPL doesn't require the original developers to give it away to everyone by setting up FTP servers and all that other stuff. All you're required to do is provide to source to someone who requests it, and you only have to do that if they got it from you. Example: I have a large system which I GPL. I distribute a binary to customers who purchase it. My only obligation is to provide source code to the customer upon request. At that point, THEY can recreate a binary from my source and sell that, but they would also then have to fulfill requests for the source (which they may not want to do). *I* do not have to fulfill requests for the source to anyone except those to whom I distribute/sell a binary version. That's really it. but if I used php to developsome other software that runs on php I could sell it without a problem.
Similar to creating software that runs on Linux, the software can be sold
but if I modify Linux itself and turn around and sell it, it would be
against the license.Again, no, you can sell it, but you're obligated to provide the source to any purchser who requests it, and you can't then stop them from redistributing it. Any Linux kernel changes you made then 'sold' would either not sell at all, or would sell a couple copies then get rolled back in to the main tree of some distribution. Michael Kimsal PHP Training http://www.tapinternet.com/php 734-480-9961--- End Message ---
--- Begin Message --- Thanks, but that's not what I'm trying to do. I know how to change the keys, but I'm looking to change the internal order of the key/value pairs.
Timothy Hitchens (HiTCHO) wrote:
This would do it:
<?php
$first[] = 'hello';
$first[] = 'bye';
function swap(&$list, $first, $second)
{
$tempOne = $list[$first];
$list[$first] = $list[$second];
$list[$second] = $tempOne;
}
swap($first, 0, 1);
print_r($first);
?>
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: [EMAIL PROTECTED]
-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Sunday, 19 January 2003 12:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Changing order of just one array item?
I need to change where one item is ordered in an array. I know how to sory an array, but I need to move one item up/down in the array. Example: $array is: 0 => "element one" 1 => "element two" 2 => "element three" 3 => "element four" I call array_order_up($array[1]) and $array is now: 0 => "element one" 2 => "element three" 1 => "element two" 3 => "element four"
If there aren't any native functions to do this, can anyone think of a way to make my own function to do this?
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.--- End Message ---