Re: [PHP] Calling functions from Button actions
Example: action.php: function action1() { echo "Hello, I'm action1"; } function action2() { echo "Hello, I'm action2"; } if(isset($_GET['action1'])) { action1(); } if(isset($_GET['action2'])) { action2(); } Dan J. Rychlik wrote: Is their an easy way to call a function based upon a button action? -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problems and segmentation fault with constants in PHP5
I reported this BUG at php.bugs as http://bugs.php.net/?id=25323. It's there for 13 days now and still no answer... :-( Cristiano Duarte "Cristiano Duarte" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > Is this suppose to work ? Currently it does not. > > class Priority { > const DEBUG = 0; > const INFO = 1; > const WARN = 2; > const ERROR = 3; > const FATAL = 4; > > const MAX_PRIORITY = FATAL; > } > > class ExtendedPriority extends Priority { > const REMOTE = Priority::MAX_PRIORITY + 1; > const URGENT = Priority::MAX_PRIORITY + 2; > } > > if it's not supposed to work, there is also some parser problem in ZE2 that > accepts a constant expression based on string concatenation(This code causes > segmentation fault): > > class test { > const TEST = "hi"; > const TEST1 = self::TEST . "ih"; > } > > Cristiano Duarte -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Whats wrong?
Whats wrong with this where $senderemail = $_POST['from']; It doesnt It only echos thank you. Why?
Re: [PHP] Whats wrong?
Hey, Just touched it up a bit but its working: This should come before: $senderemail = $_POST['from']; not after this: print "Thank You, $senderemail"; plus I'm guessing that either your form is sending $senderemail or that you are getting via a $_GET you have to post $from not $senderemail. If you change the above to a $_GET this will work YourFileName.php?from=Ryan Cheers, -Ryan We will slaughter you all! - The Iraqi (Dis)information ministers site http://MrSahaf.com - Original Message - From: "Stevie D Peele" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, September 13, 2003 2:45 PM Subject: [PHP] Whats wrong? > Whats wrong with this > > > > where > > $senderemail = $_POST['from']; > > It doesnt It only echos thank you. > > Why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats wrong?
Try this - Sid On Sat, 13 Sep 2003 08:45:16 -0400, Stevie D Peele wrote: > Whats wrong with this > > > > > > where > > > $senderemail = $_POST['from']; > > > It doesnt It only echos thank you. > > > Why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying Blobs by a newbie
Hi Warren, Thanks for your reply. I imported the blobs into mysql database. They were in jpeg format. Phil. "Warren Vail" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You didn't say how the images were placed in the db but you did indicate they were jpeg format. > > I'd try; > > fetching the db column in to a string variable; > > then; > > $im = imagecreatefromstring($imagestring); > header ("Content-type: image/jpeg"); > imagejpeg($im); > imagedestroy($im); > > good luck, > > Warren Vail > > -Original Message- > From: Phil King [mailto:[EMAIL PROTECTED] > Sent: Friday, September 12, 2003 11:54 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Displaying Blobs by a newbie > > > Hi All, > > I have some images in a mysql database. I wish to display all these images > on a PHP Page. > > I have created a query to retrieve all the images from the database but all > that is displayed is characters. > I have the Content-Type as image/jpeg in the header of the page to display > the images. > > Can anyone advise me or point me in the right direction to rectify this. > > Thanks very much. > > Phil. > > -- > 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] For Loops and Variables??
When I use for loops, at the start of each iteration, the variables hold the values from the last loop. First, is there an elegant way of clearing variables at the start of each loop rather than using unset???! It just seems wrong. Also, all my problems would be solved if variables in a for loop were kept local, but everything by default is a global. Can I change this in php.ini or something?? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying Blobs by a newbie
* Thus wrote Phil King ([EMAIL PROTECTED]): > Hi All, > > I have some images in a mysql database. I wish to display all these images > on a PHP Page. > > I have created a query to retrieve all the images from the database but all > that is displayed is characters. > I have the Content-Type as image/jpeg in the header of the page to display > the images. Basically you need two scripts: script1: generate html that has tags that point to script2. script2: read one image from the database and send that image with the appropriate content-type > > Can anyone advise me or point me in the right direction to rectify this. This has been discussed may times on the list, you can search the archives to find out more detailed discussions on this. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loops and Variables??
* Thus wrote John Ryan ([EMAIL PROTECTED]): > When I use for loops, at the start of each iteration, the variables hold the > values from the last loop. > > First, is there an elegant way of clearing variables at the start of each > loop rather than using unset???! It just seems wrong. I'm unclear as to what elegant implies. > > Also, all my problems would be solved if variables in a for loop were kept > local, but everything by default is a global. Can I change this in php.ini > or something?? no, there are only two scopes in php, it is either GLOBAL or local inside a function/class. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP on a .NET enviroment machine: Conflicts?
* Thus wrote Jay Paulson ([EMAIL PROTECTED]): > Quick question to the community here. The company I work for got bought out and now > they are wanting to migrate all the web sites that I have created in PHP to their > Windows, IIS, .NET enviroment. I have been trying to talk to the people at > corporate about putting PHP on their Windows machines but they are reluctant saying > the following: > > "An additional complication we discussed here is the fact that our servers are set > up as pure a .NET environment. While we could add PHP to it. It could create > conflicts that would effect the entire system. We have had this problem with Cold > Fusion in the past." hmm.. php != cold fusion > > My question is... has anyone put both PHP and .NET in a Windows enviroment at the > same time and had any conflicts? I have done it several times before and have not > run into any problems. I really want to continue to run some of the PHP things that > I have on the sites (i.e. message forums, chats etc) but I really need to know if > anyone has run into any conflicts. I havn't set up .NET so can't provide any input on that. Funny though how this question always comes up with the term 'Corporate' tied in with it :) Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calling functions from Button actions
$val) if (function_exists($key)) $key(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] loading classes and efficiency
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > > function &create_object() { > > [..] > > } > > > > $some_object =& create_object('some_object'); > > This line should be: $some_object = create_object('some_object'); The use of & at calltime is deprecated and should only be used in the declaration of the functions: function &func_name(&$ref_var) { } Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql Authentication problem
* Thus wrote James Hamilton ([EMAIL PROTECTED]): > > > [snip] > > > The user has both localhost and % host privileges in the mysql > > > permission > > > schema. > > > [/snip] > > > > > Any other thoughts? > > [/snip] > > > current testing code: > > $link = mysql_connect("localhost", "user", "pass" ) > or die("Could not connect : " . mysql_error()); > print "Connected successfully"; > mysql_select_db("name") or die("Could not select database"); > print "connected"; Increase your error_reporting and turn on display_errors, you will most likely be enlightened as to why you're unable to connect. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using Image/GD functions to transform images stored in database
I'm new to the GD/Image functions with PHP, and I'm trying to use them to manipulate jpeg images that I've stored in a MySQL database (specifically, creating thumbnails). The thing I can't tell from reading the documentation is how to use these image functions to operate on image data -- it looks like you get a GD image resource in each case by specifying a file name, not by passing image data directly. While I can see how that's convenient for the common case, I can't figure out how to make this work without writing the image out to a file (and since I'm already taking a bit of a performance hit by reading the image out a database, that seems like the wrong thing to do). Can anyone elaborate? Thanks, Weston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Repost - Cookie advice
Reposted, as it appears it didn't go thru. Hi, I have a "Remember me on this computer" check box, which sets a cookie for future logins. What's the consensus on when a cookie of this type should expire? I currently have it set for 30 days. Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] caching program...
* Thus wrote Andrea Tricco ([EMAIL PROTECTED]): > Hi, Hello > > I'm using the function "file_get_contents()" to replicate the content of a > remote html page on my server. > > But, the function file_get_contents() works even when the name of the file > is not specified. For example: > > "http://www.php.net"; rather that "http://php.net/index.php"; http://php.net/ - apache serves index.php http://php.net- apache redirects to http://php.net/ http://php.net/index.php - servers index.php All three of these will show the same content. > > Does a method exist to know the name of the file received form web server? Nope > > I would like to write a program that automatically downloads the images > inserted into a html page. The odds are if you right one, it wont be 100% compatible with all sites. What in essance you are doing is writing a web browser, and there are a lot of things that need to be taken care of to handle special cases. > > For this reason, I need to determine the paths of the images in order to get > them from the web server. For starters probably reading up on HTML and HTTP specifications might be a good place to start. ( http://w3c.org ) > > In other words, my program should work as the "Save as" function (File menu) > of any Web browser. There are alternative choices, there are programs out there like webget and wget that will automatically do what you want to do. You could use those programs with a system call. > > > > Can anybody help me? I hope I did already :) Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using Image/GD functions to transform images stored in database
On Sunday 14 September 2003 01:12, [EMAIL PROTECTED] wrote: > I'm new to the GD/Image functions with PHP, and I'm trying to use them > to manipulate jpeg images that I've stored in a MySQL database > (specifically, creating thumbnails). The thing I can't tell from reading > the documentation is how to use these image functions to operate on > image data -- it looks like you get a GD image resource in each case > by specifying a file name, not by passing image data directly. While I > can see how that's convenient for the common case, I can't figure out > how to make this work without writing the image out to a file (and since > I'm already taking a bit of a performance hit by reading the image out > a database, that seems like the wrong thing to do). Can anyone elaborate? imagecreatefromstring() -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The wise shepherd never trusts his flock to a smiling wolf. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] square brackets in form names violate HTML specs?
Something I've noticed in PHP is a proliferation of code like this: According to the specs, the square brackets in "stuff[title]" are technically illegal. http://www.w3.org/TR/html4/types.html#h-6.2 ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). Thoughts? Suggestions for writing flexible PHP code that at least passes the HTML 4.01 Transitional DTD? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR DB flipped fetch mode
* Thus wrote Dan Phiffer ([EMAIL PROTECTED]): > Could somebody explain (or point me to some online docs) the usage of > DB_FETCHMODE_FLIPPED, defined by PEAR DB? I feel like I've seen it mentioned > on the PEAR site, but somehow I can't find it now. > > I'm pretty sure it's on a page linked from here: > http://pear.php.net/manual/en/package.database.php I'm not sure. There is a pear mailing list, you might be able to get a quick answer over there. > > Also, why isn't Google spidering the PEAR docs? hmm.. a pear.php.net is in google. they may have a robots.txt file that dissallows spidering for the site. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header and dfile download bug???
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > Hi all, > I have a download for that collects data from a user (name, e-mail etc) > The $bu variable and others are from the previous form too. > [...] > > So, it works great on my desktop here at work, but I just got a few mails > from random users, who complained that they saw an error screen after > trying to download pdf's. Well did they supply any information like what the error was or what browser they were using? > Dunno if this is a PDF problem, or if my script is bad? > > So, here is my code... (that site at the very top of my page.) > The headers after the else statement are simply to avoid page caching, so > we can ignore them in this example. > So, why does this work for me and many others, but not all? I'm unable to answer that. Some knowlege of what exactly the error is might help. The headers shouldn't cause error. > > * > The information contained in this e-mail message is intended only for > the personal and confidential use of the recipient(s) named above. am I the intended person? the email wasn't addressed to me, so I feel like I'm breaking the policy... Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] square brackets in form names violate HTML specs?
* Thus wrote Eugene Lee ([EMAIL PROTECTED]): > Something I've noticed in PHP is a proliferation of code like this: > > > > According to the specs, the square brackets in "stuff[title]" are > technically illegal. > > http://www.w3.org/TR/html4/types.html#h-6.2 Yes, this is correct. The way to properly do it would be to set set your name as: Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for a real good editor with some specific featrues ...
* Thus wrote Daniel Szasz ([EMAIL PROTECTED]): > Hello > > I'm working in programming for many years and I'm looking now for an editor > for php good like the borland editor in Delphi/CBuilder.. > Also I will be glad to b something with the same shortcuts like there ( i'm > talking about classic shortcuts) since I'm working with that when wordstar > was the best editor. hmm.. when did vim not be the best editor. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htmlentities() and the macintosh character set
Hello- I have a request but don't know where to send it. Thus, it ends up here. Alternately, I'm looking for some solutions: The request: Can the macintosh character set be added as an option for htmlentities() and other commands? That would be so helpful for our mac-based company. The problem: I'm fairly new to php and have found that the macintosh character set is pretty different from other standard sets, so when someone in our company enters an em-dash (an extended dash, that would be represented as &emdash; in html) into our SQL database, browsers display it as Ñ (Ñ) because that's the correct mapping in other, standard sets. Of course, I could do a replace on that character, but there are another 6 characters that I know of that will cause problems, and probably more beyond that. The quick and good way is to convert with htmlentities(), but the mac charset is lacking. Any suggestions how to fix this? Thanks, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mozilla and german 'Umlaute'
Hi, i have a strange problem with Mozilla. When submitting a form, german umlaute (ä (ae), ü (ue) and others) become strange 16bit-chars like 'ä'. I've tested this with PHP as dynamic Apache-module and with an own webserver written in PHP. Doctype and other XML-specific things in the page with the form don't make any changes. Does anyone know this problem? Does someone have a solution for this? Thanks, Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session stealing, ..
Thanks all for your replies .. It's pretty much what I already thought, a really secure way of handling sessions there is not. Though most of the most interesting information came from Jason (Yes! I'd love to see your custom session handler .. if be it only for inspiration to the one I'm planning to write soon) and Mike .. this issue is one that bothers me also. I'm not on AOL but my IP also can change at any time. It's not common, usually I hold the same one untill I dial my cable provider again .. but how often does this IP change happen and does other ISP's also do things like that? Wouter -> -Oorspronkelijk bericht- -> Van: Jennifer Goodie [mailto:[EMAIL PROTECTED] -> Verzonden: zaterdag 13 september 2003 0:37 -> Aan: Wouter van Vliet; PHP General -> Onderwerp: RE: [PHP] Session stealing, .. -> -> -> > 93 # When deserialized we are called and need to -> check if the -> > stored IP address equals the client's -> > 94 function __wakeup() { -> > 95 global $Log; -> > 96 if ($_SERVER['REMOTE_ADDR'] != -> > $this->Night['IP']) { -> > 97 $Log->Warning('IP Address -> changed during -> > sleep and wakeup, will clear userdata'); -> > 98 $this->Data = Array(); -> > 99 }; -> > 100 } -> > -> > Upon sleep it stores the IP and time in the session data, and -> > when it smells -> > coffee my object wakes up, checks if he's still being used on the -> > same host -> > and if not the userdata is plainly cleared. -> > -> -> I hope none of your site visitors are on AOL as the IP can -> change between -> page requests for AOL users. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket_write eats data
Hi, I am deveoping a chatserver in IRC-style in PHP. For communication it uses socket-multiplexing aka socket_select. So long so good, works perfectly. The problem is, than when i make several socket_write's to the same client without waiting about 0.1sec after each write, the written data gets lost somewhere. socket_write does NOT throw any error, the data seams just sended, but the clients never receives it. Small example of the used code: - var $clients // array of 'client'-objects, each object has it's own socket-descriptor in the object-variable $socket function write_to_clients ($text) { for ($i = 0; $i < count ($this->clients); $i++) { socket_write ($this->clients[$i]->socket, $text); } // usleep (1); if this is uncommented, all write are received by all clients } for ($i = 0; $i < 10; $i++) { $this->write_to_clients ("test ".$i); } - Okay, this doesn't check the client-sockets for readiness to write, but even if I check (via socket_select), ALL clients are ready to write and writes get lost too. It can't be the network-connection, because the tests run with standalone PHP-clients on the same machine. Is there any possibility to make fast writes without waiting after each write? The wait limits the server to max. 10 writes per second, wich isn't really enaugh for a good chatserver. Thanks for your help! Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whats wrong?
or even: :P -> -Oorspronkelijk bericht- -> Van: Sid [mailto:[EMAIL PROTECTED] -> Verzonden: zondag 14 september 2003 3:43 -> Aan: Stevie D Peele; [EMAIL PROTECTED] -> Onderwerp: Re: [PHP] Whats wrong? -> -> -> Try this -> -> -> -> - Sid -> -> On Sat, 13 Sep 2003 08:45:16 -0400, Stevie D Peele wrote: -> > Whats wrong with this -> > -> > -> > -> > -> > -> > where -> > -> > -> > $senderemail = $_POST['from']; -> > -> > -> > It doesnt It only echos thank you. -> > -> > -> > Why? -> -> -- -> 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] socket_write eats data - solved
Hi, i've checked a hundred things before posting this question, but i forgot the most important thing, the buffer. The 'eaten' writes were buffered by the network-kernel and sent as bunch of data. If too much data for the buffer is sent, the write is broken up and completed in the next bunch-of-data. My receive-script hasn't diplayed the raw output, but an unserialized array, fetched out of the received string. Maybe this will will help someone in future. Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] - Original Message - From: "Thomas Weber" <[EMAIL PROTECTED]> To: "PHP-List" <[EMAIL PROTECTED]> Sent: Saturday, September 13, 2003 9:15 PM Subject: [PHP] socket_write eats data > Hi, > > I am deveoping a chatserver in IRC-style in PHP. For communication it uses > socket-multiplexing aka socket_select. So long so good, works perfectly. > The problem is, than when i make several socket_write's to the same client > without waiting about 0.1sec after each write, the written data gets lost > somewhere. socket_write does NOT throw any error, the data seams just > sended, but the clients never receives it. > > Small example of the used code: > - > var $clients // array of 'client'-objects, each object has it's own > socket-descriptor in the object-variable $socket > > function write_to_clients ($text) { > for ($i = 0; $i < count ($this->clients); $i++) { > socket_write ($this->clients[$i]->socket, $text); > } > // usleep (1); if this is uncommented, all write are received by all > clients > } > > for ($i = 0; $i < 10; $i++) { > $this->write_to_clients ("test ".$i); > } > - > > Okay, this doesn't check the client-sockets for readiness to write, but even > if I check (via socket_select), ALL clients are ready to write and writes > get lost too. It can't be the network-connection, because the tests run with > standalone PHP-clients on the same machine. > > Is there any possibility to make fast writes without waiting after each > write? The wait limits the server to max. 10 writes per second, wich isn't > really enaugh for a good chatserver. > > Thanks for your help! > > Thomas 'Neo' Weber > --- > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > -- > 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] loading classes and efficiency
On Sat, 2003-09-13 at 11:08, Curt Zirzow wrote: > * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): > > > function &create_object() { > > > [..] > > > } > > > > > > $some_object =& create_object('some_object'); > > > > > This line should be: > $some_object = create_object('some_object'); > > The use of & at calltime is deprecated and should only be used in > the declaration of the functions: > function &func_name(&$ref_var) { } Wouldn't =& still be legal because you are assigning a reference of what is returned? Would that make $some_object a reference to a reference? It doesn't seem to raise an exception. - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htmlentities() and the macintosh character set
On Sat, Sep 13, 2003 at 11:24:56AM -0700, Michael Winston wrote: : : The request: Can the macintosh character set be added as an option for : htmlentities() and other commands? That would be so helpful for our : mac-based company. : : The problem: I'm fairly new to php and have found that the macintosh : character set is pretty different from other standard sets, so when : someone in our company enters an em-dash (an extended dash, that would : be represented as &emdash; in html) into our SQL database, browsers : display it as Ñ (Ñ) because that's the correct mapping in other, : standard sets. Of course, I could do a replace on that character, but : there are another 6 characters that I know of that will cause problems, : and probably more beyond that. The quick and good way is to convert : with htmlentities(), but the mac charset is lacking. : : Any suggestions how to fix this? You could modify the HTML translation table and add Mac specific characters to the mix. I wonder if anyone has already done the work for the other entites. Anyways, if not, you can always build your own from Apple's list: http://developer.apple.com/documentation/mac/Text/Text-516.html#MARKER-9-3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] square brackets in form names violate HTML specs?
On Sat, Sep 13, 2003 at 06:15:29PM +, Curt Zirzow wrote: : * Thus wrote Eugene Lee ([EMAIL PROTECTED]): : > Something I've noticed in PHP is a proliferation of code like this: : > : > [...] : The way to properly do it would be to set set your name as: : : Great idea, thanks Curt! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mozilla and german 'Umlaute'
> Does anyone know this problem? Does someone have a solution for this? You are probably using UTF16 (or is it called UTF8?) encoding which allows many spiffier things then ASCII. There are functions to allow conversion between UTF and ASCII. I ran into this problem when a spanish client tried using spanish in a script sold in America. I refunded him his money because the solution was much too expensive. -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session stealing, ..
I would also be interested in seeing the code as well. If you could also e-mail it to me, I would be very appreciative. Ben -Original Message- From: Jason Sheets [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 4:56 PM To: Wouter van Vliet Cc: PHP General Subject: Re: [PHP] Session stealing, .. I wrote a custom session handler that encrypts the session before it is stored in /tmp that way even if someone has access to the session files they are useless. It stores the randomly generated encryption key on the user's client base64_encoded, which can be intercepted as well all know but it still increases the difficulty of reading the /session files now they must have access AND sniff the encryption key. Additionally for the more secure sites I require the user access the site through SSL so the cookie is not passed in plain text. If you are interested I'll see if I can send it to you, it uses my Crypt Class (PHP class simplifying Mcrypt usage). Jason Wouter van Vliet wrote: >Hi All, > >There's always been a lot of discussion about how safe sessions are. I'd >like to store a complete user object (instance of a class) in a session with >the best security measures possible. Who doesn't. > >Now, to prevent that the session file from the server gets stolen by some >other user of the virtual host I did this to my object: > > 87 # Called upon serialization of the object. It stored the IP >address and serialization time. > 88 function __sleep() { > 89 $this->Night = Array('Time' => time(), 'IP' => >$_SERVER['REMOTE_ADDR']); > 90 return Array('Data', 'Night'); > 91 } > 92 > 93 # When deserialized we are called and need to check if the >stored IP address equals the client's > 94 function __wakeup() { > 95 global $Log; > 96 if ($_SERVER['REMOTE_ADDR'] != $this->Night['IP']) { > 97 $Log->Warning('IP Address changed during >sleep and wakeup, will clear userdata'); > 98 $this->Data = Array(); > 99 }; >100 } > >Upon sleep it stores the IP and time in the session data, and when it smells >coffee my object wakes up, checks if he's still being used on the same host >and if not the userdata is plainly cleared. > >This all probably takes care about the problem with session id's in the >query string, which is known as referrer to the next website our visitor >visits. What I'm worrying and wondering about now are other users of the >server my site's at. They can most likely go into the /tmp folder and just >read my session files. Not Nice. I know it has been discussed for quite some >times now .. but never really found anything else than warnings for stuff, >no real solutions. > >So, get your idea's rolling and let the good things flow... > >Wouter > > > -- 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] MySql Query Help: COUNT()
Hello everyone! I'm trying to get the total number of a certain records from a database, but the result is always '1'. Please advise! =MySql Table = =activitiy = id | employee_id | project_id | date 1 | 45 | 60 | 2003-09-09 2 | 34 | 10 | 2003-09-10 3 | 45 | 45 | 2003-09-10 4 | 23 | 30 | 2003-04-11 Now, I'm trying to get the following info: - Total Number of employees in the datbase - Total number of projects -total number of projects per employee I currently have $_sql = "select count(*) as TotalRecords, count(employee_id) as TotalEmployees, count(project_id) as TotalProjects GROUP BY employee_id, project_id $_qry = mysql_query($_sql) or die('...blah...'); $_res = mysql_fetch_object($_qry); //output echo $_res->TotalRecords; //prints nothing echo $_res->TotalEmployees; // returns 1 echo $_res->TotalProjects; //also return 1 //end of code Any suggestions? Did I miss something? Please advise. Thanks in advance. _john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text into a url
Hi I am havening a problem retrieving url from a mysql database. I have the url's stored as text and am using the following code to retrieve them $query = "SELECT name,url FROM clubs WHERE url>'' ORDER BY name"; $result = @mysql_query($query) or die ("Query failed"); if (mysql_num_rows($result) == 0) { print "No Club Links Found."; } else { while ($row = mysql_fetch_assoc($result)) { print $row["name"] . ""; This seems to work except the url refers to the previous name on the list produced with the first name as a blank url. Can anybody help Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text into a url
Tom Wollaston wrote: Hi I am havening a problem retrieving url from a mysql database. I have the url's stored as text and am using the following code to retrieve them $query = "SELECT name,url FROM clubs WHERE url>'' ORDER BY name"; $result = @mysql_query($query) or die ("Query failed"); if (mysql_num_rows($result) == 0) { print "No Club Links Found."; } else { while ($row = mysql_fetch_assoc($result)) { print $row["name"] . ""; This seems to work except the url refers to the previous name on the list produced with the first name as a blank url. Can anybody help You have incorrect HTML. You're last line should look like this: print "{$row['name']}"; You were starting your link after you printed out the value, without ending the link, so it continued to the next item and only ended when the next link started on the next row. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More Image Transformation Difficulty
I'm trying to write a script that pulls an image from a database and transforms the size if passed a width via the url query string. Thanks to the helpful hint about the function "imagecreatefromstring", I think I'm now able to ready image data I've pulled for a database with GD. However, I'm still having trouble resizing... at least, when I'm sending the image to my browser, I'm being told that it "cannot be displayed, because it contains errors." (And the script does work if I don't try resizing... see below for example URL). Here's what I'm doing: $row = mysql_fetch_row($dbresult); $imgdata = $row[0]; if(isset($width) && !empty($width) && is_numeric($width)) /* only do transformation if given a width */ { $gdimg = imagecreatefromstring($imgdata); $srcWidth = imagesx($gdimg); $srcHeight = imagesy($gdimg); $scaleFactor = $width/$srcWidth; $targetHeight = $srcHeight * $scaleFactor; $resizedimg = imagecreatetruecolor($width,$targetHeight); imagecopyresized($resizedimg,$gdimg,0,0,0,0,$width,$targetHeight,$srcWidth,$srcHeight); } header("Content-Type: image/jpeg"); header("Content-Transfer-Encoding: binary\n"); //send file contents if(!empty($resizedimg)) imagejpg($resizedimg); else { header("Content-length: " . strlen($imgdata) . "\n"); print($imgdata); } Does anyone see what I'm doing wrong? Again, the script actually works if I don't try to do the transform. See: http://www.fsboutah.net/jpg.php?table=homes&key=4&field=Picture1 and http://www.fsboutah.net/jpg.php?table=homes&key=4&field=Picture1&width=100 for contrasts. -W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySql Query Help: COUNT()
I'm trying to get the total number of a certain records from a database, but the result is always '1'. Please advise! =MySql Table = =activitiy = id | employee_id | project_id | date 1 | 45 | 60 | 2003-09-09 2 | 34 | 10 | 2003-09-10 3 | 45 | 45 | 2003-09-10 4 | 23 | 30 | 2003-04-11 Now, I'm trying to get the following info: - Total Number of employees in the datbase - Total number of projects -total number of projects per employee I currently have $_sql = "select count(*) as TotalRecords, count(employee_id) as TotalEmployees, count(project_id) as TotalProjects GROUP BY employee_id, project_id $_qry = mysql_query($_sql) or die('...blah...'); $_res = mysql_fetch_object($_qry); //output echo $_res->TotalRecords; //prints nothing echo $_res->TotalEmployees; // returns 1 echo $_res->TotalProjects; //also return 1 Your query doesn't even have a "FROM Table" in it. Hopefully that's just a cut and paste error, as you should see your "die" message because of that error. You're not going to get the results you're after with a single query (unless you have PHP do some of the counting). Look at using a couple different queries to get your count. One solution may be: SELECT employee_id, COUNT(*) AS NumProjects FROM activity GROUP BY employee_id; The number of rows returned will be the number of employees. Each row will list the employee_id and how many times it appeared in the table. If project_id is not repeated for a given employee_id, then this will be your project count. As you loop throught the results, keep a running total of the NumProjects column to get the total projects. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Integrating an Applet with PHP
Raditha - I am using NS 7.1 running in Windows 2000. Which version of Netscape are you running? This certainly is a strange situation. http://www.hexidec.com/ekitdemo.php No HTML shows in the Editor window on startup with NS; it is there with IE. Todd Raditha Dissanayake wrote: HI, I tried it on netscape and it works. My jre is 1.4.2. AFAIK this is the only stable jre after 1.3xx series. It's a simple matter to add a line of code to the java applet to do the base64 decoding if you are concerned about compatibility. On the point raised about activex : The default plug in for ie (extremely crappy) is in fact an activex but that does not mean your applet behaves like an activex. Todd Cary wrote: Dan - I am surprised that an Open Source applet would rely on ActiveX. It appears that there is something I am not doing correctly in setting the DATA param for Netscape. Please overlook my ignorance about browsers and applets as I try to get a better understanding, but is BASE64 encoding/decoding a feature of IE and not , possibly, of Netscape? Todd Dan Anderson wrote: why does it work in IE and not in Netscape 7.1? I'm pretty sure ActiveX controls don't run on anything besides MS Windows Lockinware (TM). There are a number of other things that netscape does not fully support (try loading a page with an iframe tag in Netscape). You probably ran into another such problem. -Dan -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Integrating an Applet with PHP
Mozilla 1.4 Red Hat 9.0 KDE 3.2 JRE 1.4.2 Todd Cary wrote: Raditha - I am using NS 7.1 running in Windows 2000. Which version of Netscape are you running? This certainly is a strange situation. http://www.hexidec.com/ekitdemo.php No HTML shows in the Editor window on startup with NS; it is there with IE. Todd Raditha Dissanayake wrote: HI, I tried it on netscape and it works. My jre is 1.4.2. AFAIK this is the only stable jre after 1.3xx series. It's a simple matter to add a line of code to the java applet to do the base64 decoding if you are concerned about compatibility. On the point raised about activex : The default plug in for ie (extremely crappy) is in fact an activex but that does not mean your applet behaves like an activex. Todd Cary wrote: Dan - I am surprised that an Open Source applet would rely on ActiveX. It appears that there is something I am not doing correctly in setting the DATA param for Netscape. Please overlook my ignorance about browsers and applets as I try to get a better understanding, but is BASE64 encoding/decoding a feature of IE and not , possibly, of Netscape? Todd Dan Anderson wrote: why does it work in IE and not in Netscape 7.1? I'm pretty sure ActiveX controls don't run on anything besides MS Windows Lockinware (TM). There are a number of other things that netscape does not fully support (try loading a page with an iframe tag in Netscape). You probably ran into another such problem. -Dan -- -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 14 Sep 2003 00:36:26 -0000 Issue 2295
php-general Digest 14 Sep 2003 00:36:26 - Issue 2295 Topics (messages 162494 through 162532): Re: problems and segmentation fault with constants in PHP5 162494 by: Cristiano Duarte Whats wrong? 162495 by: Stevie D Peele 162496 by: Ryan A 162497 by: Sid 162519 by: esctoday.com | Wouter van Vliet Re: Displaying Blobs by a newbie 162498 by: Phil King 162500 by: Curt Zirzow For Loops and Variables?? 162499 by: John Ryan 162501 by: Curt Zirzow Re: PHP on a .NET enviroment machine: Conflicts? 162502 by: Curt Zirzow Re: Calling functions from Button actions 162503 by: Daniel Souza Re: loading classes and efficiency 162504 by: Curt Zirzow 162521 by: Brad Pauly Re: Mysql Authentication problem 162505 by: Curt Zirzow Using Image/GD functions to transform images stored in database 162506 by: weston.leary.csoft.net 162509 by: Jason Wong Repost - Cookie advice 162507 by: James Johnson Re: caching program... 162508 by: Curt Zirzow square brackets in form names violate HTML specs? 162510 by: Eugene Lee 162513 by: Curt Zirzow 162523 by: Eugene Lee Re: PEAR DB flipped fetch mode 162511 by: Curt Zirzow Re: Header and dfile download bug??? 162512 by: Curt Zirzow Re: Looking for a real good editor with some specific featrues ... 162514 by: Curt Zirzow htmlentities() and the macintosh character set 162515 by: Michael Winston 162522 by: Eugene Lee Mozilla and german 'Umlaute' 162516 by: Thomas Weber 162524 by: Dan Anderson Re: Session stealing, .. 162517 by: esctoday.com | Wouter van Vliet 162525 by: Ben C. socket_write eats data 162518 by: Thomas Weber Re: socket_write eats data - solved 162520 by: Thomas Weber MySql Query Help: COUNT() 162526 by: [-^-!-%- 162530 by: John W. Holmes Text into a url 162527 by: Tom Wollaston 162528 by: John W. Holmes More Image Transformation Difficulty 162529 by: weston.leary.csoft.net Re: Integrating an Applet with PHP 162531 by: Todd Cary 162532 by: Raditha Dissanayake 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 --- I reported this BUG at php.bugs as http://bugs.php.net/?id=25323. It's there for 13 days now and still no answer... :-( Cristiano Duarte "Cristiano Duarte" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > Is this suppose to work ? Currently it does not. > > class Priority { > const DEBUG = 0; > const INFO = 1; > const WARN = 2; > const ERROR = 3; > const FATAL = 4; > > const MAX_PRIORITY = FATAL; > } > > class ExtendedPriority extends Priority { > const REMOTE = Priority::MAX_PRIORITY + 1; > const URGENT = Priority::MAX_PRIORITY + 2; > } > > if it's not supposed to work, there is also some parser problem in ZE2 that > accepts a constant expression based on string concatenation(This code causes > segmentation fault): > > class test { > const TEST = "hi"; > const TEST1 = self::TEST . "ih"; > } > > Cristiano Duarte --- End Message --- --- Begin Message --- Whats wrong with this where $senderemail = $_POST['from']; It doesnt It only echos thank you. Why?--- End Message --- --- Begin Message --- Hey, Just touched it up a bit but its working: This should come before: $senderemail = $_POST['from']; not after this: print "Thank You, $senderemail"; plus I'm guessing that either your form is sending $senderemail or that you are getting via a $_GET you have to post $from not $senderemail. If you change the above to a $_GET this will work YourFileName.php?from=Ryan Cheers, -Ryan We will slaughter you all! - The Iraqi (Dis)information ministers site http://MrSahaf.com - Original Message - From: "Stevie D Peele" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, September 13, 2003 2:45 PM Subject: [PHP] Whats wrong? > Whats wrong with this > > > > where > > $senderemail = $_POST['from']; > > It doesnt It only echos thank you. > > Why? --- End Message --- --- Begin Message --- Try this - Sid On Sat, 13 Sep 2003 08:45:16 -0400, Stevie D Peele wrote: > Whats wrong with this > > > > > > where > > > $senderemail = $_POST['from']; > > > It doesnt It only echos thank you. > > > Why? --- End Message --- --- Begin Message --- or even: :P -> -Oorspronkelijk bericht- -> Van: Sid [mailto:[EMAIL PROTECTED] -> Verzonden: zondag 14 september 2003 3:43 -> Aan: Stevie D Peele; [EMAIL PROTECTED] -> Onderwerp: Re: [PHP] Whats wrong? -> -> -> Try this -> -> ->
Re: [PHP] Integrating an Applet with PHP
Hi, Ouch tried it again and mozilla had a heart attack and core dumped :-(( Then i tried konqueror browser worked like a charm Gentlemen, i think others in the group must be pretty annoyed about this thread shall we hop over to a java group? Raditha Dissanayake wrote: Mozilla 1.4 Red Hat 9.0 KDE 3.2 JRE 1.4.2 Todd Cary wrote: Raditha - I am using NS 7.1 running in Windows 2000. Which version of Netscape are you running? This certainly is a strange situation. http://www.hexidec.com/ekitdemo.php No HTML shows in the Editor window on startup with NS; it is there with IE. Todd Raditha Dissanayake wrote: HI, I tried it on netscape and it works. My jre is 1.4.2. AFAIK this is the only stable jre after 1.3xx series. It's a simple matter to add a line of code to the java applet to do the base64 decoding if you are concerned about compatibility. On the point raised about activex : The default plug in for ie (extremely crappy) is in fact an activex but that does not mean your applet behaves like an activex. Todd Cary wrote: Dan - I am surprised that an Open Source applet would rely on ActiveX. It appears that there is something I am not doing correctly in setting the DATA param for Netscape. Please overlook my ignorance about browsers and applets as I try to get a better understanding, but is BASE64 encoding/decoding a feature of IE and not , possibly, of Netscape? Todd Dan Anderson wrote: why does it work in IE and not in Netscape 7.1? I'm pretty sure ActiveX controls don't run on anything besides MS Windows Lockinware (TM). There are a number of other things that netscape does not fully support (try loading a page with an iframe tag in Netscape). You probably ran into another such problem. -Dan -- -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket_write eats data - solved
Is IRC UDP? Thomas Weber wrote: Hi, i've checked a hundred things before posting this question, but i forgot the most important thing, the buffer. The 'eaten' writes were buffered by the network-kernel and sent as bunch of data. If too much data for the buffer is sent, the write is broken up and completed in the next bunch-of-data. My receive-script hasn't diplayed the raw output, but an unserialized array, fetched out of the received string. Maybe this will will help someone in future. Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] - Original Message - From: "Thomas Weber" <[EMAIL PROTECTED]> To: "PHP-List" <[EMAIL PROTECTED]> Sent: Saturday, September 13, 2003 9:15 PM Subject: [PHP] socket_write eats data Hi, I am deveoping a chatserver in IRC-style in PHP. For communication it uses socket-multiplexing aka socket_select. So long so good, works perfectly. The problem is, than when i make several socket_write's to the same client without waiting about 0.1sec after each write, the written data gets lost somewhere. socket_write does NOT throw any error, the data seams just sended, but the clients never receives it. Small example of the used code: - var $clients // array of 'client'-objects, each object has it's own socket-descriptor in the object-variable $socket function write_to_clients ($text) { for ($i = 0; $i < count ($this->clients); $i++) { socket_write ($this->clients[$i]->socket, $text); } // usleep (1); if this is uncommented, all write are received by all clients } for ($i = 0; $i < 10; $i++) { $this->write_to_clients ("test ".$i); } - Okay, this doesn't check the client-sockets for readiness to write, but even if I check (via socket_select), ALL clients are ready to write and writes get lost too. It can't be the network-connection, because the tests run with standalone PHP-clients on the same machine. Is there any possibility to make fast writes without waiting after each write? The wait limits the server to max. 10 writes per second, wich isn't really enaugh for a good chatserver. Thanks for your help! Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket_write eats data - solved
No, it's TCP and a very uncomplicated protocol, everything is sent in clear text. Major problem is the socket-multicasting to keep track of all clients simultanly. - Original Message - From: "Raditha Dissanayake" <[EMAIL PROTECTED]> To: "Thomas Weber" <[EMAIL PROTECTED]>; "PHP-List" <[EMAIL PROTECTED]> Sent: Sunday, September 14, 2003 2:59 AM Subject: Re: [PHP] socket_write eats data - solved > Is IRC UDP? > Thomas Weber wrote: > > >Hi, > > > >i've checked a hundred things before posting this question, but i forgot the > >most important thing, the buffer. > >The 'eaten' writes were buffered by the network-kernel and sent as bunch of > >data. If too much data for the buffer is sent, the write is broken up and > >completed in the next bunch-of-data. > >My receive-script hasn't diplayed the raw output, but an unserialized array, > >fetched out of the received string. > > > >Maybe this will will help someone in future. > > > >Thomas 'Neo' Weber > >--- > >[EMAIL PROTECTED] > >[EMAIL PROTECTED] > > > >- Original Message - > >From: "Thomas Weber" <[EMAIL PROTECTED]> > >To: "PHP-List" <[EMAIL PROTECTED]> > >Sent: Saturday, September 13, 2003 9:15 PM > >Subject: [PHP] socket_write eats data > > > > > > > > > >>Hi, > >> > >>I am deveoping a chatserver in IRC-style in PHP. For communication it uses > >>socket-multiplexing aka socket_select. So long so good, works perfectly. > >>The problem is, than when i make several socket_write's to the same client > >>without waiting about 0.1sec after each write, the written data gets lost > >>somewhere. socket_write does NOT throw any error, the data seams just > >>sended, but the clients never receives it. > >> > >>Small example of the used code: > >>- > >>var $clients // array of 'client'-objects, each object has it's own > >>socket-descriptor in the object-variable $socket > >> > >>function write_to_clients ($text) { > >> for ($i = 0; $i < count ($this->clients); $i++) { > >>socket_write ($this->clients[$i]->socket, $text); > >> } > >> // usleep (1); if this is uncommented, all write are received by all > >>clients > >>} > >> > >>for ($i = 0; $i < 10; $i++) { > >>$this->write_to_clients ("test ".$i); > >>} > >>- > >> > >>Okay, this doesn't check the client-sockets for readiness to write, but > >> > >> > >even > > > > > >>if I check (via socket_select), ALL clients are ready to write and writes > >>get lost too. It can't be the network-connection, because the tests run > >> > >> > >with > > > > > >>standalone PHP-clients on the same machine. > >> > >>Is there any possibility to make fast writes without waiting after each > >>write? The wait limits the server to max. 10 writes per second, wich isn't > >>really enaugh for a good chatserver. > >> > >>Thanks for your help! > >> > >>Thomas 'Neo' Weber > >>--- > >>[EMAIL PROTECTED] > >>[EMAIL PROTECTED] > >> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > >> > > > > > > > > > -- > http://www.radinks.com/upload > Drag and Drop File Uploader. > > -- > 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] Trying to submit form to frame and pass php var
Hello I was wondering if someone could help me out. Trying to submit form to frame and pass php var at the same time. and... Link look like: Delete What I need to do though, is run this exact script while passing ($delete=yes) as php at the same time? Basically, run the form and if delete=yes then use the following form tag : Any ideas? Thanks Brandon
Re: [PHP] Calling functions from Button actions
wont they both be set ? i generally use a button type and onclick document.location.href to enforce an action in the get variable like something.php?action=something > Example: > > > > > > > action.php: > function action1() { > echo "Hello, I'm action1"; > } > > > function action2() { > echo "Hello, I'm action2"; > } > > if(isset($_GET['action1'])) { > action1(); > } > if(isset($_GET['action2'])) { > action2(); > } > > > Dan J. Rychlik wrote: >> Is their an easy way to call a function based upon a button action? >> >> -Dan > > -- > 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] Text into a url
$query = "SELECT name,url FROM clubs WHERE url>'' ORDER BY name"; ?? could it not be $query = "SELECT name,url FROM clubs WHERE url !="" ORDER BY name"; > Hi > I am havening a problem retrieving url from a mysql database. I have > the url's stored as text and am using the following code to retrieve > them > > > $query = "SELECT name,url FROM clubs WHERE url>'' ORDER BY name"; > > $result = @mysql_query($query) or die ("Query failed"); > > if (mysql_num_rows($result) == 0) { > > print "No Club Links Found."; > > } else { > > while ($row = mysql_fetch_assoc($result)) { > > print $row["name"] . ""; > > > This seems to work except the url refers to the previous name on the > list produced with the first name as a blank url. > Can anybody help > > Thanks > > -- > 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] square brackets in form names violate HTML specs?
On Sat, 2003-09-13 at 17:21, Eugene Lee wrote: > On Sat, Sep 13, 2003 at 06:15:29PM +, Curt Zirzow wrote: > : * Thus wrote Eugene Lee ([EMAIL PROTECTED]): > : > Something I've noticed in PHP is a proliferation of code like this: > : > > : > > [...] > : The way to properly do it would be to set set your name as: > : > : > > Great idea, thanks Curt! I almost fell for this and updated my code. Then I decided to read the spec for myself and noticed that it doesn't say anywhere that % is ok either *grin*. - ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). Cheers, Rob. -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling functions from Button actions
[EMAIL PROTECTED] wrote: >>Dan J. Rychlik wrote: >>>Is their an easy way to call a function based upon a button action? >> >>Example: >> >> >> >> >> >> >>action.php: >>function action1() { >>echo "Hello, I'm action1"; >>} >> >> >>function action2() { >>echo "Hello, I'm action2"; >>} >> >>if(isset($_GET['action1'])) { >>action1(); >>} >>if(isset($_GET['action2'])) { >>action2(); >>} > wont they both be set ? No, only the button that is clicked will be set. i generally use a button type and onclick document.location.href to enforce an action in the get variable like something.php?action=something I wouldn't rely on Javascript... ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling functions from Button actions
apologies i generally use this system for deleting records, i give a confirm box if they press ok it goes to another action, i suppose i should change this system to submit the form instead and check for the post var ? i guess at least it could store the http_referer then :\ > [EMAIL PROTECTED] wrote: > >>Dan J. Rychlik wrote: > >>>Is their an easy way to call a function based upon a button action? > >> > >>Example: > >> > >> > >> > >> > >> > >> > >>action.php: > >>function action1() { > >>echo "Hello, I'm action1"; > >>} > >> > >> > >>function action2() { > >>echo "Hello, I'm action2"; > >>} > >> > >>if(isset($_GET['action1'])) { > >>action1(); > >>} > >>if(isset($_GET['action2'])) { > >>action2(); > >>} > > >> wont they both be set ? > > No, only the button that is clicked will be set. > >> i generally use a button type and onclick document.location.href to >> enforce an action in the get variable like >> something.php?action=something > > I wouldn't rely on Javascript... > > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling functions from Button actions
[EMAIL PROTECTED] wrote: apologies i generally use this system for deleting records, i give a confirm box if they press ok it goes to another action, i suppose i should change this system to submit the form instead and check for the post var ? i guess at least it could store the http_referer then :\ If you're talking about presenting a list of records and using a button to delete a record, then you should use a method such as this... Where "xx" is the record_id (or equivalent). Then, when the form is submitted, you just look for $_REQUEST['delete'], make sure it's an array, grab the key using key(), and delete that record. Simple, eh? :) If you want an easy method for presenting a list of records and radio buttons for each record with different statuses (like open, closed, pending, delete, etc), and handling the status changes, check out my column in the latest issue of php|architect. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling functions from Button actions
my form action usually looks like this some.php?action=update&ID=1 my update will look like update table set *** where _rowid=$_GET['ID'] so therefore its globally used. i'd use the id from the get var but i guess in the delete function i could place this within the update action so case 'update': delete(tablename); update(tablename); break; i dont tend to like this becuase it'll be in the same action which is why i tried the location.href way to send it to a different action, as both the update and delete buttons are within the same form, i'm sure u could have a delete button in a list although this leads to problems as users generally would like the delete button in the update/view screen so they know exactly what they are deleting so therefore which is why the buttons are in the same form, any ideas ? > [EMAIL PROTECTED] wrote: > >> apologies i generally use this system for deleting records, i give a >> confirm box if they press ok it goes to another action, i suppose i >> should change this system to submit the form instead and check for the >> post var ? i guess at least it could store the http_referer then :\ > > If you're talking about presenting a list of records and using a button > to delete a record, then you should use a method such as this... > > > > Where "xx" is the record_id (or equivalent). Then, when the form is > submitted, you just look for $_REQUEST['delete'], make sure it's an > array, grab the key using key(), and delete that record. > > Simple, eh? :) > > If you want an easy method for presenting a list of records and radio > buttons for each record with different statuses (like open, closed, > pending, delete, etc), and handling the status changes, check out my > column in the latest issue of php|architect. :) > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals 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
Re: [PHP] socket_write eats data - solved
Wouldn't this multiple connections be a problem for php? IMHO one of the main draw backs of the PHP IMAP library is the fact that you have to open and close and imap connection for each page. That issue is multiplied ten fold in this scenario isn't it? Thomas Weber wrote: No, it's TCP and a very uncomplicated protocol, everything is sent in clear text. Major problem is the socket-multicasting to keep track of all clients simultanly. - Original Message - From: "Raditha Dissanayake" <[EMAIL PROTECTED]> To: "Thomas Weber" <[EMAIL PROTECTED]>; "PHP-List" <[EMAIL PROTECTED]> Sent: Sunday, September 14, 2003 2:59 AM Subject: Re: [PHP] socket_write eats data - solved Is IRC UDP? Thomas Weber wrote: Hi, i've checked a hundred things before posting this question, but i forgot the most important thing, the buffer. The 'eaten' writes were buffered by the network-kernel and sent as bunch of data. If too much data for the buffer is sent, the write is broken up and completed in the next bunch-of-data. My receive-script hasn't diplayed the raw output, but an unserialized array, fetched out of the received string. Maybe this will will help someone in future. Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] - Original Message - From: "Thomas Weber" <[EMAIL PROTECTED]> To: "PHP-List" <[EMAIL PROTECTED]> Sent: Saturday, September 13, 2003 9:15 PM Subject: [PHP] socket_write eats data Hi, I am deveoping a chatserver in IRC-style in PHP. For communication it uses socket-multiplexing aka socket_select. So long so good, works perfectly. The problem is, than when i make several socket_write's to the same client without waiting about 0.1sec after each write, the written data gets lost somewhere. socket_write does NOT throw any error, the data seams just sended, but the clients never receives it. Small example of the used code: - var $clients // array of 'client'-objects, each object has it's own socket-descriptor in the object-variable $socket function write_to_clients ($text) { for ($i = 0; $i < count ($this->clients); $i++) { socket_write ($this->clients[$i]->socket, $text); } // usleep (1); if this is uncommented, all write are received by all clients } for ($i = 0; $i < 10; $i++) { $this->write_to_clients ("test ".$i); } - Okay, this doesn't check the client-sockets for readiness to write, but even if I check (via socket_select), ALL clients are ready to write and writes get lost too. It can't be the network-connection, because the tests run with standalone PHP-clients on the same machine. Is there any possibility to make fast writes without waiting after each write? The wait limits the server to max. 10 writes per second, wich isn't really enaugh for a good chatserver. Thanks for your help! Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] change PHP include directory
Hi, Normally to change a sites include directory for PHP I'd use a .htaccess file and the following command: php_value include_path ".:/path/to/web/" Again normally, I would get the path to the site by doing a simple phpinfo(); command and find the _ENV["DOCUMENT_ROOT"] line near the end of the phpinfo(); page. I've just setup an account with a shared hosting provider - I'm not fully sure if they allow me to use .htaccess or not, I've got a call into tech support but waiting is boring. So while I wait - is there a better or more accurate way of determining the actual path to my site on their server? I'm sure it has been written into PHP to specifically not allow this - just curious. Secondly, if it is proven that my host does not allow .htaccess - is there another way for me to change the include directory from its default and into my sites root? This current site isn't all that large, so I could live without changing the include path - but my next job (which is already committed to this same host) is fairly large and will be a necessity for the change to occur. Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] change PHP include directory
Tim Thorburn wrote: Normally to change a sites include directory for PHP I'd use a .htaccess file and the following command: php_value include_path ".:/path/to/web/" Again normally, I would get the path to the site by doing a simple phpinfo(); command and find the _ENV["DOCUMENT_ROOT"] line near the end of the phpinfo(); page. I've just setup an account with a shared hosting provider - I'm not fully sure if they allow me to use .htaccess or not, I've got a call into tech support but waiting is boring. So while I wait - is there a better or more accurate way of determining the actual path to my site on their server? I'm sure it has been written into PHP to specifically not allow this - just curious. You will be able to get it the same way. Just look at a phpinfo() page or print the value of $_SERVER['DOCUMENT_ROOT']. Secondly, if it is proven that my host does not allow .htaccess - is there another way for me to change the include directory from its default and into my sites root? You can use ini_set(). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] innodb + php caching issues
Hi there i have experienced a wierd bug , where after i commit a query in innodb that change wont be viewable until i refresh the page , this doesnt happen in a similar system framwork using myisam tables the change is viewable, what could be the problem ? should i just give nocache headers for a quick fix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] change PHP include directory
Hi, Sunday, September 14, 2003, 3:25:57 PM, you wrote: TT> Hi, TT> Normally to change a sites include directory for PHP I'd use a .htaccess TT> file and the following command: TT> php_value include_path ".:/path/to/web/" TT> Again normally, I would get the path to the site by doing a simple TT> phpinfo(); command and find the _ENV["DOCUMENT_ROOT"] line near the end of TT> the phpinfo(); page. TT> I've just setup an account with a shared hosting provider - I'm not fully TT> sure if they allow me to use .htaccess or not, I've got a call into tech TT> support but waiting is boring. So while I wait - is there a better or more TT> accurate way of determining the actual path to my site on their TT> server? I'm sure it has been written into PHP to specifically not allow TT> this - just curious. TT> Secondly, if it is proven that my host does not allow .htaccess - is there TT> another way for me to change the include directory from its default and TT> into my sites root? TT> This current site isn't all that large, so I could live without changing TT> the include path - but my next job (which is already committed to this same TT> host) is fairly large and will be a necessity for the change to occur. TT> Thanks TT> -Tim You can do this at the top of each page if all else fails ini_set('include_path','new_include_path:'.ini_get('include_path')); (Use a ; as the separator if on windows) This puts your directory first in the search path -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php