[PHP] imap
Can I user php to create IMAP mailboxes? I'm using Cyrus and php and apache are running on the same computer as Cyrus. Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: imap
When trying to imap_connect to my local imap server, I get this error: Warning: Couldn't open stream {localhost:143} in /var/www/html/user/mail.php on line 2 can't connect: Any ideas? Thanks "Greg" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Can I user php to create IMAP mailboxes? I'm using Cyrus and php and apache > are running on the same computer as Cyrus. Thanks! > -Greg > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LDAP, check if exists before enter
Hi- Does anyone have any PHP code to check if a uid exists in a LDAP directory before it is entered? I can't quite get ldap_search to work. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php / unix functions
Hi- Is there a built in way, besides using exec and system, to get the output from commands like 'uptime' and 'df' on a linux system? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php / unix functions
I just want to display the output of 'uptime' and 'df' on a php page /Greg "Andy Turegano" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Well, what do you want them to do? > > > On Wed, 18 Dec 2002, Martin Towell wrote: > > > the only other way I know is to use: $output = `$cmd`; (ie, backticks) > > > > -Original Message- > > From: Greg [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, December 18, 2002 1:27 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] php / unix functions > > > > > > Hi- > > Is there a built in way, besides using exec and system, to get the output > > from commands like 'uptime' and 'df' on a linux system? Thanks! > > -Greg > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php / unix functions
OK, I lied :) I don't want the raw output, I want to be able to pick the parts of the output that I want and display that. Thanks -Greg "Martin Towell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > in that case, try passthru() > > -Original Message- > From: Greg [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 18, 2002 1:45 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] php / unix functions > > > I just want to display the output of 'uptime' and 'df' on a php page > /Greg > > "Andy Turegano" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Well, what do you want them to do? > > > > > > On Wed, 18 Dec 2002, Martin Towell wrote: > > > > > the only other way I know is to use: $output = `$cmd`; (ie, backticks) > > > > > > -Original Message- > > > From: Greg [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, December 18, 2002 1:27 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] php / unix functions > > > > > > > > > Hi- > > > Is there a built in way, besides using exec and system, to get the > output > > > from commands like 'uptime' and 'df' on a linux system? Thanks! > > > -Greg > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing a string
Hi- I'd like to parse the string returned by popen("uptime", "r");. The string that is returned is: 9:47am up 37 days, 16:24, 1 user, load average: 0.09, 0.02, 0.00 What I'd like is 5 strings...the first contains "37 days, 16:24", the second "1 user", the third "0.09", the fourth "0.02", and the fifth "0.00". Any easy way to do this? Thanks very much in advance! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checkboxes & php
If I have 3 checkboxes labeled "user", but each one has a seperate value, how do I get the values of each checkbox? For example, how would I tell if the following checkboxes are checked? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checkboxes & php
I want to be able to let people check multiple values. I want them to be given a list of usernames and check the ones they want deleted, so a radio button won't work. If you go to Yahoo mail and select more than one checkbox, you can delete more than one item. I looked at the source and all the checkboxes are called "Mid". Any ideas? /Greg "Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > why would you give them all the same name? I can see this for radio buttons > but not checkboxes. > > -Original Message- > From: Greg [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 24, 2003 3:27 PM > To: [EMAIL PROTECTED] > Subject: [PHP] checkboxes & php > > > If I have 3 checkboxes labeled "user", but each one has a seperate value, > how do I get the values of each checkbox? For example, how would I tell if > the following checkboxes are checked? > > > > > > > > > -- > 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] checkboxes & php
Ah, that's exactly what I was looking for. Thanks! I had the right PHP code, just didn't have the right html :) /Greg "1lt John W. Holmes" <[EMAIL PROTECTED]> wrote in message 00a201c2c3e8$6e2431d0$a629089b@TBHHCCDR">news:00a201c2c3e8$6e2431d0$a629089b@TBHHCCDR... > Or name them as an array, "user[]" so that you have a $_REQUEST['user'] > array. Checkboxes are a little pecular in how they come across into PHP. If > you search the archives you'll get some good examples. > > ---John Holmes... > > ----- Original Message - > From: "Richard Whitney" <[EMAIL PROTECTED]> > To: "Greg" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Friday, January 24, 2003 3:31 PM > Subject: Re: [PHP] checkboxes & php > > > > You need to give the checkboxes unique names like user1, user2 user3 > > > > RW > > > > Quoting Greg <[EMAIL PROTECTED]>: > > > > ### If I have 3 checkboxes labeled "user", but each one has a seperate > value, > > ### how do I get the values of each checkbox? For example, how would I > tell > > ### if > > ### the following checkboxes are checked? > > ### > > ### > > ### > > ### > > ### > > ### > > ### > > ### > > ### -- > > ### PHP General Mailing List (http://www.php.net/) > > ### To unsubscribe, visit: http://www.php.net/unsub.php > > ### > > ### > > > > > > -- > > Richard Whitney > > Transcend Development > > Producing the next phase of your internet presence. > > [EMAIL PROTECTED] > > http://xend.net > > 602-971-2791 > > > > -- > > 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] Re: NEWBIE: request querystring
$var = $_GET["varName"]; "Tim Haskins" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am crossing over from ASP to PHP and was wondering how to get the same > affect as request.questring ? Thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IFRAMES & PHP
Hi, I have a form with an IFRAME nested in it. When the form is submitted, I can't get the values of the checkboxes in the IFRAME, is there any way to do this? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES & PHP
Here's the basic layout of my html page, this isn't the real html, just the basic idea. Now inside iframetest.php I have a few check boxes that I want test.php to be able to access. Is there any way to do this? Thanks!! "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > --- Greg <[EMAIL PROTECTED]> wrote: > > Hi, I have a form with an IFRAME nested in it. When > > the form is submitted, I can't get the values of the > > checkboxes in the IFRAME, is there any way to do > > this? > > Well, I think (I could be wrong) you're looking at this > wrong. > > Forms submit to resources identified by URLs. You specify > this with the action attribute of the form tag. There is no > idea of frames here. > > If you mean that the resource that your iframe loads does > not have access to the form variables, then change your > action attribute to that resource, and then it will. > > Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES & PHP
Unfortunatly, that gets rid of the reason I have the iframe in there to begin with. I need a scrollable iframe with a set of buttons that perform certain actions at the top, that have to always be at the top. -Greg "Sean Burlington" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Greg wrote: > > Here's the basic layout of my html page, this isn't the real html, just the > > basic idea. > > > > > > > > > > > > > > > > > > > > > > > > Now inside iframetest.php I have a few check boxes that I want test.php to > > be able to access. Is there any way to do this? > > Thanks!! > > > > > > not directly .. > > the form does not 'contain' the iframe - in fact the iframe is a > different page ... > > so form elements within the iframe page will not be a part of the form > submission process > > you /might/ be able to do something with javascript inter-frame > communication - but I doubt you would want to (and the iframe doesn't > sound like a valid page which could cause problems) > > what would probably make more sense would be to make the 'html' page > include iframetest.php' > > html.php > -- > > > > > > > > > > > > - > > then you form elements will be properly contained within the form > > -- > > Sean > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES & PHP
But the buttons are outside of the iframe, so that no matter how large the frame gets, the buttons are always in the same place :/ -Greg "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000501c2c629$f98c8590$7c02a8c0@coconut">news:000501c2c629$f98c8590$7c02a8c0@coconut... > > Unfortunatly, that gets rid of the reason I have the iframe in there > to > > begin with. I need a scrollable iframe with a set of buttons that > perform > > certain actions at the top, that have to always be at the top. > > -Greg > > Then put the entire into the iframe. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IFRAMES & PHP
Thank you guys for all the help, I'll try a few of these things, if not I'll just redesign the page. -Greg "Adrian [EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message 00e001c2c631$b402e160$1a8f43d9@ADE2">news:00e001c2c631$b402e160$1a8f43d9@ADE2... > hmm.. it'll get real ugly with javascript,but this works with newer > browsers. > ...iframe has a name > ...main page has a hidden form field with id checkbox in the iframe has id > also > > iframe.php > > > > function submit_form(){ > > if(frames["myiframe"].document.getElementById("one").checked == true){//see > if the checkbox in iframe is checked > // if it is checked assign it's value to the hidden field in this page > document.getElementById("one_copy").value = > frames["myiframe"].document.getElementById("one").value; > } > document.form1.submit(); > } > > > > > if($_POST['test1']){ > echo $_POST['test1'] . '' . $_POST['one_copy']; > } > ?> > > > > > > > > > > > > iframetest.htm > > > > > > > > > > > - Original Message - > From: "John W. Holmes" <[EMAIL PROTECTED]> > To: "'Greg'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, January 27, 2003 5:31 PM > Subject: RE: [PHP] IFRAMES & PHP > > > > > Unfortunatly, that gets rid of the reason I have the iframe in there > > to > > > begin with. I need a scrollable iframe with a set of buttons that > > perform > > > certain actions at the top, that have to always be at the top. > > > -Greg > > > > Then put the entire into the iframe. > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP can create, but not delete
Hi- I'm having a problem with deleting a Cyrus IMAP mailbox. I can create the mailbox just fine. Any ideas on why I can't delete the mailbox? Here is some code that I got off this newgroup a few months ago: function deleteMailbox ($mailbox) { $existing_boxes = imap_listmailbox($this->stream, "{" . $this->imap["host$ if ( empty($existing_boxes) ) { $this->Error = "deleteMailbox(): mailbox does not exist."; return(false); } # Now we add the delete ACL to cyrus feature... if ( ! imap_setacl($this->stream, imap_utf7_encode($mailbox), $this->imap$ $this->Error = imap_last_error(); return(false); } if ( imap_deletemailbox($this->stream, imap_utf7_encode("{" . $this->imap$ return(true); } else { $this->Error = imap_last_error(); return(false); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP & JavaScript
I have a problem with 2 select multiple boxes in my PHP pages. In order for PHP to pass multiple values to a page that it is posted to, the name of the select box must have [] at the end of it. My problem is that when I do that for select1[] in my page that breaks the syntax of the JavaScript code that performs operations on it. Is there any way around this? I'm looking for either a PHP or a JavaScript solution. Thanks, Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & JavaScript
Thank you so much, that worked perfectly...I know it's off topic, but do you know how to automatically select all elements of a select multiple box and then submit the form using a submit button? Thanks! -Greg "John Nichel" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > document.forms[0].elements['select1[]'] > > Assuming the form is your first form on the page, reference the element > in JavaScript as above. > > Greg wrote: > > I have a problem with 2 select multiple boxes in my PHP pages. In order for > > PHP to pass multiple values to a page that it is posted to, the name of the > > select box must have [] at the end of it. My problem is that when I do that > > for select1[] in my page that breaks the syntax of the JavaScript code that > > performs operations on it. Is there any way around this? I'm looking for > > either a PHP or a JavaScript solution. > > Thanks, > > Greg > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undefined function - crypt()
I believe you need to have mcrypt installed. -Greg "Anthony Ritter" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Using MS Win98 / PHP /Apache > > I'm getting a undefined function error - crypt() > > The following scripts were taken from Larry Ullman's book on PHP on page > 60-61. > > Any advice would be helpful. > Thank you. > > Tony Ritter > .. > > //ullmanform.html > > > HTML Form > > > > First Name name=FirstName>Last Name > E-mail Address > Comments > > > > > > // ullmanpassword2.php > > > > Form Results/Using Strings > > > the data generated by "ullmanform.html". */ > > $FirstName = trim($FirstName); > $LastName = trim($LastName); > $Email = trim($Email); > $Comments = trim($Comments); > $Name = $FirstName . " " . $LastName; > print ("Your name is $Name.\n"); > print ("Your E-mail address is $Email.\n"); > print ("This is what you had to say:\n $Comments\n"); > $CryptName = crypt($Name); > print ("This is the crypt() version of your name: $CryptName\n"); > ?> > > > .. > > > Fatal error: Call to undefined function: crypt() > in c:\program files\apache group\apache\htdocs\ullmanpassword2.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check if a file has already be included
Is there any way to check if a file has been included / required already, and if not include / require it? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] check if a file has already be included
Thanks, forgot about that :) I'm a converted ASP programmer...ASP has no such ability. -Greg "Rick Emery" <[EMAIL PROTECTED]> wrote in message 013b01c2d6a1$2a599d70$0500a8c0@honeybee">news:013b01c2d6a1$2a599d70$0500a8c0@honeybee... > can you use: include_once("filename"); > > This way, if it wasn't included, it will be. If it was included, this statement is ignored. > - Original Message - > From: "Greg" <[EMAIL PROTECTED]> > To: <> > Sent: Monday, February 17, 2003 10:18 AM > Subject: [PHP] check if a file has already be included > > > Is there any way to check if a file has been included / required already, > and if not include / require it? > Thanks! > -Greg > > > > -- > 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, LDAP - Can't delete from more than 1 group
I'm using PHP to add users to my ldap directory. When I create a user they can be added to 1 or more groups. When that user is deleted, I want to remove them from all groups. The code I wrote only removes them from the first group, then gives an error for any other group. Here is the code, followed by the output. function removeFromGroup($toDelete, $ds, $ldap, $baseGroupdn){ $groupList = $ldap->ldapGetGroupList(); for ($i=0; $i<$groupList["count"]; $i++){ if (sizeof($groupList[$i]["memberuid"]) != 0){ foreach ($groupList[$i]["memberuid"] as $val){ if ($val == $toDelete){ $cnGroup = "cn=" . $groupList[$i]["cn"][0] . ",$baseGroupdn"; $info["memberUid"][] = $toDelete; echo "Deleting " . $toDelete . " from " . $cnGroup . ""; $r = ldap_mod_del($ds, $cnGroup, $info); } } } } } // end removeFromGroup and the output: Deleting testuser from cn=Administrators,ou=Groups,dc=test,dc=com Deleting testuser from cn=Users,ou=Groups,dc=test,dc=com Warning: LDAP: modify operation could not be completed. in /var/www/html/user/user_p.php on line 470 Deleting testuser from cn=Guests,ou=Groups,dc=test,dc=com Warning: LDAP: modify operation could not be completed. in /var/www/html/user/user_p.php on line 470 uid=testuser,ou=Users,dc=test,dc=com deleted... also, here's what is in /var/log/ldap Feb 19 10:32:58 Lunar slapd[5650]: conn=1938 op=2 MOD dn="cn=Domain Admins,ou=Groups,dc=test,dc=com" Feb 19 10:32:59 Lunar slapd[5650]: conn=1938 op=2 RESULT tag=103 err=0 text= Feb 19 10:32:59 Lunar slapd[14339]: conn=1938 op=3 MOD dn="cn=Domain Users,ou=Groups,dc=test,dc=com" Feb 19 10:32:59 Lunar slapd[14339]: conn=1938 op=3 RESULT tag=103 err=16 text=modify: delete values failed Feb 19 10:32:59 Lunar slapd[5648]: conn=1938 op=4 MOD dn="cn=Domain Guests,ou=Groups,dc=test,dc=com" Feb 19 10:32:59 Lunar slapd[5648]: conn=1938 op=4 RESULT tag=103 err=16 text=modify: delete values failed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Submit buttons
Is there any way that I can have a form submit to different pages depending on the submit button that is pressed? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Submit buttons
I'm horrible at javascript, does anyone have a script that will do this? Thanks again!! "Oliver Witt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Greg schrieb: > > > Is there any way that I can have a form submit to different pages depending > > on the submit button that is pressed? Thanks! > > dont use submit buttons, but buttons... (type="button") calling a script that > submits the form to whatever page you want it to. > Olli > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Authenticate against LDAP database
Hi- I'm using Samba and OpenLDAP with smbldap tools. I have users stored in the LDAP database that I would like my PHP pages to authenticated against. I have 2 fields for user passwords, lmpassword and ntpassword. How would I go about authenticating against one of these fields, preferably ntpassword. Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hashing in PHP
Hi, is there an easy way to get the lanman and md4 hash of a string in PHP? I know there's a md5() function, but can't find anything else. Thanks!! -Greg -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] _POST & _GET
Thanks everyone :) -Greg "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:001f01c289b9$bebdf3b0$7c02a8c0@;coconut... > > Hi- > > Can I use both _GET and _POST in the same php file? Thanks!! > > -Greg > > Yes, you can use both in your code, but only one method is going to be > valid when your page is requested by a user. A user can't request a page > with both a GET and POST request at the same time. > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MD4 and lanman hash
Hi- Does anyone know how I can craete md4 and lanman hashes with php? Thanks!! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cyrus / php
Does anyone know of a way to add cyrus users through php? I've looked at web-cyradm but that relies on mysql...Thanks again! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get the output from a program
Hi- Is there a way in PHP to execute a program and then have it pass its output back to PHP? Say I wanted to return the value that running "df" produced and put it in a web page? Thanks!! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get the output from a program
exec() worked jsut fine. Is there any drawback to using this? -Greg "Adam Williams" <[EMAIL PROTECTED]> wrote in message news:Pine.LNX.4.33L2.0211121138370.5968-10@;roark.mdah.state.ms.us... > actually, look up system() I think it would be better in your case. > > Adam > > On Tue, 12 Nov 2002, Greg wrote: > > > Hi- > > Is there a way in PHP to execute a program and then have it pass its output > > back to PHP? Say I wanted to return the value that running "df" produced > > and put it in a web page? Thanks!! > > -Greg > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trim strings
Hi- Is there return a string with it's first 10 characters stripped? Thanks. _Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse comma delimited file
Hi-\ Is there an easy way in PHP to parse a comma delimited text file that could be uploaded in a form? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse comma delimited file
Great, thanks...didn't see that one :) -Greg "Kevin Stone" <[EMAIL PROTECTED]> wrote in message news:176401c28c32$11cf7fe0$6601a8c0@;kevin... > You bet there is.. > > fgetcsv(); > http://www.php.net/manual/en/function.fgetcsv.php > > -Kevin > > - Original Message - > From: "Greg" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, November 14, 2002 3:57 PM > Subject: [PHP] parse comma delimited file > > > > Hi-\ > > Is there an easy way in PHP to parse a comma delimited text file that > could > > be uploaded in a form? Thanks! > > -Greg > > > > > > > > -- > > 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] Newbie Question
I have an app that worked with mySQL, but now I'm trying to make it use SQL Server. The function that connected to to the mySQL was: mysql_pconnect($db_host, $db_user, $db_pass) or die("Unable to connect to SQL server"); I tried to change it to "sql_pconnect($db_host, $db_user, $db_pass) or die("Unable to connect to SQL server");" but I get an error that the function doesn't exist. I'm sure it's something simple, but what's the php function that will let me connect to the SQL Server?
[PHP] spaces vs in form fields
I have a function which takes an integer (the id field for a record) and returns the corresponding full name of the person whose id matches the integer. The function constructs the full name by querying a table for the row which matches the id and then concatenating firstname, middlename, and lastname with a " " (space) between each. The name value is called $name. Once $name is gotten, it may appear under 2 conditions: as an uneditable displayed value, or as an editable value appearing on a form in an input text box. Whenever I simply display the value, it appears correctly, e.g., "John Paul Smith". However, when I display the value in an input text box on a form, only "John" appears. The odd thing is that when I view source, the full name appears in the HTML; it just doesn't render that way in IE/Opera. If I concatenate instead of " ", the full name appears correctly in the form field. That's fine but I have an inverse function which takes the full name and returns the id. This inverse function works when I use " " to concatenate names but it doesn't work when I use ! Ugh! What's up with that? Please REMOVE -NOSPAM from my email address when replying to me. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] testing
Just testing guys :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [ignore] testing connection
ignore please, just testing connection :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: readdir and opendir
Vincent Dupont wrote: Simple question : do readdir and opendir support opening HTTP urls ?? RTFM ! No it doesn't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $myobject->$$varname doens't work ??
Good luck, welcome to oop :) PHP 5 is great ! :D My favorites are __get() and __set() It allows a very flexible programmation and a very simple programmation when using huge objects correctly implemented. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange mails...
Each time I post a message on p.general, i receive two strange mails from ADVANCE CREDIT SUISSE BANK. What's this spam ? It looks like an auto-responder is subscribed on the newsgroup. Spammers really s*x ! Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $myobject->$$varname doens't work ??
Hello, I was just trying this but it doesn't work : class a { public $foo = "hello world"; } $obj = new a(); $varname = "foo"; echo $obj->$$varname; $bar = "this is working"; $varname = "bar"; echo $$varname; // display "this is working" as expected ?> Is it a bug or is it normal ? I didn't find anything about it in documentation (php4 / php5). Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR::DB is great but is sooooo SLOW !
Hello, I've just performed a few tests when using PEAR::DB and the results weren't good at all. If I compare a script using PEAR::DB with a script using standard functions (and which supports mysql, pgsql and sqlite databases), the script using PEAR::DB is 10 times slower than the other. In one of my projects, it slows down execution time to 0,7 sec per page ! Conclusion : if you want to use PEAR::DB package, you'll probably will have to use cache systems for scripts that may be request often. Am I the only one annoying by this loss of performance ? Because this is a huge loss in that case ! Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR::DB is great but is sooooo SLOW !
Greg wrote: Hello, I've just performed a few tests when using PEAR::DB and the results weren't good at all. If I compare a script using PEAR::DB with a script using standard functions (and which supports mysql, pgsql and sqlite databases), the script using PEAR::DB is 10 times slower than the other. In one of my projects, it slows down execution time to 0,7 sec per page ! (original exec time was 0.06 sec) Conclusion : if you want to use PEAR::DB package, you'll probably will have to use cache systems for scripts that may be request often. Am I the only one annoying by this loss of performance ? annoyed Because this is a huge loss in that case ! Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR::DB is great but is sooooo SLOW !
Grrr, i'm posting too fast ! Sorry for mistakes :) Hello, I've just performed a few tests when using PEAR::DB and the results weren't good at all. If I compare a script using PEAR::DB with a script using standard functions (and which supports mysql, pgsql and sqlite databases), the script using PEAR::DB is 10 times slower than the other. In one of my projects, it slows down execution time to 0.07 sec per page ! (original exec time was 0.006 sec) Conclusion : if you want to use PEAR::DB package, you'll probably will have to use cache systems for scripts that may be request often. Am I the only one annoyed by this loss of performance ? Because this is a huge loss in that case ! Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I mail unlimited in one click?
On Mon, 16 Dec 2002, wrote: >I wonder if I can mail 300 customers in one click? > >part of script: > >while($listrow = mysql_fetch_array($listresult)) { > >$recipient = $listrow[epost]; >$subject = "$subj"; >$message = "$mess"; >$headers .= "From: $admail\n"; >$headers .= "Reply-To: $admail\n"; >$headers .= "X-Mailer: PHP\n"; >mail($recipient, $subject, $message, $headers); >} > >or is there a limit? You may need to increase your max_execution_time, the default seems to be 30 seconds, pretty low for 300 emails: >cat `locate php.ini`|grep max_execution_time max_execution_time = 30 ; Maximum execution time of each script, in seconds -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Announcing open CVS for phpDocumentor project
Hello all, Josh Eichorn has just finished setting up an open cvs for the phpDocumentor project (http://www.phpdoc.org). To get a current cvs build, use this command: cvs -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot login don't enter a password, then cvs -z 3 -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot co phpdoc Take care, Greg Beaver -- phpDocumentor 1.2.0beta due out this week! http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: parse error
In addition to the other errors pointed out... I assume you want a loop. change while($row = mysql_fetch_array($response)); to while($row = mysql_fetch_array($response)) { Take care, Greg -- phpDocumentor http://www.phpdoc.org > while($row = mysql_fetch_array($response)); > > > echo(" width="274" height="43">"); > print ""; > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > >print($row["texto"] ."\n"); > > echo(""); > echo(""); > echo(""); > echo(""); > echo(""); > } > > ?> > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PEAR-DEV] Announcing open CVS for phpDocumentor project
Hi all, open cvs has been fixed. Use at will Take care, Greg "Jesus M. Castagnetto" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > It does not seem to be working at the moment. > > --- Greg Beaver <[EMAIL PROTECTED]> wrote: > > Hello all, > > > > Josh Eichorn has just finished setting up an open cvs for the phpDocumentor > > project (http://www.phpdoc.org). To get a current cvs build, use this > > command: > > > > cvs -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot login > > > > don't enter a password, then > > > > cvs -z 3 -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot co phpdoc > > I got: > > ... > U phpdoc/Documentation/Release-old/Release-1.1.0rc1 > U phpdoc/Documentation/Release-old/Release-1.1.0rc2 > cvs server: Updating phpdoc/Documentation/old > cvs server: failed to create lock directory for > `/opt/cvsroot/phpdoc/Documentation/old' > (/opt/cvsroot/phpdoc/Documentation/old/#cvs.lock): Permission denied > cvs server: failed to obtain dir lock in repository > `/opt/cvsroot/phpdoc/Documentation/old' > cvs [server aborted]: read lock failed - giving up > ... > > Seems like the repository is messed up. > > > = > --- Jesus M. Castagnetto ([EMAIL PROTECTED]) > > Research: > http://metallo.scripps.edu/ > Personal: http://www.castagnetto.org/ > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undocumented OOP feature/bug?
Use get_class($this) function Go() { if (!isset($this)) { echo 'Called Statically'; } switch(get_class($this)) { // note get_class is lowercase (which I think is a bug, but it hasn't changed, so oh well) 'a' : echo 'Called Dynamically'; 'b' : echo 'Called Statically'; } } or, is_a() to include descendants (PHP 4.2.0+ I think) function Go() { if (!isset($this)) { echo 'Called Statically'; } if (is_a($this,'a')) { echo 'Called Dynamically'; } else { echo 'Called Statically'; } } Incidentally, this ability to call other methods and operate on your own variables is in my opinion the greatest feature of PHP along with aggregation. It allows dynamic (runtime!) multiple inheritance, which is essential for the new version of a complex data-access project I'm working on constantly (http://calendar.chiaraquartet.net) Take care, Greg -- phpDocumentor http://www.phpdoc.org "Sean Malloy" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Consider the following code... > > class A > { > function Go() > { > switch (isset($this)) > { > case true: echo 'Called Dynamically'; break; > case false: echo 'Called Statically'; break; > } > } > } > > class B > { > function Go() > { > A::Go(); > } > } > > A::Go(); > $a = new A(); > $a->Go(); > > B::Go(); > $b = new B(); > $b->Go(); > > > My understanding is that the output should be: > > Called Statically > Called Dynamically > Called Statically > Called Statically > > Yet the output is actually: > > Called Statically > Called Dynamically > Called Statically > Called Dynamically > > > Now my question is, is this what was intended? > > It seems that if you call a static class from within a dynamic instance of a > class, the static class then decides $this should reference the class from > which the static class was called > > Anyone else come across this? > > It could be useful, but right now, its bloody annoying! I need a class to be > called from within another clas, and it needs to know wether it has had an > instance created, or wether it is being statically called, and now I'll have > to write some kludge code instead... > > > > > /// > // Sean Malloy > // Developer > // element > // t: +61 3 9510 > // f: +61 3 9510 7755 > // m: 0413 383 683 > /// > > DISCLAIMER: > © copyright protected element digital pty ltd 2002. > the information contained herein is the intellectual property > of element digital pty ltd and may contain confidential material. > you must not disclose, reproduce, copy, or use this information > in any way unless authorised by element digital pty ltd in writing > or except as permitted by any applicable laws including the > copyright act 1968 (cth). > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pass Variables
Use sessions, you can save the result of the previous form in a server-side variable, and it will still be there even if the user has a modem disconnect. http://php.net/session Take care, Greg -- phpDocumentor http://www.phpdoc.org "Stephen" <[EMAIL PROTECTED]> wrote in message 000b01c2b518$d8e4a1a0$0200a8c0@melchior">news:000b01c2b518$d8e4a1a0$0200a8c0@melchior... I want to make a function that passes all the variables in a form to the next form since the form has multiple steps. I thought about putting all the contents in an array but I'd have to name out each array which would take a while and then there's the global inside the function, but again, I'd have to list all of them out. Any other quick and simple way? Thanks, Stephen Craton http://www.melchior.us "What's the point in appearance if your true love, doesn't care about it?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re> Save Image?
If it were possible, it would likely be a javascript function, rather than PHP, because it would be controlled by the browser. Check the JavaScript navigator or window objects. # # # Hi all, I have a PHP page that returns products. My client wants to have a button beside each product that says "Download". When you click download, he wants the "Save Picture" Window box to automatically open and allow the viewer to select the location to save the image that he clicked "DownLoad" on. Is this possible with PHP? Thanks, __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parse source for braces
Hi Shawn, check out phpDocumentor, it has a class named Parser that does exactly what you need. You can get the latest release at http://sourceforge.net/projects/phpdocu nightly cvs builds are at http://developer.phpdoc.org/downloads In CVS, there are 2 parsers to choose from, and both are very stable, but the CVS build of phpDocumentorTParser is MUCH faster (up to 11 times faster depending on the filesize) but requires php 4.3.0. Look in phpDocumentor/Parser.inc and phpDocumentor/phpDocumentorTParser.inc in CVS, and in ./Parser.inc in the 1.1.0 release. You would only need to create an object with a method HandleEvent like: class receive { function HandleEvent($event,$data) { if ($event != PHPDOCUMENTOR_EVENT_NEWSTATE) { if ($data->getType() == 'function' && $data->name == 'someFunc') { $source = $data->getSource(); } } } } Then, modify Parser::parse() by changing the line: if ($this->p_flags['get_source']) { if ($pevent == PARSER_EVENT_FUNCTION) { $this->wp->retrievesource("function $word"); $this->p_flags['get_source'] = false; $this->p_flags['getting_source'] = true; } } to: if (true) { if ($pevent == PARSER_EVENT_FUNCTION) { $this->wp->retrievesource("function $word"); $this->p_flags['get_source'] = false; $this->p_flags['getting_source'] = true; } } Alternately, you can get the cvs build and use the new phpDocumentorTParser that takes advantage of PHP 4.3.0's stable tokenizer extension (http://www.php.net/tokenizer) to parse faster. The line to replace in that class is phpDocumentorTParser::parse(): if ($this->_pf_get_source) { if ($pevent == PARSER_EVENT_FUNCTION) { $this->_wp->retrievesource($word); $this->_pf_get_source = false; $this->_pf_getting_source = true; } } change to: if (true) { if ($pevent == PARSER_EVENT_FUNCTION) { $this->_wp->retrievesource($word); $this->_pf_get_source = false; $this->_pf_getting_source = true; } } Here's the complete code you need to write (except for the modifications above): getType() == 'function' && $data->name == 'someFunc') { $source = $data->getSource(); {do something with the source} } } } } $fp = fopen('/path/to/file.php','r'); $contents = fread($fp,filesize('/path/to/file.php')); $parser = new phpDocumentorTParser; // or $parser = new Parser; $receiver = new someFunc_receive; $parser->subscribe('*',$receiver); $parser->parse($contents, ''); // the other parameters are for phpDocumentor, you won't need them ?> You can also modify the Parser class to avoid publishing anything that isn't necessary, and speed things up for your specific case. It is possible to do some other method, but you need to be able to parse strings, and recognize functions in a class otherwise code like this will break your parser: In the end, you'll be forced to reinvent the wheel at great personal agony :). Go with phpDocumentor, and your life will be smooth sailing. Incidentally, the source returned by the phpDocumentorTParser is an array of tokens from the tokenizer, so the code will already be split up, if that is useful. If not, you can easily join the code back into a string using: $total = ''; foreach($source as $item) { if (is_array($item)) $item = $item[1]; // $item[0] is the token $total .= $item; } Take care, Greg -- phpDocumentor http://www.phpdoc.org "Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I need to parse some source code to find the contents of a specific > function. The only way I can think of is to load the source file into a > string find the function by name and parse the text in the string and find > the end brace of the function, made difficult by the existence of all the > other braces that may be there (if, while, switch, foreach, etc...). > Anybody have some code to do this??? > > function someFunc() { > > if(something) { >something... > } > > while(something) { >something... > } > > } // So I need the code from the beginning of the function to here > > TIA > -Shawn > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: htmlspecialchars() or htmlentities without destroying tags?
Hi Justin, You have to specify the list of tags you want preserved in an array, but this function from phpDocumentor will do it: /** * smart htmlentities, doesn't entity the allowed tags list * Since version 1.1, this function uses htmlspecialchars instead of htmlentities, for international support * @param string $s * @return string browser-displayable page */ function adv_htmlentities($s,$html_allowed) { $___htmltemp = array_flip($html_allowed); $___html1 = array(); foreach($___htmltemp as $tag => $trans) { $___html1['<'.$tag.'>'] = htmlentities('<'.$tag.'>'); $___html1[''] = htmlentities(''); } $_html = array_flip($___html1); } $result = htmlspecialchars($s); $entities = array_flip(get_html_translation_table(HTML_SPECIALCHARS)); $result = strtr($result,$_html); $matches = array(); preg_match_all('/()/U',$result,$matches); for($i=0;$ihttp://www.phpdoc.org "Justin French" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > Has anyone got a function or regexp floating around that will convert behave > like htmlspecialchars() or htmlentities() (eg converting & to &, " to > "e;, etc etc) BUT NOT DESTROY HTML TAGS? > > Eg: > > "hello" said Fred & Judy > > should become: > > "hello" said Fred & Judy > > NOT: > "hello" said Fred & Judy > > > > I guess it's stripped down or limited version of htmlspecialchars() or > htmlentities(). > > > Justin > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Hi Jean-Christian, see: http://www.php.net/manual/en/features.connection-handling.php Take care, Greg -- phpDocumentor http://www.phpdoc.org "Jean-Christian Imbeault" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Timothy Hitchens ) wrote: > > > > Set up output buffering on your page then if the page times out the > > buffer > > should be sent to the browser and that is loaded with your message. > > Ok. Is there another solution? > > The reason I ask is that in order to use your solution I would need to > redesign my pages (quite a few of them). > > I was hoping to be able to do something like this: > > if (timeout()) include("try_again.html"); > > Thanks, > > Jc > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
You can try that code. It looks like connection_timeout() is deprecated, however. You should probably use connection_aborted() and connection_status() http://www.php.net/manual/en/function.connection-status.php http://www.php.net/manual/en/function.connection-aborted.php Read the user notes in connection_aborted, there appear to be issues to take into account. Take care, Greg -- phpDocumentor http://www.phpdoc.org "Jean-Christian Imbeault" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Greg Beaver wrote: > > > > http://www.php.net/manual/en/features.connection-handling.php > > Nice! > > So if I understand correctly I need to: > > 1- register a shutdown function > 2- have this function check if it was called b/c of a conection_timeout() > 3- And if so have the function print out my timeout error message > > So in my script I could put something like this: > > function timeout_message() { >if ( connection_timeout() ) { > echo "server busy, try again later"; >} > } > > register_shutdown_function('timeout_message'); > > [rest of my script goes here ...] > > ?> > > If the script timesout then my error function is called. Is that about > right? > > Jc > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dynamic Regex
Hi Gerard, all the preg_* functions require delimiters surrounding regular expressions. $foo = '\[this\](.*?)that'; should be by default: $foo = '/\[this\](.*?)that/'; the code you tried uses # as the delimiter instead of /, an option preg_* allows Take care, Greg -- phpDocumentor http://www.phpdoc.org "Gerard Samuel" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > The example doesn't have to make sense, but Im looking for the correct > syntax for $foo. I was trying -> > $foo = '\[this\](.*?)that'; > $bar = 'the other'; > > $str = preg_replace($foo, $bar, $other_string); > > But that doesn't work. I came across an example where the syntax of > $foo is in -> > $foo = '#\[this\](.*?)that#'; > > The second syntax of $foo works. I was wondering on the meaning of # in > the string?? > > Thanks > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Dynamic Regex
hi Gerard, I didn't think you were complaining :) the problem is in [/url] $foo = '/\[url\]([a-z]+://.*?)\[/url\]/'; should be $foo = '/\[url\]([a-z]+://.*?)\[\/url\]/'; that "/" was ending the pattern, and so preg_* was trying to read "url\]/" as closing information, and probably giving an odd error about "u" not being appropriate that's why # worked, because there were no other # in the string. Hope that answers the question (properly this time!) Take care, Greg - Original Message - From: "Gerard Samuel" <[EMAIL PROTECTED]> To: "Greg Beaver" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 12:24 AM Subject: Re: [PHP] Re: Dynamic Regex > What you suggested is what I was trying before. My original example > was incorrect. > Here is an good example for the variable holding the pattern -> > $foo = '/\[url\]([a-z]+://.*?)\[/url\]/'; > This pattern would not work, but if I change it to > $foo = '#\[url\]([a-z]+://.*?)\[/url\]#'; > It does work. > > Not complaining but just trying to figure out why the first version > doesn't work for future references. > Thanks > > Greg Beaver wrote: > > >Hi Gerard, > > > >all the preg_* functions require delimiters surrounding regular expressions. > > > >$foo = '\[this\](.*?)that'; > > > >should be by default: > > > >$foo = '/\[this\](.*?)that/'; > > > >the code you tried uses # as the delimiter instead of /, an option preg_* > >allows > > > >Take care, > >Greg > >-- > >phpDocumentor > >http://www.phpdoc.org > > > >"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > >> The example doesn't have to make sense, but Im looking for the correct > >>syntax for $foo. I was trying -> > >>$foo = '\[this\](.*?)that'; > >>$bar = 'the other'; > >> > >>$str = preg_replace($foo, $bar, $other_string); > >> > >>But that doesn't work. I came across an example where the syntax of > >>$foo is in -> > >>$foo = '#\[this\](.*?)that#'; > >> > >>The second syntax of $foo works. I was wondering on the meaning of # in > >>the string?? > >> > >>Thanks > >> > >>-- > >>Gerard Samuel > >>http://www.trini0.org:81/ > >>http://dev.trini0.org:81/ > >> > >> > >> > >> > > > > > > > > > > > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] aggregation users?
Is anyone out there using the new aggregation functions on objects? Greg -- phpDocumentor http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HEEELP...please
$DOCUMENT_ROOT is now $_SERVER['DOCUMENT_ROOT'] unless register_globals is on. You need include $_SERVER['DOCUMENT_ROOT'].'/../lib/somefile.conf'; take care, Greg -- phpDocumentor http://www.phpdoc.org <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I absolutely cannot understand the include_path directive. > Can somebody, please, explain this? > I have a situation that I find absolutely incomprehensible: I moved my > experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or something), > apache 1.13 where thesite worked just fine to another box with FreeBSD 4.7 > running php4 v. 4.2.3, apache 1.13.27_1. > All of a sudden, I get the message: > Warning: Failed opening '/../lib/somefile.conf' for inclusion > (include_path='.:/usr/local/lib/php') in /usr/local/www/html/index.php on > line 6 > > I can find nothing in the httpd.conf files that could account for this; > there is no configuration in them for include_path. > > Obviously, the php file is being parsed correctly, but there is a problem > with the line : > include "$DOCUMENT_ROOT/../lib/somefile.conf". > > It works on one machine, but not on the latest version of php4 an apache. > > I see there are others on the net who have had this problem, but I have not > yet found an explanation or a cure. > > HELP please, > > PJ > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global to superglobal
<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Most of the variables should be fairly obvious, I should think. So, it > should not be too difficult to do some search & replace of stuff like the > $_SERVER['DOCUMENT_ROOT'] stuff. I suppose I could then try to run the > stuff with error reporting maxed out. > Does that seem about right or should I start with the error reports and go > at it one by one. Being terribly lazy, I suppose makes me want to find > shortcuts. > I understand laziness is also a sign of genius... :)) It will be best to start from the code and do search and replace (one by one, dont' try anything fancy or you might waste time undoing your "fixes"). Then finding things from error reports will be easier. Take care, Greg -- phpDocumentor http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP
Hi Jordan, If you are doing this to learn PHP, that is great, keep plugging. If you want to see working examples of the things you've described, there are a number of scripts out there, both in pear (pear.php.net) and at other repositories like phpbuilder.com and phpclasses.org. You would benefit from examining how other authors have solved the same problems even if you are simply trying to learn php Take care, Greg -- phpDocumentor http://www.phpdoc.org "Jordan Elver" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I'd recommend you make a separate database class and error class that each > > of your other classes access. That would make it the most modular and > > re-usable. > > > > ---John Holmes... > > I was hoping someone would say that :) > How could I code that though. I've only just started with OOP and don't > understand how I can inherit methods to classes? Is it a good idea to create > a new object within each class which, for example, needs to do database stuff > or should I inherit the methods? > > I haven't found any clear examples of this kind of OOP, only the real basics > (which I still need help with by the way :) ). > > Thanks for your help, > Jord > -- > Jordan Elver > Is your work done? Are all pigs fed, watered and ready to fly? -- David > Brent (The Office) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Get command line output
Does anyone know how to get certain parts of the output from an exec of a certain command? For example...if I run "w" I get this output: [root@Lunar]:~> w 11:02am up 56 days, 17:39, 1 user, load average: 0.07, 0.02, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0brpt-sh6-port214 11:01am 0.00s 0.27s 0.06s w Now what if I just want the infor on the 3rd line, and info about anyone else who is logged in, such as the username, the host, and the time without getting all the uptime and the header info? Thanks! -Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $object->function($parameter)->function();
Hi Chris, Zend Engine 2.0 supports this syntax, and will be included with PHP 5. You can read all about zend 2 and its other improvements at http://www.zend.com Greg -- phpDocumentor http://www.phpdoc.org "Chris McCluskey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED].. . Hi there, I've been using PHP for about 2 years now and absolutely love it! Our company uses it as our main development language, so far though, there is one thing that has been annoying me for a while now.. the following line of code will not work: $object->function1($parameter)->function2(); I receive a parse error when i try to call another function off of the object that function1 returns. I know this is possible in java: object.function1(parameter).function2(); VB: object.function1(paremeter).function2 and i'm sure C++, although i'm not too familiar with that language. My question is, will or is there any support for this kind of call in PHP? or is there another way that i should be doing it? as for now, here is my work around: $tmp =& $object->function1($parameter); $tmp->function2(); Thank you in advance! -Chris --- _ _ _ _ |'|(_)|_)(_)|_(_)`-, * * * Chris McCluskeyWeb Applications Engineer Modulus, LLC 1720 Willow Creek Circle, Suite 520 Eugene, OR 97402 Email: [EMAIL PROTECTED] Voice: +1 (541) 434-1024 Web..: http://www.modulusgroup.com <http://www.modulusgroup.com/> The contents of this transmission may be confidential in nature and should be directed only to the person to whom it is addressed. Do not read, copy, or disseminate this material unless you are the intended recipient. If this transmission reached you in error, please forward the e-mail to the sender to advise, then destroy the transmission you received. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Rather complex regular expression for the preg_match_all function
Hi, it would be MUCH faster and easier to debug if you wrote a parser. See the example parsers in phpDocumentor, download available at http://www.phpdoc.org Greg "Andreas Sheriff" <[EMAIL PROTECTED]> wrote in message 000701c2c272$6b13b870$[EMAIL PROTECTED]">news:000701c2c272$6b13b870$[EMAIL PROTECTED]... > Hi, > > I'm trying to construct a regular expression to find HTML open tags without > closing tags up to another of the same HTML open tag or a closing tag of a > different type that's no enclosed in the implied closing tag optional HTML > tag (for example doesn't require a closing tag. The closing tag is > implied and so is its body). > > For example, the HTML snippet: > > Test HTML > > This tag is ok > I want to find this p tag > and up to the next opening p tag > test > I want to find this one too > > > I don't want to find tags with a complete structure. > ex: This is a <p> tag with a complete structure > > Instead, I want to find the tag with no closing tag, up to the next > tag or a closing tag of any type that doesn't have an opening tag after the > initial found (not including this orphaned closing tag) > > Andreas Sheriff > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Select value for driopdown box
This line: $selected = $state == $sel_state ? "selected=\"selected\"" : ""; should probably be: $selected = (($state == $sel_state) ? "selected=\"selected\"" : ""); I haven't tested this correction, but have had to use the parentheses in my code many times to fix problems with using ? : Greg -- phpDocumentor http://www.phpdoc.org "Ben C." <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I tried to use the below but it does not work. Please help! > > -Original Message- > From: Michael Sweeney [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 22, 2003 10:29 AM > To: Ben C. > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Select value for driopdown box > > > Assuming that you know which state is selected before you build the > select list: > > $sel_state = $_REQUEST['state']; > > ... > > while($row = mysql_fetch_array($result)) { > $buyerid = $row['buyerid']; > $state = $row['state']; > $selected = $state == $sel_state ? "selected=\"selected\"" : ""; > > $option_block .= "". > "$state\n"; > } > > That will put the string "selected=\"selected\"" (xhtml compliant) into > the option statement for the state that was selected. > > ..michael.. > > On Wed, 2003-01-22 at 10:14, Ben C. wrote: > > I am using the query below to edit a record. I want to edit the field > which has a list of states in a dropdown box. I want to have the state > that is in the selected field shown as the selected state. How would I do > this? > > > > > > Query > > - > > > $sql = "SELECT * > > FROM $table_name > > WHERE buyerid = \"$buyerid\" > > "; > > > > $result = @mysql_query($sql,$connection) or die(mysql_error()); > > > > > > while ($row = mysql_fetch_array($result)) { > > $buyerid = $row['buyerid']; > > $state = $row['state']; > > > > $option_block .= "$state"; > > } > > > > $display_block = " > > > > > > $option_block > > > > ?> > > > > > > State > > > > > > > > > -- > Michael Sweeney <[EMAIL PROTECTED]> > Verisity Design, Inc > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good way to organize code using classes???
Be careful with aggregation, it is REALLY unstable in PHP 4.3.0. I get crashes of PHP left and right, when changing the most random things (like adding a comment in another part of the code separate from aggregation!!) Greg -- phpDocumentor http://www.phpdoc.org "Jeff Warrington" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tue, 28 Jan 2003 16:20:20 +0100, Maxim Maletsky wrote: > > > > > I use PHP classes extensively and very often use classes > within other classes. > > First off, I would make sure to take advantage of inheritence > as much as possible. I have heirarchies up to 4 deep for > some of my classes depending on how much specialization > I need while at the same time maintaining only one set > of code for functionality common to all subclasses. > > As for using classes within classes, I don't include > the classes within a class definition nor within > a method def. I include the class def in the class > file but outside the actual class {} statement. > > When I instantiate the class, if I will need the object > ref to pass to other classes or to other methods within > the calling class, I assign the initial object > instantiation to a class variable. That way any class > methods can have ready access to that class via the > ojbect reference stored in the class variable. > > Only when I know for sure that the use of a class will > be for one purpose do I include and instantiate within > a method. > > as always, YMMV depending on the structure of your project. > > NOTE: There is a set of new PHP functions that allow > a sort of dynamic multiple inheritence. You can look > here for info: > > http://www.php.net/manual/en/ref.objaggregation.php > > Jeff > > > > > "@ Nilaab" <[EMAIL PROTECTED]> wrote... : > > > >> Hello everyone, > >> > >> I want to be able to use objects to create my future pages. My goal is > >> to use methods of classes to make the original front-line script easier > >> to read, while all the processing is done with a simple call to the > >> different classes from a single class. Please read futher, as I'll get > >> to a point and to my question... > >> > >> I have many classes that do different tasks, like formValidator.class, > >> stringManipulator.class, db.class, fileManipulation.class, > >> template.class, etc (these are self-explanitory as their names suggest). > >> Then, I might have a class called category.class that adds, deletes, > >> edits, moves, and renames categories within the filesystem and database. > >> But I would have a front-line script called category.php that would call > >> the necessary methods of category.class at certain points, depending on > >> the task being done on a specific step. > >> > >> In other words I want category.class to call the other classes and do > >> something with them, then in turn I want category.php to call objects in > >> category.class for a specific task, such as: > >> > >> >> > >> // category.php > >> > >> include ("category.class"); > >> $cat = new category (); > >> $cat->addCategory($new_cat_name); > >> // or > >> $cat->editCategory($cat_name); > >> // or > >> $cat->deleteCategory($cat_name); > >> // or > >> $cat->moveCategory($cat_name); > >> // or > >> $cat->renameCategory($cat_name); > >> > >> ?> > >> > >> > >> My question is: > >> > >> How can I call a class within another class and do something with it? > >> Right now I'm doing it the most convenient way I know, which is > >> including other classes using the include() function within the methods > >> of the category.class. There is no multiple-inheritance allowed in PHP, > >> so I can only use inheritance on one class. > > > > Including new classes within the existing classes is not such a bad idea > > as it ensures you to have only the necessary classes called. > > > >> I am also extremely skeptical about creating too many classes at a time > >> in one script. Do the above examples degrade performance speed of the > >> script when I call too many classes? Also, isn't there a way to use > >> sessions to save created classes and then use them again for other > >> scripts without the need to make a new instance of the same class again > >> and again? > > > > yes, you can serialize/unserialize classes
[PHP] Re: Calling other php scripts from inside a php script.
Hi Jason, Better is to use $_POST if your form's method="post" or $_GET if your form's method="get" As long as the user type is available to the new page through a form variable, or request string like newpage.php?username=student, you can access it using $_REQUEST/$_GET/$_POST Take care, Greg -- phpDocumentor http://www.phpdoc.org "Jason Howlett" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I am new to PHP and I am writing a script that evaluates input from a form > then calls other PHP scripts depending on the input it receives. > > The login form is very simple and asks the user to enter a username and a > password. It is used by two types of users, students and supervisors. In the > PHP script I check to see what the value is for the username. If it equals > "student" I need to call a script that displays the information for the > correct student. Else a different script is called that allows the > supervisor to select a particular student. > > I am not sure how I can call these scripts to run from inside my current > script. > > I know that PHP includes can be used to display code from another script in > the current page but I need to call the scripts to run and the content > displayed in a separate new page. > > Any advice much appreciated! > > > Thank you > > > Jason Howlett > > > > _ > Stay in touch with MSN Messenger http://messenger.msn.co.uk > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Sessions Not Saving
On Mon, 3 Feb 2003, Jonathan Wright wrote: >Aside from this, PHP's running like a dream. I haven't had a single >problem (other than mail() not working, but I found that's because I use >/usr/sbin/sendmail, not /sbin/sendmail, so I'll just need to recompile). Recompile, why? How about a link? ln -s /sbin/sendmail /usr/sbin/sendmail -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Sessions Not Saving
> During the ./configure part of the installation, PHP checks for > sendmail, but only in /sbin/sendmail. If it doesn't find it, the > function mail() isn't complied in. > > I just get 'call to undefined function mail()' in x/y.php on z. Ok, make your link this way then: ln -s /usr/sbin/sendmail /sbin/sendmail -- Greg Donald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Documentation Help
Hi Hardik, You will find phpDocumentor useful in this endeavor. Check out http://www.phpdoc.org Greg -- phpDocumentor 1.2.0beta3 is out http://www.phpdoc.org "Hardik Doshi" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi Everyone, > > I worked on educational intranet and library management system. I did comment my code but i dont know how to document functional and technical specification as well as database schema. Can anyone help me how to start working on documentation part so other developer can easily understand of these massive projects. > > Thanks and really appreciate if someone can help me > > Hardik > > > > - > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How can I link to all BUT $PHP_SELF
Try this out (untested) (basename ($file) == basename ($_SERVER['PATH_TRANSLATED']))) Greg -- phpDocumentor 1.2.0beta3 is out http://www.phpdoc.org "ØYstein HåLand" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I use the following function to create links to files in the same catalog > (and format the link text): > > function createLink() { > $handle=opendir("."); > while ($file = readdir($handle)){ > if (($file == ".") || ($file == "..") || (ereg("index", $file) == > true) || ($file == basename ($PHP_SELF))) { continue; } > if(is_file($file)) { $files[] = $file; } > } > $link = sort($files); > foreach($files as $file) { > $linktext = substr_replace($file,'',0,3); > $linktext = substr_replace($linktext,'',-4); > $linktext = ucfirst($linktext); > echo " $linktext\n"; > } > return true; > } > > The part $file == basename ($PHP_SELF) is intended to not link to the > calling document, but this part doesn't work. So, what shall I do instead? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Learning PHP
Could anyone recommend a fast track for learning php for an experienced ColdFusion developer? I'm working my way through the tutorials on php.net and free2code.net, but they seem pretty kindergarten. Any advice?
Re: [PHP] calculating kilobytes
On Fri, 14 Feb 2003, joe wrote: >i searched and i tried and i failed. most of the functions dont work in safe >mode, some didnt do what i wanted (returned the whole drive size instead of >one directroy) etc. >my head hurts already and i think i am on the verge on nervous breakdown >because i have been trying to solve this problem for days so could >somebody please drop me a function here? >thank you... Most people who write code for other people on request are compensated in one form or another. This is a listserv, I doubt anyone here will do your work for you for free. This is place where people get _assistance_ with code they already attempted to write themselves. If you tried and failed already like you say, post your broken code and people will help you figure out your errors. That's pretty much how it works. Also, what you ask may simply not be possible in safe mode, but there's no way to tell since you posted no code. -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect
> What is the syntax to have php redirect to another web site? http://domain.com/";); ?> -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 Passwords (How it works?)
On Mon, 17 Feb 2003, Vernon wrote: >I'm thinking that the MD5 function more than likely encrypts a password to >store into a database, and when you log in using the MD5 function it will >simply encrypt the value being passed along again the same way. Now I'm >wondering what happens when I user has lost there password and needs to >retrieve it, there is no way to reverse the process is there? md5 is one-way encryption. I use a password 'hint' field in conjunction with md5. -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5
On Mon, 17 Feb 2003, Stephan Seidt wrote: >Well, something very important in php5 is ZendEngine2: >http://cvs.php.net/co.php/ZendEngine2/ZEND_CHANGES Looks like PHP5 will be a lot like java/c++ when released. Exception handling, true object support, and an inline debugger, oh my! When is the expected release date? Or is still too soon to tell still? Thanks, -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Data from DB
On Mon, 17 Feb 2003, Miguel Brás wrote: > >I have a table with users and passwords with over than 100 rows. >I have 7 specific users that I wanna display on a page, as well their data. > >How can I display this specific users on the page? You probably want to execute some SQL queries. Then the data that is returned you will want to place into an array. Then finally you will want to iterate over the array creating some html from each row for display. -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting files
On Mon, 17 Feb 2003, PR wrote: >How can I protect my php files among other files like templates >(.inc) and mysql config (config.inc) files being copied/read/imported (front >page)/used by other applications other than my >site... > >can this be done by htaccess? is so , could anyone point me into right >direction? The best way is to not allow anyone else access to your files to begin with. I assume you mean you are in a shared hosting environment? Your system administrators can and should have permissions setup so no one can mess with your stuff by default. If that is not the case, I'd move. What kind of system is it? If it's unix you can make use of chown and chmod to protect your stuff. If it's windows, I don't know. -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRR Function in PHP
On Mon, 17 Feb 2003, Jonathan Pitcher wrote: >This process involves an IRR Calculation. Or Internal Rate of Return. Sorry, I don't think there are any accountants lurking on the list, so please explain what the actual calculation for an IRR should be. -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function getting redeclared
Hi Erik, You may want to re-investigate using nested functions for this purpose, it seems a bit illogical. The main reason is that it clutters up the source. If you want a private function, use docblock tag @access private to let other users know that it should not be accessed directly, or wait for php 5 when you can declare a method to be private/protected. Having said that, if you are still into nested functions, try using if (!method_exists($this,'isValidPhoneNumber')) { .. } Greg "Erik Price" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I have a problem where I am getting the following error, and I was > wondering if anyone has seen this one before and can help me out. > > "Fatal error: Cannot redeclare isvalidphonenumber() (previously > declared in /home/bluekomo/public_html//classes/Registrant.class:360) > in /home/bluekomo/public_html//classes/Registrant.class on line 360" > > I have a script, "registration.php", which calls require_once on the > Registrant.class file mentioned in the above error message. The > Registrant::setPhone() method is called more than once. Since it is > called more than once, the function "isValidPhoneNumber()" defined > within setPhone() is defined more than once, which I suspect is the > source of the problem. Does PHP not allow you to define a function > within a function and then call the enclosing function more than once? > Here is the relevant section of code: > > 354 /** > 355 * sets the phone property > 356 */ > 357 function setPhone($phone) { > 358 // TODO: determine if these formats are acceptable > 359 // TODO: account for extensions (separate form field?) > 360 function isValidPhoneNumber($num) { > 361 $valid = false; > 362 if (preg_match('!\d{9,9}!', $num)) { > 363 $valid = true; > 364 } > 365 if (preg_match('!\(?\d\d\d\)?-?\s*\d\d\d-?\s*\d\d\d\d!', > 366 $num)) { > 367 > 368 $valid = true; > 369 } > 370 > 371 return $valid; > 372 } > 373 > 374 if (isValidPhoneNumber($phone)) { > 375 $this->phone = $phone; > 376 } > 377 } > > > I am using PHP 4.3.0 on a RedHat machine with Apache 1.3.x. > > Thanks for your help, it's been a while since I've used PHP! > > > Erik > > > > > > > > -- > Erik Price > > email: [EMAIL PROTECTED] > jabber: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Threading
On Tue, 18 Feb 2003, Bruce Miller wrote: >Will PHP allow multiple-thread execution? PHP4 does not have thread support. -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple ereg question
On Thu, 20 Feb 2003, Robert E. Harvey, M.D. wrote: >I'd like to verify input data transferred from a form and make sure it >is numeric data or null before my program executes. I am using this >syntax, which doesn't work: > >for ($i=1;$i<=3;$i++) >{ > if (ereg('[0-9]+','$_POST["gamt_$i"]')) > { > continue; > } > else >{ > die("Non-numeric data entered in grass entry field(s)."); >} >} Try changing '$_POST["gamt_$i"]' to $_POST['gamt_$i'] -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upgrade to 4.3.0 nearly doubled execution time
Hi, phpDocumentor is fully 30% faster (version 1.0.0, 1.1.0, 1.2.0beta2, cvs head) in PHP 4.3.0 than in PHP 4.2.3 on both linux and windows. The backend for my website is not noticeably faster or slower in PHP 4.3.0/4.2.3 and contains a good deal of database access to mysql. Greg -- phpDocumentor http://www.phpdoc.org "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes, I have noticed some performance issues as well, but we need to nail > it down better before we can start really going after this. Could we call > on the collective masses of php-general users to run some benchmark tests? > > Just build yourselves a libphp4.so for both 4.2.x and 4.3.x and switch the > LoadModule line back and forth to benchmark the two versions. Then use > something like http_load (http://www.acme.com/software/http_load/) to > check various simple scripts. We need to figure out if this is an > across-the-board performance problem or if it is one particular aspect > which has slowed down. > > -Rasmus > > On Sat, 22 Feb 2003, Jason k Larson wrote: > > > I'm betting this is related... > > > > I upgraded to 4.3.0 on my production linux servers and began to have > > serious socket connection issues. Rolling back to 4.2.3 cleared > > everything up. I also saw an increase in script execution times with > > 4.3.0, which became much better using 4.2.3. I noticed some very > > strange behavior which leads me to believe 4.3.0 is not stable, and > > shouldn't be used in a production environment. > > > > So, all I can suggest for now is to determine what it is you need, and > > if a newer version of PHP will suit, go for it. But stay away from > > 4.3.0 and 4.3.1 (which I've read up on and hasn't addressed any of these > > issues). > > > > Regards, > > Jason k Larson > > > > > > Rhett Livingston wrote: > > > I upgraded my development system from PHP 4.1.2 to PHP 4.3.0 last week and > > > the performance of my scripts took a dive. Specifically, the average time > > > to parse my scripts (time from executing first line of code to executing > > > first line after includes) went from about 100ms to about 200ms, and, very > > > oddly, my times to connect to an Oracle database also went up by about the > > > same margin. > > > > > > Switching back to 4.1.2 clears the problem back up. > > > > > > What changed between 4.1.2 and 4.3.0 that could cause this? File IO stuff > > > perhaps? Any ideas to solve it? > > > > > > Thanks, > > > Rhett Livingston > > > > > > I'm running WinXP Pro, IIS, PHP as a CGI, and Oracle 9.2. > > > > > > > > > > > > > > > > > -- > > 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] Newbie Question
Can someone explain why this code works on the hosting company's server, but won't run on my local server? I'm not sure what version is on the host server, but I'm running 4.0.5 locally on winXP Pro. The error says: Fatal error: Cannot redeclare dbfield() in c:\inetpub\wwwroot\livinginnaples\database.php on line 30 7.class DBField 8.{ 9. var $name; 10. var $type; 11. var $table; 12. var $title; 13. 14. var $size; 15. var $rows; 16. var $maxlength; 17. var $value; 18. var $prefix; 19. var $postfix; 20. var $display; 21. 22. function DBField() 23. { 24. $name = ""; 25. $table = ""; 26. 27. $this->display = true; 28. } 29. 30. function DBField( $name, $table, $size, $value ) 31. { 32. if( $size == "" ) $size=20; 33. $this->display = true; $this->name = $name; $this->table = $table; $this->size = $size; $this->rows = 5; $this->value = $value; $this->title = ucwords( $name ); } function display() { if( !$this->display ) return; $prefix = str_replace( "[TITLE]", $this->title, $this->prefix ); echo $prefix; switch( $this->type ) { case "blob": ?> value ?>value != "" ) $time = strtotime( $this->value ); else $time = strtotime( "now" ); ?> ">/">/"> postfix . "\r\n"; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] solution to bad phpDocumentor tarball in windows
Hi all, We have finally isolated the problem with bad tarballs of phpDocumentor releases in windows. The tarball is fine. A user who was getting files with cut off names was unzipping using PKzip, switched to Winzip and the tarball extraction worked! Here's the complete information: Thanks for the suggestion; this solves the problem, though I suggest adding a note to the installation instructions warning people of this possible problem. The program I originally used to unpack was: PKZIP for Windows 32 Version 2.60 (which is the version installed on each machine here). I downloaded a trial version of: WinZip 8.1 which I unzipped things, and it works! Thanks! So, if you are a windows user, downloaded the tarball directly and tried to unzip it using pkzip, you need to use winzip Regards, Greg -- phpDocumentor http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 2 questions !
"Vincent M." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I didn't find in the doc how to: > - Know the full path of the current directory. Like /var/www/to/the/path try using dirname(__FILE__) or dirname($_SERVER['PATH_TRANSLATED']) > - Know under which user work apache, to know when I create a file whose > file it is... in unix, a safe installation will run apache as nobody. Greg -- phpDocumentor http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keeping existing data in textarea's
On Mon, 3 Mar 2003, Mirco Ellis wrote: >Hi, I have a developed a simple Helpdesk for our small company. When users >log calls they get an alert message warning them that they must fill in all >the fields if they have missed a field. At the moment if they happen to >forget a field, they receive the alert message, but then have to start all >over again. How do I keep the existing data in the textareas from >dissapearing after the alert message? $fill = isset($_GET['textareafield']) ? $_GET['textareafield'] : ""; $html = <<$fill EOF; -- Greg Donald http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] deciperhing oop
PHP 5 will allow your assumption, i.e. $db will resolve to the $db in the class namespace. If you also have a global variable named $db, you can refer to it using main::$db, instead of using the global statement. Pretty slick, if you ask me. By the way, check out PEAR's DB and MDB classes, http://pear.php.net/package-info.php?pacid=46 and http://pear.php.net/package-info.php?pacid=54 Greg -- phpDocumentor http://www.phpdoc.org "Larry Brown" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thank you everyone for helping. I didn't know you have to put $this-> in > front of all variables in the class. You learn something new every day ( I > thought you only needed to use that once to make the variable available > everywhere in the class up till now). > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > -Original Message- > From: Jim Lucas [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 6:50 PM > To: Larry Brown; PHP List > Subject: Re: [PHP] deciperhing oop > > the second argument in the mysql_select_db call in not in scope. > > you should be using $this->db instead of $db > > Jim > - Original Message - > From: "Larry Brown" <[EMAIL PROTECTED]> > To: "PHP List" <[EMAIL PROTECTED]> > Sent: Monday, March 03, 2003 2:52 PM > Subject: [PHP] deciperhing oop > > > > Can someone who is used to using php oop help me figure out why this > fails? > > I know there are probably a thousand classes already designed to do this > and > > probably 100 times more efficient, but this is how I learn. From what > I've > > read this should work but there is obviously something I'm missing. > > > > Quick problem description: > > Trying to set up class to connect to mysql db. Already used a procedural > > test successfully connecting to db. Error is displayed as... > > > > Warning: mysql_select_db(): supplied argument is not a valid MySQL - Link > > resource in /var/www/html/oop.php on line 67 > > Database Selection to main failed. > > > > Code: > > > > Class dbConnect > > { > > var $machine; > > var $port; > > var $user; > > var $password; > > var $query; > > var $result; > > var $dbase; > > var $db; > > var $sel; > > > > function dbConnect($machine,$port,$user,$password) > > { > > $this->machine = $machine; > > $this->port = $port; > > $this->user = $user; > > $this->password = $password; > > > > $db = mysql_pconnect ("$machine","$user","$password") > > if (!$db) > > { > > die ("Initial connection to DB failed.") > > } > > $this->db = $db; > > } > > function setDbase($dbase) > > { > > $this->dbase = $dbase; > > > > $sel = mysql_select_db("$dbase",$db); > > if(!$db) > > { > > die ("Database Selection to $dbase failed."); > > } > > } > > } > > > > $dbn = new dbConnect("localhost","3306","bob","hjhyt4kl5"); > > > > $dbn->setDbase("main"); > > > > > > > > > > > > > > So why can't I use $db? Isn't the statement $this->db=$db making it > > available to the setDbase function? > > > > Larry S. Brown > > Dimension Networks, Inc. > > (727) 723-8388 > > > > > > > > > > -- > > 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] Re:
Hi, You will benefit from enclosing all of the attributes in quotes, as in In addition, make sure your a name tag has a closing tag like Regards, Greg -- phpDocumentor http://www.phpdoc.org "Beauford.2002" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Not sure if this is a PHP or HTML problem, so I have posted it to both > lists. I have a table with with 5 itmes in which I want to click on and go > to a different part of the page. > > Click 1 > Click 2 > Click 3 > Click 4 > Click 5 > > Now this is where it gets interesting. > > I have a PHP script which loops 5 times. > > for ($i = 1; $i < 6; $i++) { > > Destination > > A bunch of of other code. > > } > > When I look at the source from my browser everything looks the way it should > be. I get , , etc. The problem is that when I click on > the link it does nothing. I get the little click noise, but that's it. > > Any ideas on this would be appreciated. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting error REG_EMPTY
Hi If $line is == '', you will get an error. Try @split('|', $line), or add a test for empty lines like if (empty($line)) continue; if you var_dump($line);, you'll probably see that there is an empty line in members.txt Regards, Greg -- phpDocumentor http://www.phpdoc.org "Richard Kurth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Way does this give me this error > > Warning: REG_EMPTY: in emailusers.php on line 52 > > > $lines = file("data/members.txt"); > foreach($lines as $line){ > list ($logged_email,$logged_title,$logged_first_name,$logged_last_name) = split("|", $line); > if ($logged_email==$email) {print "This email has already been registered."; > exit;} > } > > > this is what is in the members.txt file > > [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046828998|03/04/2003 > > -- > Best regards, > Richard mailto:[EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help with ?> vs. php?>
On Wed, 5 Mar 2003, LeTortorec, Jean-Louis wrote: >My pages starting and ending with "" don't work anymore. I would >have to change them to "". > >Do you know if there is a way for keeping "http://destiney.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a true statement false.
Mincu Alexandru wrote: On Fri, 2003-03-07 at 18:16, [EMAIL PROTECTED] wrote: Whenever I query a database with php I've always used the following code as a result. this way: if (!$row = mysql_fetch_array($result)) { do something } else { do seomthing else } It is simpler to do this: if ($row = mysql_fetch_array($result)) { do something else } else { do something } You would be well advised to use this syntax: if (!($row = mysql_fetch_array($result))) to ensure operator precedence is clear. (the equals followed by not) Regards, Greg -- phpDocumentor http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general@lists.php.net
Hi James, & is a bit-wise AND. && is a logical AND. The bitwise AND will return a number, the logical AND will return true or false boolean values. It's a subtle distinction, but important. 4 & 4 == 4 4 && 4 == true == 1 Regards, Greg -- phpDocumentor http://www.phpdoc.org James Taylor wrote: Ok, this may have already been posted to the list already, but the archives don't seem to like the & and && characters. I'm running into some code that looks like this: Define('INPUT', 2); if($search->level & INPUT) $tmp.= $search->input(); Ok, what's the & mean? As far as I could tell from the very little documentation I was able to scrape up on google, & is a bit-by-bit operator. Thus, if either INPUT or $search->level, we get TRUE... If that's the case, what's the point of using it instead of || ? Or, do I just totally not understand the point of this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php trouble
If register_globals is off echo $_GET['sort']; echo $_GET['var2']; Greg -- phpDocumentor http://www.phpdoc.org Ashley M. Kirchner wrote: Benny Pedersen wrote: how do i get var from a url like this one http://localhost/index.php?sort=name&var2=login In index.php: echo $sort; echo $var2; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More array syntax
Hi John, foreach ($var as $key => $value) { if (!$key) { $$key = filter_string($key.': ',$line); } } Regards, Greg -- phpDocumentor http://www.phpdoc.org John Taylor-Johnston wrote: I have an array $var (see structure below), which contains AN, AU, TI, PY ... etc. (28 in total - no teasing.) How can access these keys so I can do this: foreach key in $var until $var.length { if(!$something){$something = filter_strings("something: ",$line);} } So I can avoid doing this 28 times: if(!$AN){$AN = filter_strings("AN: ",$line);} if(!$AU){$AU = filter_strings("AU: ",$line);} if(!$TI){$TI = filter_strings("TI: ",$line);} if(!$PY){$PY = filter_strings("PY: ",$line);} ... and this 28 times. if($AN) {DisplayLine('AN',$AN);} if($AU) {DisplayLine('AU',$AU);} if($TI) {DisplayLine('TI',$TI);} if($PY) {DisplayLine('PY',$PY);} ... $var = array ( 'AN' => array ( 'Description' => 'ERIC_NO: (AN)', 'Input' => 'EricAN', 'Select' => 'SelAN', 'Option' => 'AN', 'Selected'=> 'AN «Annotation»' ), 'AU' => array ( 'Description' => 'AUTHOR: (AU)', 'Input' => 'EricAU', 'Select' => 'SelAU', 'Option' => 'AU', 'Selected'=> 'AU «Author»' ), 'TI' => array ( 'Description' => 'TITLE: (TI)', 'Input' => 'EricTI', 'Select' => 'SelTI', 'Option' => 'TI', 'Selected'=> 'TI «Title»' ), 'PY' => array ( 'Description' => 'PUBLICATION_DATE: (PY)', 'Input' => 'EricPY', 'Select' => 'SelPY', 'Option' => 'YR', 'Selected'=> 'YR «Year of Publication»' ), 24 more to go. ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form 2 PDF 2 Form
Hi Petre, Multipart forms are the solution you need. Here are the reasons why: 1) You can set the length of time that the session cookie will live (I've changed it to a week for the "Remember Me" feature of my website, works nicely) 2) if users are disconnecting, and not all information is being processed, then you can use register_shutdown_function() to catch this problem (i.e., if mid-processing, prior to database write, the user disconnects, the shutdown function will do any necessary cleanup). All you will need to do is have a flag variable that you set when necessary tasks have been completed. So, after form processing, set it to 1, after database write to 2, etc. The shutdown function would check this flag variable and then do the next steps if necessary. 3) even if they switch off the PC and try to start from scratch, all you need to do is use sessions and I would recommend using the HTML_QuickForm package from PEAR (pear.php.net) as the freeze() method will be VERY useful. Basically, when a field is complete and shouldn't be changed, you freeze it and it will display the value for the user, but not allow it to be changed. There is a large userbase for QuickForm and many people using it in multi-part forms who can answer your questions easily. 4) in the final review process, if you require the user to submit each sub-section as "OK" there will be no chance of losing more than a few minutes of work. In other words, the final review should also be multi-page, matching the original form. The user will understand this. Paper forms have more than one page, and you have to flip them back and forth, so if you model it that way, no one will have a real problem, even really computer-illiterate folks :). Regards, Greg -- phpDoocumentor http://www.phpdoc.org Petre Agenbag wrote: Hi Shiva Appreciate your input. Wrt the spanning of the form, I think, in my situation, it would actually make things worse... You see, my suspicion is that most of the users who are experiencing problems, have very bad connections, many complain that they lose connectivity while they are busy with the form ( it takes them maybe 30 min or so to fill out the entire form ( they basically transfer the data off paper forms they have filled out earlier while "on-site", so it's not really alot of data, but there are a lot of fields...) So, my fear with this approach is that they will maybe get past the first part of the form, submit that OK, then start getting trouble with subsequent parts, leaving me with a whole lot of partial entries in the DB., and how do I get them to "resume" at a a later stage? You don't understand the mindset of these people, when something goes wrong, they'll switch off their PC's and try to start from scratch, so it's going to be difficult to try and get them to understand the concept of multi-part forms... I shudder to even think what will happen, or worse, how I will be able to allow them to make corrections on a certain part of the form once they have submit it. And sometimes, to their defense, it's not them that want to change the details on the form, but the subject of the form who has decided to change their name etc... I'm not ditching this idea, I will definitely give it some more thought, it's just at this moment, my mind is running through my original idea of PDF forms trying to evaluate it. Each method will have it's pro's and cons, and I'll have to go and weigh them. I must add, I don't see "effort" as a con for a particular solution, as long as I know it will solve the problem without adding other cons... Thanks again, will take it up with you again ( need some more input on this PDF thing to get some balanced views) PS, if you have experience with using this method, I would appreciate it if you could let me have your "field notes" and how successfull it's working for you. You see, the main thing here is that I need to KNOW when someone who says they have submitted something actually have, and that they are not trying their luck... On Tue, 2003-07-01 at 13:43, Shivanischal A wrote: hi, seems u have complicated task on hand mate. cant u simply consider span the user input over multiple pages? i mean using 2 or more form on different pages instead of a single form on one single page. if this cant be done, we'll think of other measures. but this is by far the most simple method -shiva "Petre Agenbag" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi List OK, firstly, sorry if this has been on the list before... What I'd like to do is something like this: I currently have an app that takes user input via a normal html form, and then pops the content into mysql. The problem is that lots of user complain that the submit times out due to slow/bad connections, and hence the data gets lost.
Re: [PHP] Forms & PHP
On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie <[EMAIL PROTECTED]> wrote: [snip] By maintaining the POST (assuming you're using POST)variables and calling them into the form values when reloaded. If you go to the second page store the POST variables in hidden form input types, then grab them when the second page is POSTED. Does this make sense? Not enough caffeine for me yet...[/snip] So basically I need to have 2 versions of the first page, is that right? :) No, in your first form you have code like ; } else { $foo = $_POST['foo']; } ?> ... and in the second form you have: ... Cheers, Greg. -- Greg Wiley www.wileysworld.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phpDocumentor 1.2.1 release is imminent
Hello, Those of you who found bugs in release 1.2.0 (or 1.2.0a for those who used pear install), please acquire a copy of anonymous cvs, branch RELEASE_1_2_0, and verify that the bug has been fixed, we will be releasing the new version tomorrow or the next day. Anonymous CVS instructions are at http://www.phpdoc.org Regards, Greg -- phpDocumentor http://www.phpdoc.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php