[PHP] Simple XML
Hi all, Does anyone know if PHP has a library for getting the content of an XML file like XML::Simple in perl? In that perl library I can get the whole content of an XML file in a reference to an array of arrays of arrays... with only 3 lines of code. Is there such a simple method in PHP? Thank you much. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parsing /'s in urls
My host recently upgraded PHP. I had a script, download.php, that would work like this http://www.myhost.com/download.php/30/file.torrent the download.php script would take the 30, look up the real filename in the database, and readfile() it back. this was a great setup because the browser just thought it was accessing a direct link to a file. But now download.php/30/file.torrent results in a 404. Is this something I can change back? Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question for the PHP consultants out there.
On Friday 12 November 2004 06:36, Brent Clements wrote: > I'm looking at replacing a home-grown solution I wrote in PHP a while back. > I've done the google thing, but everything I've tried doesn't really sit > well with me. So...now I'm turning to my peers for suggestions. List what you tried. Summarise what you liked and disliked about them and why you're not going to use them. -- 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 -- /* Commoner's three laws of ecology: (1) No action is without side-effects. (2) Nothing ever goes away. (3) There is no free lunch. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question for the PHP consultants out there.
What web based software project management tool do you use to keep track of projects, project tasks, customer requests, and bug reports? I need something that would allow a customer to keep track of his/her project basically and to use the application to submit bug requests, feature requests, and other similiar items. I'm looking at replacing a home-grown solution I wrote in PHP a while back. I've done the google thing, but everything I've tried doesn't really sit well with me. So...now I'm turning to my peers for suggestions. What do you guy's use and/or suggest? Thanks, Brent
RE: [PHP] keeping format of text in textbox
On Fri, 12 Nov 2004 15:41, Justin Baiocchi wrote: > I use this when submitting the data from the form (for jokes): > > if ($submit) > { > $joke = nl2br($joke); > $dbcnx = @mysql_connect( "localhost", "root", "password"); > mysql_select_db("movements"); > $sql = "INSERT INTO jokes SET author='$author', joke='$joke', id='$id'"; > mysql_query($sql); > echo "Thank you, your joke has been recorded!"; > } Here you are adding < /BR> to the data before storing it in the database. Note that if you want to provide the stored data for editing, the embedded HTML may confuse people who are modifying the data. Better technique is to store the text as given (after validating it for whatever things you don't want to allow) and simply use nl2br() when you display the data. > Then this when displaying the text: > > > if (!$link = mysql_connect("localhost","root","password")) > exit("Unable to make a connection to the database"); > if (!mysql_select_db("movements", $link)) > exit("Unable to select the database"); > $table = 'jokes'; > $check = "select * from $table ORDER BY rand() LIMIT 100"; > $qry = mysql_query($check) or die ("Could not match data because > ".mysql_error()); > $myrow = mysql_fetch_array($qry); This next line doesn't seem to do anything. I'm guessing that you are trying to replace the < /BR> that you added above with a newline; this is redundant and if it actually worked, would add an extra newline at each occurrence of < /BR>. Note that nl2br doesn't replace a newline, it adds the BR before each newline. > $joke = str_replace("","\n",$joke); > ?> > > > ?> > > > Kindly provided by > > > > > > Excuse the crap code, I'm pretty new to php :) Cheers -- David Robley Misspelled? Impossible. My modem is error correcting! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] keeping format of text in textbox
I did a search for this in the archive but didn't find anything. Is there a way to preserve the format of text in a textbox that is being saved in a database and then pulled out and displayed? The people entering the data want to keep their tabs and newlines, but right now, that's not happening. Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: adding a space every 4 chars
Justin French wrote: Hi, What's the quickest way to add a space every four characters? Eg 123456789 becomes 1234 5678 9 Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] keeping format of text in textbox
On 12/11/2004, at 4:05 PM, Amanda Hemmerich wrote: I did a search for this in the archive but didn't find anything. Is there a way to preserve the format of text in a textbox that is being saved in a database and then pulled out and displayed? The people entering the data want to keep their tabs and newlines, but right now, that's not happening. Are you displaying the content back into a textarea, or into normal HTML? 's following basically the same rules as 's -- newlines and tabs will be respected, as long as your stylesheets don't override that. My first suggestion is view the HTML source in a browser first, and see if the new lines are there in the source... If they aren't there, then they won't be there any other way. If not, the white space (new lines, tabs, etc) must have been stripped out somewhere in your code on the way in or out of the database. Inserting them into the database should not remove white space by default, so if yours aren't there in the DB, then your code somewhere must be stripping it out. However, if you just want to display the content and plain text on the HTML page, then you need to realise the following -- newlines, tabs and multiple spaces are ignored in most cases by HTML. To preserve all the white space, you can put the text in a block, which respects white space formatting. You can also achieve the same thing with CSS elements. This is pretty much the only option for tabs, but I'd argue they aren't needed at all. To preserve just newlines, you may consider something like nl2br(), which adds a tag to all newlines. But this is all pretty much a HTML discussion, not PHP :) Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding a space every 4 chars
On 13/11/2004, at 12:20 AM, Jason Wong wrote: No idea whether it's the quickest (in terms of cpu time): $doo = '123456789'; $dah = preg_replace('/(\d{4})/', '\\1 ', $doo); echo $dah; Quickest for me is more about lines of code and simplicity, so, thanks!! Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] adding a space every 4 chars
Hi, What's the quickest way to add a space every four characters? Eg 123456789 becomes 1234 5678 9 TIA, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding a space every 4 chars
On Friday 12 November 2004 04:49, Justin French wrote: > What's the quickest way to add a space every four characters? > > Eg 123456789 becomes 1234 5678 9 No idea whether it's the quickest (in terms of cpu time): $doo = '123456789'; $dah = preg_replace('/(\d{4})/', '\\1 ', $doo); echo $dah; -- 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 -- /* Stupid, n.: Losing $25 on the game and $25 on the instant replay. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] keeping format of text in textbox
I use this when submitting the data from the form (for jokes): if ($submit) { $joke = nl2br($joke); $dbcnx = @mysql_connect( "localhost", "root", "password"); mysql_select_db("movements"); $sql = "INSERT INTO jokes SET author='$author', joke='$joke', id='$id'"; mysql_query($sql); echo "Thank you, your joke has been recorded!"; } Then this when displaying the text: if (!$link = mysql_connect("localhost","root","password")) exit("Unable to make a connection to the database"); if (!mysql_select_db("movements", $link)) exit("Unable to select the database"); $table = 'jokes'; $check = "select * from $table ORDER BY rand() LIMIT 100"; $qry = mysql_query($check) or die ("Could not match data because ".mysql_error()); $myrow = mysql_fetch_array($qry); $joke = str_replace("","\n",$joke); ?> Kindly provided by Excuse the crap code, I'm pretty new to php :) -Original Message- From: Amanda Hemmerich [mailto:[EMAIL PROTECTED] Sent: Friday, 12 November 2004 4:05 PM To: [EMAIL PROTECTED] Subject: [PHP] keeping format of text in textbox I did a search for this in the archive but didn't find anything. Is there a way to preserve the format of text in a textbox that is being saved in a database and then pulled out and displayed? The people entering the data want to keep their tabs and newlines, but right now, that's not happening. Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to parse a string parse with ereg
On Friday 12 November 2004 00:50, [EMAIL PROTECTED] wrote: > The regular expression is already working but how can I reduce the > string to have then only 2 lines ? Convert the string into an array using explode(). -- 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 -- /* I believe that professional wrestling is clean and everything else in the world is fixed. -- Frank Deford, sports writer */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and eCommerce?
99% of shopping carts are able to handlel credit card transactions. search "php shopping cart" on google freshmeat.net hotscripts.com I use most of the time osCommerce. More then happy. Used several times X-Cart. They are good too, but not for free. -afan Jason Bourque wrote: Hello, Are there any free shopping carts out there that can handle the credit card transaction? How do I get started here? Any help is greatly appreciated. Thanks, Jason Bourque -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and eCommerce?
Hello, Are there any free shopping carts out there that can handle the credit card transaction? How do I get started here? Any help is greatly appreciated. Thanks, Jason Bourque -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems when 'nc ' entered into a field on a form
Jason Oakley wrote: I have this strange problem. If anyone enteres the letters 'nc ' that is N C and a space (eg typing Bobs Inc or Hotsync etc) the server gives: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Now I suppose it could be Apache related or something, but I have no way of telling. I thought it was only in phpBB but I have my own forms on my own blog website and the same thing happens there ( http://www.bangrocks.com .. post a comment to test if you like). I don't see any problems in the log file to say why this may be occurring so this is my last hope. Has anyone seen this before? My webhost has noticed it but aren't sure how to proceed. How are you processing the user supplied text? Can you show us the code that validates what the user wrote before it's sent off to your database? Basic troubleshooting steps would be of use here. Comment out your validation code and see if it works. If it does, add back the code bit by bit until it breaks. There's nothing in PHP that would prevent text ending in "nc " to be entered. -- ---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] Session file not written, session variables messed up.
Hi, I have a weird problem with sessions on PHP 4.3.9 + Apache 1.3.33 in Slackware, maybe someone could help me or have had the same problem. I'm getting these messages in my logs: PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/tmp/php) in Unknown on line 0 /var/tmp/php is owned by the user/group Apache is running as, and it has 0700 permissions. This message appears sporadically. I googled but I only got answers related to permissions. This happens with an application which consists in two frames loading distinct scripts. I print the content of one session variable in both frames, let's say: The weirdness comes when in one frame the script will print "Agent Smith" while in the other frame of the same frameset the script which loads on it will print "Thomas Anderson"... and the actual full name in the database is "Trinity" (both "Agent Smith" and "Thomas Anderson" are also in the database, related to different logins each one). The session variables get their values from a database, in one point of the login script only, by simple assignment: // query the database to get the full name for $_POST['login'], where // login is unique... then: $_SESSION['fullname'] = $rs['fullname']; I have not been able to determine if the warning message is related to this weird behavior. This behavior shows up sporadically. I'm using this session config in php.ini: session.save_handler = files session.save_path = /var/tmp/php session.use_cookies = 1 session.use_only_cookies = 1 session.name = SID session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 7200 session.bug_compat_42 = 1 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 16 session.entropy_file = /dev/urandom session.cache_expire = 180 session.use_trans_sid = 0 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" The client browser has been MSIE 6.0 in all cases. Any help is appreciated. Thanks in advance. Rodolfo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to parse a string parse with ereg
Hi, I've a string where the output of route -n is in for example. x.x.x.x 0.0.0.0 255.255.255.255 UH0 00 ppp0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 00 eth1 0.0.0.0 x.x.x.x 0.0.0.0 UG0 00 ppp0 The regular expression is already working but how can I reduce the string to have then only 2 lines ? To explain this I can proof if the first line is set properly. This is already done. So I would like now to delete the first line of the string which includes this data. So I would then have now: 192.168.0.0 0.0.0.0 255.255.255.0 U 0 00 eth1 0.0.0.0 x.x.x.x 0.0.0.0 UG0 00 ppp0 Then I could test if the second line is set properly which is now the first line and so on. What I need would be a looping possibilty which makes it able to delete every line which is ok so far and so on. As I don't know what routing table a person is using there could be quite a lot of lines which should be proofed concerning the syntax. -- Best Regards, Mark. "Hello, I am brand new to meditation, and I have a frustrating habit of falling asleep in class. I don't know how to stop this. When my teacher tells us to relax our bodies and focus on breathing, my body relaxes, but so does my brain." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems when 'nc ' entered into a field on a form
I have this strange problem. If anyone enteres the letters 'nc ' that is N C and a space (eg typing Bobs Inc or Hotsync etc) the server gives: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Now I suppose it could be Apache related or something, but I have no way of telling. I thought it was only in phpBB but I have my own forms on my own blog website and the same thing happens there ( http://www.bangrocks.com .. post a comment to test if you like). I don't see any problems in the log file to say why this may be occurring so this is my last hope. Has anyone seen this before? My webhost has noticed it but aren't sure how to proceed. Thanks. -- Jason Oakley Robina Helpdesk AAPT Limited Ph: 07 5562 4359 [EMAIL PROTECTED] -- This communication, including any attachments, is confidential. If you are not the intended recipient, you should not read it - please contact me immediately, destroy it, and do not copy or use any part of this communication or disclose anything about it. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Which PHP for MySQL 4.1
In my previous email OLDPASSWORD() should have been OLD_PASSWORD() Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inline_C installation
On Nov 11, 2004, at 12:50 PM, Rayan Lahoud wrote: Does anybody knows how to install a pear package. i have the inline_C package that i want to install and use. And can i have some sample functions using this package? I believe the inline_c package is actually a pecl package [pecl.php.net], however it is still installed with the pear installer (I hope that makes sense). Ok, first try typing pear -v on the command line. If this doesn't work (it returns "command not found"), try http://pear.php.net/manual/en/installation.php. If that succedes, you have a pear package manager installed. Now type: pear install inline_c this should install the package for you. You'll probably have to add the module to your php.ini script and restart apache. -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Which PHP for MySQL 4.1
The MySQL library for 4.1.x is mysqli_* ( http://www.php.net/mysqli ) , that's only works with PHP 5 as far as I know. The old MySQL library ( http://www.php.net/mysql ) Can be used with PHP 4 (any version), but it won't be able to connect to MySQL with a user using the new password system introduced in MySQL 4.1.3 . You can set a password for a MySQL user using the OLDPASSWORD() function, which would allow you to connect with the old library in PHP 4. Chris C.F. Scheidecker Antunes wrote: Hello, I would like to migrate my MySQL servers from 4.0 to 4.1. As I use PHP as well as Java with these servers I wonder what PHP 4 version would be compatible with MySQL 4.1. Has anyone used MySQL 4.1 with PHP yet? I appreciate your thoughts. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I su to another account??
Yea, switch users so I can do the chmod, chown, etc... Um, I'll look into it. Thanks, Scott "Ian Firla" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Do you really need to switch users or do you need to run something as > another user? > > Try looking into setting up and using sudo. > > Ian > > On Thu, 2004-11-11 at 09:20 -0500, Scott Fletcher wrote: > > How do I su (switch user) to another account from the nobody in php? I > > haven't got it to work, so I get the impression that it is either I'm doing > > it all wrong in PHP script or that the nobody doesn't have the authority to > > do so. > > > > Have anyone who ever successfully do it please post a sample script? > > > > Thanks, > > Scott > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I su to another account??
Um, I'll look into it. Thanks... Scott "Jason" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well if you are using apache as your webserver you can use a module > which supports this feature... mod_chroot, mod_ruid or mod_suid2 is what > you want. > > Or just as a suggestion if you don't want to change the running > environment of apache I recommend having your script set a flag (temp > file or something) then write a shell or php script running through a > cron job to check for the temporary file before it executes. > > Scott Fletcher wrote: > > How do I su (switch user) to another account from the nobody in php? I > > haven't got it to work, so I get the impression that it is either I'm doing > > it all wrong in PHP script or that the nobody doesn't have the authority to > > do so. > > > > Have anyone who ever successfully do it please post a sample script? > > > > Thanks, > > Scott > > > -- > Jason Gerfen > [EMAIL PROTECTED] > > "And remember... If the ladies > don't find you handsome, they > should at least find you handy..." > ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Which PHP for MySQL 4.1
You will need to use the old_password() function in MySQL 4.1 and above. You can find out more at mysql.com Jim On Thu, 2004-11-11 at 15:58 -0500, Brent Baisley wrote: > I migrated to MySQL 4.1 about a month ago. I had some issues with PHP > (running 4.3.6) communicating with MySQL because 4.1 implements a new > form of communication. As I recall, I had to do something with the > passwords in the grants table, but I forget what now. It's been working > fine since. > > On Nov 11, 2004, at 3:05 PM, C.F. Scheidecker Antunes wrote: > > > Hello, > > > > I would like to migrate my MySQL servers from 4.0 to 4.1. > > > > As I use PHP as well as Java with these servers I wonder what PHP 4 > > version would be compatible with MySQL 4.1. > > > > Has anyone used MySQL 4.1 with PHP yet? > > > > I appreciate your thoughts. > > > > Thanks. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > Brent Baisley > Systems Architect > Landover Associates, Inc. > Search & Advisory Services for Advanced Technology Environments > p: 212.759.6400/800.759.0577 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how come mysql_connect() doesn't work?
I think I know, You're probably using php 5. mysql module is not 'installed' in it.. "Jay Blanchard" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] [snip] how come mysql_connect() doesn't work? What should i use instead to get me connect MySql. [/snip] Are you getting a specific error? Can you show us the code you are using? What version of PHP? Without this we cannot help you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Which PHP for MySQL 4.1
I migrated to MySQL 4.1 about a month ago. I had some issues with PHP (running 4.3.6) communicating with MySQL because 4.1 implements a new form of communication. As I recall, I had to do something with the passwords in the grants table, but I forget what now. It's been working fine since. On Nov 11, 2004, at 3:05 PM, C.F. Scheidecker Antunes wrote: Hello, I would like to migrate my MySQL servers from 4.0 to 4.1. As I use PHP as well as Java with these servers I wonder what PHP 4 version would be compatible with MySQL 4.1. Has anyone used MySQL 4.1 with PHP yet? I appreciate your thoughts. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling a C program from php
On Thu, 11 Nov 2004 02:51:54 -0800 (PST), Rayan Lahoud <[EMAIL PROTECTED]> wrote: Hello, does anybody knows how to call a C function from a php code? Thank you!! :) http://us4.php.net/manual/en/function.system.php -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ http://www.smempire.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); What's missing? The error message. Include it, and the offending line(s) of code, and ask again. --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Which PHP for MySQL 4.1
[snip] I would like to migrate my MySQL servers from 4.0 to 4.1. As I use PHP as well as Java with these servers I wonder what PHP 4 version would be compatible with MySQL 4.1. Has anyone used MySQL 4.1 with PHP yet? [/snip] PHP 4 is compatible with MySQL 4.1. My caution to you would be using Apache 2 as it has some quirks that haven't been worked out yet. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calling function from function?
function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
Rick Fletcher wrote: db( $defined[0], $defined[1], $defined[2], $defined[3] ); > which tells me that the $db handle is not being returned when called > from the db() function from within the logs() function and I am not > sure why? it's being returned, you've just forgotten to assign it. add a "$db = " to the beginning of that line and you should be good to go. --Rick dang, thanks dude I knew it was something simple like that. just goes to show you how over analyzed things are. lol. thanks again. -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
Greg Donald wrote: On Thu, 11 Nov 2004 12:42:44 -0700, Jason <[EMAIL PROTECTED]> wrote: There isnt an error at all. How could there be an error? You're using @ to suppress nearly every mysql function call. Makes it kind of hard to debug that way. yep, you are right... I removed the @ for each of mysql functions and here is my error... Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /path/to/script.php on line 43 which tells me that the $db handle is not being returned when called from the db() function from within the logs() function and I am not sure why? $defined = array( 0=> "localhost", 1 => "user", 2 => "pass" ); function db( $host, $user, $pass, $dbnam ) { $db = mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db ) ); mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[0], $defined[1], $defined[2], $defined[3] ); $pagecount = "1"; $tble = "logs"; $sql = mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( mysql_error( $db )); while( $row = mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( mysql_num_rows( $sql ) == 0 ) { $insert = mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\"$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\",\"$_SESSION[hash]\")", $db )or die( mysql_error( $db ) ); } elseif( mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\", host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERVER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $db )or die( mysql_error( $db ) ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Url encoding awry
Hello all I have a dynamically created image labeled: stories & critiques.jpg I have use url encode on it when saving it, and it is stored on the server as: stories+%26+crtitiques.jpg I have an html block that calls the image I get a 404 I know the path is right and spelling is correct If I just put the path into the browser directly it also 404's If I rename the file in any way that removes the % it works... I thought % was a legal URL encoding character? JZ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Which PHP for MySQL 4.1
Hello, I would like to migrate my MySQL servers from 4.0 to 4.1. As I use PHP as well as Java with these servers I wonder what PHP 4 version would be compatible with MySQL 4.1. Has anyone used MySQL 4.1 with PHP yet? I appreciate your thoughts. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
On Thu, 11 Nov 2004 12:42:44 -0700, Jason <[EMAIL PROTECTED]> wrote: > There isnt an error at all. How could there be an error? You're using @ to suppress nearly every mysql function call. Makes it kind of hard to debug that way. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
I hate posting all of that code, but for Greg's question... it does give me the correct array data. Jason wrote: Rick Fletcher wrote: function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); What's missing? The error message. Include it, and the offending line(s) of code, and ask again. --Rick There isnt an error at all. According to the die() functions at the end of the mysql() functions it should give it there, instead I get blank as if the function has not successfully completed. The reason I say this is if you try to access the mysql resource pointer ( $db, in this case ) I get nothing, a return code of 0. Example in point... function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( "phpDHCPAdmin currently not active, is under repair or is not configured correctly.Error Number: " . mysql_errno( $db ) . "Error Message: " . mysql_error( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); @mysql_select_db( $dbnam )or die( "Could not connect to database: $defined[3]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( "Error occured when searching logs for session id: $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); while( $row = @mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( @mysql_num_rows( $sql ) == 0 ) { $insert = @mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\"$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\",\"$_SESSION[hash]\")", $db )or die( "Error occured creating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } elseif( @mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = @mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\", host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERVER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $db )or die( "Error occured while updating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } when called with logs(); returns this: Error occured when searching logs for session id: 82a831c4190f6e929032c0a9512c3657 Error Message: Error Number: Email Administrator: [EMAIL PROTECTED] -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Url encoding awry
I have a dynamically created image labeled: stories & critiques.jpg I have use url encode on it when saving it, and it is stored on the server as: stories+%26+crtitiques.jpg [snip] If I just put the path into the browser directly it also 404's If I rename the file in any way that removes the % it works... I thought % was a legal URL encoding character? URL encoding the file's name on disk is causing your problems. If you really want to keep it that way, you'll have to double encode the request, so that when it's decoded once you end up with "stories+%26+crtitiques.jpg". That's pretty needlessly complex. Why not just leave the file named "stories & critiques.jpg" on disk and change your image tag to ? --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
* Thus wrote Jason: > function db( $host, $user, $pass, $dbnam ) { > $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); >@mysql_select_db( $dbnam )or die( mysql_error( $db ) ); > return $db; > } > > function logs() { > global $defined; > > db( $defined[9], $defined[1], $defined[2], $defined[3] ); > ... do some processing ... > > } You probably should read chapter III of the manual: http://php.net/langref Curt -- Quoth the Raven, "Nevermore." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
Rick Fletcher wrote: function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); ... do some processing ... } what am i missing here? i get errors if i try to pass $db to logs. i.e. logs( $db ); What's missing? The error message. Include it, and the offending line(s) of code, and ask again. --Rick There isnt an error at all. According to the die() functions at the end of the mysql() functions it should give it there, instead I get blank as if the function has not successfully completed. The reason I say this is if you try to access the mysql resource pointer ( $db, in this case ) I get nothing, a return code of 0. Example in point... function db( $host, $user, $pass, $dbnam ) { $db = @mysql_pconnect( $host, $user, $pass )or die( "phpDHCPAdmin currently not active, is under repair or is not configured correctly.Error Number: " . mysql_errno( $db ) . "Error Message: " . mysql_error( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); @mysql_select_db( $dbnam )or die( "Could not connect to database: $defined[3]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); return $db; } function logs() { global $defined; db( $defined[9], $defined[1], $defined[2], $defined[3] ); $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM $tble WHERE session = \"$_SESSION[hash]\"", $db )or die( "Error occured when searching logs for session id: $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); while( $row = @mysql_fetch_array( $sql ) ) { $id = $row["session"]; } if( @mysql_num_rows( $sql ) == 0 ) { $insert = @mysql_query( "INSERT INTO $tble VALUES (\"\",\"$_SESSION[date]\",\"$_SESSION[hour]\",\"$_SESSION[ipaddy]\",\"$_SESSION[host]\",\"$_SESSION[ref]\",\"$_SERVER[HTTP_USER_AGENT]\",\"$_SERVER[PHP_SELF]\",\"$pagecount\",\"$_SESSION[msg]\",\"$_SESSION[hash]\")", $db )or die( "Error occured creating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } elseif( @mysql_num_rows( $sql ) != 0 ) { if( ( $_SESSION['hash'] == $id ) || ( empty( $pagecount ) ) ) { $pagecount++; $update = @mysql_query( "UPDATE $tble SET date=\"$_SESSION[date]\", time=\"$_SESSION[hour]\", ip=\"$_SESSION[ipaddy]\", host=\"$_SESSION[host]\", referer=\"$_SESSION[ref]\", agent=\"$_SERVER[HTTP_USER_AGENT]\", page=CONCAT(page,\".:||:.$_SERVER[PHP_SELF]\"), pagecount=\"$pagecount\", message=\"$_SESSION[msg]\", session=\"$_SESSION[hash]\" WHERE session=\"$id\"", $db )or die( "Error occured while updating logs for $_SESSION[hash]Error Message: " . @mysql_error( $db ) . "" . "Error Number: " . @mysql_errno( $db ) . "Email Administrator: mailto:$defined[5]\";>$defined[5]" ); } else { call_user_func( "exit_app" ); } } else { call_user_func( "exit_app" ); } } when called with logs(); returns this: Error occured when searching logs for session id: 82a831c4190f6e929032c0a9512c3657 Error Message: Error Number: Email Administrator: [EMAIL PROTECTED] -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
db( $defined[0], $defined[1], $defined[2], $defined[3] ); > which tells me that the $db handle is not being returned when called > from the db() function from within the logs() function and I am not > sure why? it's being returned, you've just forgotten to assign it. add a "$db = " to the beginning of that line and you should be good to go. --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling function from function?
On Thu, 11 Nov 2004 12:26:17 -0700, Jason <[EMAIL PROTECTED]> wrote: > function db( $host, $user, $pass, $dbnam ) { > $db = @mysql_pconnect( $host, $user, $pass )or die( mysql_error( $db )); > @mysql_select_db( $dbnam )or die( mysql_error( $db ) ); > return $db; > } > > function logs() { If you plan to pass parameters to this function you should probbaly define them: function logs( $var1 ) { There are built-in PHP functions that assist with handling variable function parameters such as func_get_arg(), func_get_args(), and func_num_args() if you don't want to pre-define any however. > global $defined; > > db( $defined[9], $defined[1], $defined[2], $defined[3] ); > ... do some processing ... What does print_r( $defined ) show you? Is that what you expect to be in the array? -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I su to another account??
Do you really need to switch users or do you need to run something as another user? Try looking into setting up and using sudo. Ian On Thu, 2004-11-11 at 09:20 -0500, Scott Fletcher wrote: > How do I su (switch user) to another account from the nobody in php? I > haven't got it to work, so I get the impression that it is either I'm doing > it all wrong in PHP script or that the nobody doesn't have the authority to > do so. > > Have anyone who ever successfully do it please post a sample script? > > Thanks, > Scott > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] inline_C installation
Does anybody knows how to install a pear package. i have the inline_C package that i want to install and use. And can i have some sample functions using this package? Thank you - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
RE: [PHP] how come mysql_connect() doesn't work?
[snip] how come mysql_connect() doesn't work? What should i use instead to get me connect MySql. [/snip] Are you getting a specific error? Can you show us the code you are using? What version of PHP? Without this we cannot help you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how come mysql_connect() doesn't work?
how come mysql_connect() doesn't work? What should i use instead to get me connect MySql. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mssql_fetch_array() vs. mssql_fetch_assoc
Alex Hogan wrote: In terms of performance which is faster. mssql_fetch_array($var,mssql_assoc) or mssql_fetch_assoc()? I read in the manual that mssql_fetch_array() isn't noticably slower than mssql_fetch_row(), but I didn't see anything about mssql_fetch_assoc() in terms of performance. I was wondering if anybody already knew what the performance differences were. The last time I tried that type of test with mysql, the difference was so small, that I disregared the difference, and started using *_fetch_array() functions, for its versatility. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mssql_fetch_array() vs. mssql_fetch_assoc
In terms of performance which is faster. mssql_fetch_array($var,mssql_assoc) or mssql_fetch_assoc()? I read in the manual that mssql_fetch_array() isn't noticably slower than mssql_fetch_row(), but I didn't see anything about mssql_fetch_assoc() in terms of performance. I was wondering if anybody already knew what the performance differences were. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Arrays
Ben Miller wrote: edit I hope this is not a stupid question, but I am learning how to work with Arrays, and am having trouble figuring out how to move array values [the whole array and all of it's values] from page to page and/or store in a db. Array Example"); echo (""); for ($i=0; $i echo (""); } ##-- Add to the array? echo (""); echo (""); echo (""); echo (""); echo ("Current Array Elements:"); for ($i=0; $i".$array_variable[$i]); } echo (""); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
That is exactly the type of example I was in need of. Thanks a ton. Elixon wrote: I'm not certified expert ;-) but what I meant is Do not use function that writes to the hardcoded global variables: example: function db() { ... $GLOBALS['db']=x_open_something($GLOBALS['...'], ...); ... } This function is really... hm... not flexible enough ;-) It can make the job done well but... what if you need to open second connection? What if you have news data stored on other server or in defferent database under diferent user/password? Hm. What you will do? You probably create function db2(), yes? And what if you need to read page hit statistic from another database? ... db3()? ... db4()? Do you see the problem? 'functions' are pieces of GENERIC code doing the same thing with different input and resulting in possible different output... What you typed was not GENERIC - it was really one-purpose code that didn't need to be placed in function at all... You could simply include content of db() into your log() method and result would be the same... I recomend to go this way (I modified your code, I didn't test it so typos/mistakes can be there - just showing the idea)... /* User Defined Variables */ $defined = array( "host" => "localhost", "user" => "user", "pwd" => "password" ); $defined2 = array( "host" => "localhost2", "user" => "user2", "pwd" => "password2" ); logs(db($defined)); logsOnOtherMachine(db($defined2)); // Little bit more flexible so you can use it for other purposes as well /* Database connection */ function db($cfg) { if( connection_status() != 0 ) { $db = @mysql_pconnect( $cfg['host'], $cfg['user'], $cfg['pwd']) or die('connection problem...'); } return $db; } /* Logging function */ function logs($db) { global $defined; if (!$db) { trigger_error('Connection was not established!', E_USER_ERROR); return false; } $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM ...", $db ) or die( "problem..." ); // your stuff... } function logsOnOtherMachine($db) { ... } And if you would be really trying to dig in... have a look at OOP implementation in PHP... After the beginner's pain you will love it ;-) Hope I helped little. elixon -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Evaluate String as Object
Hi, Is it possible to evaluate a string passed to a script as an object? If, for example, I have the following executing in my script: $result = $player_1->execute_query(); // OR $result = $player_2->execute_query(); If I pass a value to a script in the following manner, say: $playername = $_GET["playername"]; Can I convert/evaluate this as an object, i.e.: $result = [VALUE-OF-$playername]->execute_query(); I'd rather not be in a position where I'm doing a raft of if/then statements Cheers, bub. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
I'm not certified expert ;-) but what I meant is Do not use function that writes to the hardcoded global variables: example: function db() { ... $GLOBALS['db']=x_open_something($GLOBALS['...'], ...); ... } This function is really... hm... not flexible enough ;-) It can make the job done well but... what if you need to open second connection? What if you have news data stored on other server or in defferent database under diferent user/password? Hm. What you will do? You probably create function db2(), yes? And what if you need to read page hit statistic from another database? ... db3()? ... db4()? Do you see the problem? 'functions' are pieces of GENERIC code doing the same thing with different input and resulting in possible different output... What you typed was not GENERIC - it was really one-purpose code that didn't need to be placed in function at all... You could simply include content of db() into your log() method and result would be the same... I recomend to go this way (I modified your code, I didn't test it so typos/mistakes can be there - just showing the idea)... /* User Defined Variables */ $defined = array( "host" => "localhost", "user" => "user", "pwd" => "password" ); $defined2 = array( "host" => "localhost2", "user" => "user2", "pwd" => "password2" ); logs(db($defined)); logsOnOtherMachine(db($defined2)); // Little bit more flexible so you can use it for other purposes as well /* Database connection */ function db($cfg) { if( connection_status() != 0 ) { $db = @mysql_pconnect( $cfg['host'], $cfg['user'], $cfg['pwd']) or die('connection problem...'); } return $db; } /* Logging function */ function logs($db) { global $defined; if (!$db) { trigger_error('Connection was not established!', E_USER_ERROR); return false; } $pagecount = "1"; $tble = "logs"; $sql = @mysql_query( "SELECT * FROM ...", $db ) or die( "problem..." ); // your stuff... } function logsOnOtherMachine($db) { ... } And if you would be really trying to dig in... have a look at OOP implementation in PHP... After the beginner's pain you will love it ;-) Hope I helped little. elixon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Programmatic Browser Rendering Engine?
I've seen screenshots of websites using Live website rendered and shown in an IFRAME scaled down to say.. 50% . IFRAME is your keyword I guess. However, your idea is realy creative. On Wed, 10 Nov 2004 13:39:00 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> wrote: > Please Cc: me, as it's been quite some time since I posted 50 emails per > day to this list... :-^ > > I'm interested in anybody's experience, good or bad, in what I am naively > coining as a "Programmatic Browser Rendering Engine": > > In an ideal world, it would be a PHP function definition not unlike this: > > > bool imagesurfto(resource image, string url, [int width, int height]); > > This function surfs to the given URL, as if a browser window the > dimensions (imagesx, imagesy) of image were opened to that URL, and places > in image a representation of what the user would see if they surfed to > that site. > > If width and height are provided, the surfing is done as if the browser > window were the provided width and height, and the result is then scaled > to fit into image. > > Example: > $image = imagecreatetruecolor(800, 600); > imagesurfto($image, 'http://php.net'); > header("Content-type: image/jpeg"); > imagejpeg($image); > ?> > > This displays what a user would see surfing to the PHP home page, if their > browser window was open to 800x600. > > $image = imagecreatetruecolor(400, 300); > imagesurfto($image, 'http://php.net'); > header("Content-type: image/jpeg"); > imagejpeg($image); > ?> > > This displays the same image as the first example, only scaled down to > half-size. > > > In my case, I have a GUI to admin a web-site by adding links, and I want > to give the user some Interface Feedback that the URL they have typed as a > destination for their link looks like what they expect. > > If this is all known technology and everybody is already doing it, please > tell me what everybody else has decided is the correct term for this, as > I've got No Clue. :-) > > I'm also very very very open to other ideas how to achieve my goal: > The user should see an image of what the link goes to, so they will notice > if it's not the right URL, as they edit/review their link choices. > > This could be useful in sites that allow administrators maintain a "Links > Page" semi-automatically. > > It could be particularly useful these days now that domain squatters and > speculators are taking over every expired domain and throwing a bunch of > advertisement/pay-per-click links on them. Just checking that a link is > valid is no longer "Good Enough" to know that you are linking to what you > want to link to. But that's only one portion of the problem I want to > address, so keeping an eye on domain expiration records would solve this > case, but not the more general issue. > > And, of course, if you somehow magically allowed another optional argument > of which browser to use... Wow! I could visually compare side-by-side the > images of what my layout looks like on all the browsers? Sign me up! > Okay, so this is probably NOT do-able. But the rest doesn't seem like it > should be that tricky... > > Hm. Does a frame allow a "scaling" factor? Might actually make me > want to use frames [shudder] if they do. > > PS If somebody familiar with, say, Mozilla, were to create a PHP function > such as I described above, you'd have instant fame and glory. Hint, hint. > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-I18N] How to get WIN-1255 encoded string
>From what I've seen, if someone mails me a correctly formatted message, I get the title right, however something like a non-standard mail clients does it, I get the =windows-1255 string you gave as the subject. Do note: The standard name is ISO-8859-8-I. NOT windows-1255, which is a nice micro$oft invention, but not something standard, which is why not each and every mail client will support it. I believe I did it "The Right Way" (TM) in my site by adding the following header to the mail() function: Content-Type: text/html; charset="ISO-8859-8-I" You might want to try that... it works for me everywhere (including in completely English mail clients under Linux) Shimi On Sun, 2004-11-07 at 13:57, Marina Markus wrote: > Hello, > > I am desperately looking for a solution of a problem that seems quite > simple. > > I need a PHP script to create an email message in a way that a subject line > in Hebrew will be readable in all mail clients. Some mail clients cannot > cope with Hebrew if they don't have character set explicitly denoted. > > Is there a possibility in PHP allowing to encode a string > with WIN-1255 character set encoding? The result should look like: > > =?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?= > > which the mail client then is able to decode back into Hebrew. > > If anyone has a solution for another character set, I suppose it can also > help. > > Will be grateful for any hint or idea. > Marina Markus > [EMAIL PROTECTED] > > -- Never forget that: 1. "Sure UNIX is user-friendly! It's just picky about who its friends are!" 2. "The day that Microsoft make a product that doesn't suck, is the day they start making vacuum cleaners.." 3. "Windows is a 32bit port for a 16bit GUI for an 8bit OS made for a 4bit CPU by a 2bit company that can't stand 1bit of competition!"
Re: [PHP] passing resources from one script to another
Thanks Greg. That is what I'm doing. The problem remains passing a resource to the script executed by exec. Ian On Thu, 2004-11-11 at 08:45 -0600, Greg Donald wrote: > On Thu, 11 Nov 2004 15:15:56 +0100, Ian Firla <[EMAIL PROTECTED]> wrote: > > The problem is the dialogue with the client. If I enter into a while > > loop then the whole script remains occupied and cannot accept new > > connections. > > PHP doesn't have threads.. and that's what you would need to accept > more than a single connection at once. You can simulate thread > functionality to a degree using the PHP execution functions here: > > http://www.php.net/manual/en/ref.exec.php > > > -- > Greg Donald > Zend Certified Engineer > http://gdconsultants.com/ > http://destiney.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing resources from one script to another
I should have specified that this is a shell script, not a web application. I have a listening process running. The listening process calls another script once a connection is established. This is done via exec. It works; however, I can't pass a resource directly to the other script. Therefore, I've passed the resource to "serialize()" and pass the resulting string to the other script as an argument. My idea was to "unserialize" the string in that script. I expected to get a resource back; unfortunately, I get an integer. My question is: is there any way to pass a Resource between scripts? Ian On Thu, 2004-11-11 at 15:36 +0100, Sebastiano Cascione wrote: > I'm not shure to understand what you are looking for... > > You can build a message queue into a text file, every message in the queue > will contain the pid as identifier of every socket connetion (the client) and > the target pid. > This is not a fast solution, but it models a messages system that is > indipendent from the server. For example, this queue colud be readed from the > client every time it launchs an avent, ect.. > > A question, why don't use session vars? (or an array of them?) > > Sebastiano > > > Alle 15:15, giovedì 11 novembre 2004, Ian Firla ha scritto: > > Hi All, > > > > I'm developing a small server application that accepts connections on a > > socket and then launches an interactive session with the client. > > > > The server needs to be able to accept N connections. This part is > > working famously thanks to code I've borrowed and modified from: > > > > http://www.zend.com/lists/php-dev/200205/msg00286.html > > > > The problem is the dialogue with the client. If I enter into a while > > loop then the whole script remains occupied and cannot accept new > > connections. > > > > If I try to open a new background process with exec, then I need to pass > > a resource from the listening script to the dialogue script. However, it > > seems that I cannot pass a resource between scripts. > > > > If I serialize the resource, passing it as a string to the dialogue > > shell script, then unserialize it in the dialogue script, it's no longer > > a resource but an integer... > > > > Any ideas on how to get around this problem? Can it be done with PHP? > > > > Ian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing resources from one script to another
On Thu, 11 Nov 2004 15:15:56 +0100, Ian Firla <[EMAIL PROTECTED]> wrote: > The problem is the dialogue with the client. If I enter into a while > loop then the whole script remains occupied and cannot accept new > connections. PHP doesn't have threads.. and that's what you would need to accept more than a single connection at once. You can simulate thread functionality to a degree using the PHP execution functions here: http://www.php.net/manual/en/ref.exec.php -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I su to another account??
Well if you are using apache as your webserver you can use a module which supports this feature... mod_chroot, mod_ruid or mod_suid2 is what you want. Or just as a suggestion if you don't want to change the running environment of apache I recommend having your script set a flag (temp file or something) then write a shell or php script running through a cron job to check for the temporary file before it executes. Scott Fletcher wrote: How do I su (switch user) to another account from the nobody in php? I haven't got it to work, so I get the impression that it is either I'm doing it all wrong in PHP script or that the nobody doesn't have the authority to do so. Have anyone who ever successfully do it please post a sample script? Thanks, Scott -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I su to another account??
How do I su (switch user) to another account from the nobody in php? I haven't got it to work, so I get the impression that it is either I'm doing it all wrong in PHP script or that the nobody doesn't have the authority to do so. Have anyone who ever successfully do it please post a sample script? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing resources from one script to another
Hi All, I'm developing a small server application that accepts connections on a socket and then launches an interactive session with the client. The server needs to be able to accept N connections. This part is working famously thanks to code I've borrowed and modified from: http://www.zend.com/lists/php-dev/200205/msg00286.html The problem is the dialogue with the client. If I enter into a while loop then the whole script remains occupied and cannot accept new connections. If I try to open a new background process with exec, then I need to pass a resource from the listening script to the dialogue script. However, it seems that I cannot pass a resource between scripts. If I serialize the resource, passing it as a string to the dialogue shell script, then unserialize it in the dialogue script, it's no longer a resource but an integer... Any ideas on how to get around this problem? Can it be done with PHP? Ian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Sebastian Mendel wrote: Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] ) or die(); is this a typo??? @mysql_pconnect( $defined[9] shouldnt it be @mysql_pconnect( $defined[0] Sorry, yeah it is a typo and? is it a typo in the message or in your source and solves this typo your problem? a typo in the email... -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: find duplicated values in array and count them
Patrick Fehr wrote: Hi all I need to compare values of multiple arrays, the tricky thing: I can't just use array_diff, because I also need to count all the occurences and give them back. The more tricky thing: It's a foreach loop through $arr[x ['comparable value'] while x is 1,4,3,6... so it's not that easy to compare one item in the array under index 4 with the next one(which is in 3) because foreach just loops. The idea is: If two keys of different arrays hold the same value, I want to just show one entry and tell the same time, how often it occurs(in other arrays), so I don't show all the entries(as I would, if they weren't the same. But it is still a bit more complicated, because: only if the date_s value lies 7 days from each other, I want to "concatenate" them to one entry + show the number of occurences. In the example below, the lessons 18 and 15 fit that need. so I want them to be shown as: [room] : Raum1 [teacher] : Marianne [class] : SundayClass starttime : 1099404000 (which is Array[19][date_s]) endtime : 099418400 + 7*24*60*60 (which is Array[15][date_e]) occurences : 2 eg --> print_r($my_big_array) shows: Array ( [7] => Array ( [name] => course1 [comment] => my bad comment [lessons] => Array ( [14] => Array ( [room] => Raum2 [teacher] => Andrew [class] => Team2 [date_s] => 1100796900 [date_e] => 1100805000 ) ) ) [3] => Array ( [name] => test [comment] => testing [lessons] => Array ( [19] => Array ( [room] => Raum1 [teacher] => Marianne [class] => SundayClass [date_s] => 1099404000 [date_e] => 1099418400 ) [15] => Array ( [room] => Raum1 [teacher] => Marianne [class] => SundayClass [date_s] => 1099404000 + 7*24*60*60 [date_e] => 1099418400 + 7*24*60*60 ) [13] => Array ( [room] => Raum1 [teacher] => Peter [class] => Team1 [date_s] => 1100798160 [date_e] => 1100803500 ) ) ) loop through all and create a new array foir counting foreach ( your arrays to serach for as $array) { counts[$array['room']][$array['teacher']][$array['class']]++; // or by whatever is relevant for you } -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Shell_exec timeout question
HI, Does anybody know if its possible to execute a command through exec, shell exec, system and if the program doesn't terminate in N seconds returns control to PHP ? Thanks in advance Rui Francisco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] ) or die(); is this a typo??? @mysql_pconnect( $defined[9] shouldnt it be @mysql_pconnect( $defined[0] Sorry, yeah it is a typo and? is it a typo in the message or in your source and solves this typo your problem? -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: header variable ?
Jerry Swanson wrote: What variable "header" use? If I send something in header, what GLOBAL variable header use? do you mean $_SERVER ? $_SERVER holds some header-information sent by the client to the webserver -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Sorry, yeah it is a typo Sebastian Mendel wrote: Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] ) or die(); is this a typo??? @mysql_pconnect( $defined[9] shouldnt it be @mysql_pconnect( $defined[0] -- Jason Gerfen [EMAIL PROTECTED] "And remember... If the ladies don't find you handsome, they should at least find you handy..." ~The Red Green show -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: LINUX: Problem with php installation
Abhilash Kumar wrote: I installed latest version of PHP from the source on a AMD ATHELON64 system with REDHAT 9.0 installed with apache server 2. There were no error upon running "configure" or "make" or "make install" I have checked the instalation procedures many times now but I get a blank screen on the mozilla browser. Upon viewing the source it shows the source of a blank html page. The server works well with html pages. Only the problem is with any php page. I have made the mentioned additions to be done in the httpd.conf file namely LoadModule and AddType. The error log file is showing "Segmentation fault". try without modules if it works try one module check again and so on... -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] should basic data validation go outside a function or inside?
Brad Pauly wrote: should basic data validation come before a function call or be performed within the function? I would do the validation inside the function. This avoids repeating the validation everywhere the function is called. It also makes the function more self-contained. It expects a certain input and complains, or returns false, if it doesn't get it. yes, and of course shouldnt every function check it parametres before proceeding? -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on functions
Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "2" => "password" ); /* Database connection */ function db() { global $defined; if( connection_status() != 0 ) { $db = @mysql_pconnect( $defined[9], $defined[1], $defined[2] ) or die(); is this a typo??? @mysql_pconnect( $defined[9] shouldnt it be @mysql_pconnect( $defined[0] -- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling a C program from php
You must write a PHP extension which calls the function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling a C program from php
--- Rayan Lahoud <[EMAIL PROTECTED]> wrote: > does anybody knows how to call a C function from a php code? Try this: http://pear.php.net/package/Inline_C Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming February 2005http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for pointers to mysql functions
- Original Message - From: Stuart Felenstein <[EMAIL PROTECTED]> Date: Thursday, November 11, 2004 7:13 am Subject: Re: [PHP] Looking for pointers to mysql functions > > --- [EMAIL PROTECTED] wrote: > > > This would be handled in your query, so get a SQL > > book or look into the mysql documentation... > > > > Look at the select statement, to request specific > > fields, as well as the Limit keyword to return a > > certain number of results per page. > > -B > > > > So there is no php code I need to know to get returns > on my query statement ? > > Stuart Depends on what you want to do If you have a table with an ID, name, addr, phone for instance and you only what the Name and phone then you could handle it in your query with: "select name, phone from table" OR you could handle it in PHP with: $result = mysql_query("Select * from table"); while($row = mysql_fetch_row($result) { echo "row[1] - $row[2]"; } Perhaps a more meaningful question would lead to a more meaningful answer. -B > > -- > 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] Looking for pointers to mysql functions
--- Graham Cossey <[EMAIL PROTECTED]> wrote: > Is this something like what you are after: > > $sql = "SELECT col1, col2, col3, col4 as colx, col5 > FROM my_table > WHERE col2 LIKE '%$search%' > ORDER BY col3 > LIMIT $from, $max_results"; > > $result = mysql_query($sql) or die ("Query failed: " > . mysql_error()); > while($row = mysql_fetch_assoc($result)) > { > ?> > > > > > } > ?> > > For details on how to do the x rows per page with > previous and next see > > http://www.phpfreaks.com/tutorials/43/0.php > or > http://www.phpfreaks.com/tutorials/73/0.php > > HTH > Graham > Yes, I think this is it. I appreciate the link to the rows per page thing! Very helpful as always! Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling a C program from php
Hello, does anybody knows how to call a C function from a php code? Thank you!! :) - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
RE: [PHP] Looking for pointers to mysql functions
> -Original Message- > From: Stuart Felenstein [mailto:[EMAIL PROTECTED] > Sent: 11 November 2004 11:32 > To: [EMAIL PROTECTED] > Subject: [PHP] Looking for pointers to mysql functions > > > I'm building a search function and I think most of the > search part is solid. > > Now I'm trying to figure out the results part. > Since my results would return about 7 fields per > record, I'm thinking mysql_fetch_row over mysql > results works better ? > But I don't want every field from the row returned, > only specific ones. > Also, I want to allow for all records that meet > criteria to be returned, and will set up a user > variable, so they can choose how many records per page > come back. > > Can anyone share some ideas or pointers to > documentation that will allow me to set this up ? > > Very much appreciated! > Stuart > Is this something like what you are after: For details on how to do the x rows per page with previous and next see http://www.phpfreaks.com/tutorials/43/0.php or http://www.phpfreaks.com/tutorials/73/0.php HTH Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for pointers to mysql functions
--- [EMAIL PROTECTED] wrote: > This would be handled in your query, so get a SQL > book or look into the mysql documentation... > > Look at the select statement, to request specific > fields, as well as the Limit keyword to return a > certain number of results per page. > -B > So there is no php code I need to know to get returns on my query statement ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for pointers to mysql functions
This would be handled in your query, so get a SQL book or look into the mysql documentation... Look at the select statement, to request specific fields, as well as the Limit keyword to return a certain number of results per page. -B - Original Message - From: Stuart Felenstein <[EMAIL PROTECTED]> Date: Thursday, November 11, 2004 6:32 am Subject: [PHP] Looking for pointers to mysql functions > I'm building a search function and I think most of the > search part is solid. > > Now I'm trying to figure out the results part. > Since my results would return about 7 fields per > record, I'm thinking mysql_fetch_row over mysql > results works better ? > But I don't want every field from the row returned, > only specific ones. > Also, I want to allow for all records that meet > criteria to be returned, and will set up a user > variable, so they can choose how many records per page > come back. > > Can anyone share some ideas or pointers to > documentation that will allow me to set this up ? > > Very much appreciated! > Stuart > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php shell_exec_ timeout
HI, Does anybody know if its possible to execute a command through exec, shell exec, system and if the program doesn't terminate in N seconds returns control to PHP ? Thanks in advance Rui Francisco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zip_open + PHP 5
Nick Halstead wrote: I have just changed to PHP 5 as I wanted to extend the functionality of one of my projects to further use its OO. But I just discovered that one of the extensions available under PHP 4+ isnt included in the same way, The zip_open + other functions are not available under the configure options for PHP 5? I know zip is under the PECL and its compilable as an extension, but I cant find any documentation on how to include this into PHP 5? if its possible at all? Try this on the command line: pear install zip This downloads, compiles and installs the module. Then you need to add this line to your php.ini and restart apache: extension = zip.so If you are using windows then I can't help you, don't know how it works there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: __PHP_Incomplete_Class Errors...
Stephen Craton wrote: > I've been working on a script for a while now and it works perfectly on my > local machine. I'm using a couple of classes, mainly my database and users > classes. > After logging in, I assign a session variable to the user's row in the > database: $_SESSION['user'] = $db->row; > This works fine locally, but on my hosted machine, it settings the variable > to this: > __PHP_Incomplete_Class Object > ( > [__PHP_Incomplete_Class_Name] => users > [user] => > [loggedin] => 1 > [ip] => 12.222.81.78 > [db] => __PHP_Incomplete_Class Object > ( > [__PHP_Incomplete_Class_Name] => thedatabase > [host] => localhost > [user] => melchior_clients > [pass] => > [data] => melchior_clients > [linkid] => 0 > [res] => 0 > [num] => 0 > [row] => > [logger] => __PHP_Incomplete_Class Object > ( > [__PHP_Incomplete_Class_Name] => logger > [logdir] => logs/ > [fp] => > ) > ) > [logger] => __PHP_Incomplete_Class Object > ( > [__PHP_Incomplete_Class_Name] => logger > [logdir] => logs/ > [fp] => > ) > ) > For some reason, as far as I can tell, it's making every class variable to > __PHP_Incomplete_Class for some reason. The way I'm accessing the classes > via another class this something like this: > $db = new theDatabase; > $user = new Users; > $user->db = $db; > And then, within the class, I access it as such: > $this->db->query($sql); > This works perfectly on my local machine, but it gets all weirded once I > upload it. I have NO idea why or how to fix it. Does anyone have any ideas? > > Stephen Craton > [EMAIL PROTECTED] > IM: [EMAIL PROTECTED] > http://www.melchior.us > I had the same problem when storing objects in the session, this link will tell you how to solve your problem http://lists.evolt.org/archive/Week-of-Mon-20031027/150721.html rgs, Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for pointers to mysql functions
I'm building a search function and I think most of the search part is solid. Now I'm trying to figure out the results part. Since my results would return about 7 fields per record, I'm thinking mysql_fetch_row over mysql results works better ? But I don't want every field from the row returned, only specific ones. Also, I want to allow for all records that meet criteria to be returned, and will set up a user variable, so they can choose how many records per page come back. Can anyone share some ideas or pointers to documentation that will allow me to set this up ? Very much appreciated! Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] zip_open + PHP 5
I have just changed to PHP 5 as I wanted to extend the functionality of one of my projects to further use its OO. But I just discovered that one of the extensions available under PHP 4+ isnt included in the same way, The zip_open + other functions are not available under the configure options for PHP 5? I know zip is under the PECL and its compilable as an extension, but I cant find any documentation on how to include this into PHP 5? if its possible at all? Any help would be greatly appreciated. Thanks, Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UPDATE: find duplicated values in array and count them
Patrick Fehr wrote: > Hi all > > > I need to compare values of multiple arrays The obvious problem is, that I can't use array_count_values() because the values are in different arrays, and array_count_values() refuses to compare over different arrays :) greets to all patrick -- Patrick Fehr Swiss Federal Institute Of Technology -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] find duplicated values in array and count them
Hi all I need to compare values of multiple arrays, the tricky thing: I can't just use array_diff, because I also need to count all the occurences and give them back. The more tricky thing: It's a foreach loop through $arr[x ['comparable value'] while x is 1,4,3,6... so it's not that easy to compare one item in the array under index 4 with the next one(which is in 3) because foreach just loops. The idea is: If two keys of different arrays hold the same value, I want to just show one entry and tell the same time, how often it occurs(in other arrays), so I don't show all the entries(as I would, if they weren't the same. But it is still a bit more complicated, because: only if the date_s value lies 7 days from each other, I want to "concatenate" them to one entry + show the number of occurences. In the example below, the lessons 18 and 15 fit that need. so I want them to be shown as: [room] : Raum1 [teacher] : Marianne [class] : SundayClass starttime : 1099404000 (which is Array[19][date_s]) endtime : 099418400 + 7*24*60*60 (which is Array[15][date_e]) occurences : 2 eg --> print_r($my_big_array) shows: Array ( [7] => Array ( [name] => course1 [comment] => my bad comment [lessons] => Array ( [14] => Array ( [room] => Raum2 [teacher] => Andrew [class] => Team2 [date_s] => 1100796900 [date_e] => 1100805000 ) ) ) [3] => Array ( [name] => test [comment] => testing [lessons] => Array ( [19] => Array ( [room] => Raum1 [teacher] => Marianne [class] => SundayClass [date_s] => 1099404000 [date_e] => 1099418400 ) [15] => Array ( [room] => Raum1 [teacher] => Marianne [class] => SundayClass [date_s] => 1099404000 + 7*24*60*60 [date_e] => 1099418400 + 7*24*60*60 ) [13] => Array ( [room] => Raum1 [teacher] => Peter [class] => Team1 [date_s] => 1100798160 [date_e] => 1100803500 ) ) ) -- Patrick Fehr Swiss Federal Institute Of Technology -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php