php-general Digest 15 Oct 2004 10:29:28 -0000 Issue 3054

2004-10-15 Thread php-general-digest-help
php-general Digest 15 Oct 2004 10:29:28 - Issue 3054 Topics (messages 199541 through 199574): Re: include()ing into a variable 199541 by: Curt Zirzow Re: Help with sessions problem please 199542 by: John Holmes For how long session exist 199543 by: Jerry Swanson

[PHP] Re: How to optimize select of random record in DB ?

2004-10-15 Thread Matthew Weier O'Phinney
* -{ Rene Brehmer }- [EMAIL PROTECTED]: I made this code to pick a random record from a changeable number of records in a given table. I'm just curious if any of the more awake coders out there can see a way to optimize this for better performance, since there's several other DB queries on

Re: [PHP] How to optimize select of random record in DB ?

2004-10-15 Thread Gareth Williams
What about in MySQL: SELECT personID from persons ORDER BY RAND(NOW()) LIMIT 1 If the table is large, then the following might be better: LOCK TABLES foo READ; SELECT FLOOR(RAND() * COUNT(*)) AS rand_row FROM foo; SELECT * FROM foo LIMIT $rand_row, 1; UNLOCK TABLES; There's a whole discussion on

[PHP] PHP-CGI: custom 404 error?

2004-10-15 Thread Jared
I'm running PHP as CGI instead of as an apache module because my hosting 1) suggests it and 2) this way I can compile my own PHP with whatever options I want, including a custom php.ini. Works great except when I load a page that doesn't exist, such as foo.php, I get No input file specified.

RE: [PHP] problem with array

2004-10-15 Thread Graham Cossey
Hi guys, Recently, I had to reformat one of the web servers and now I have encountered an unusual problem. I am not sure whether this is an issue which can be fixed in the .ini file or whether its specific to the version of php I am using. Here is the problem: $query=SELECT * FROM

Re: [PHP] PHP-CGI: custom 404 error?

2004-10-15 Thread Christophe Chisogne
Jared wrote: foo.php, I get No input file specified. Instead of the standard 404 error. Is there a way to customize this? Easy with Apache [1,2], with en ErrorDocument [1] directive. Ex with this in a .htaccess (the FileInfo Override [3] is required) containing this line: ErrorDocument 404

[PHP] PHP App User Permissions Tecnique

2004-10-15 Thread Brendon
I am building a web based community forum type software using PHP. I am currently working on how different user privelages are handled. Each user is part of a group and each group has varying degrees of privelages. I need to add in functionality which at the begginning of every script check

Re: [PHP] PHP App User Permissions Tecnique

2004-10-15 Thread Yusuf Tikupadang
I think read from database better than from session, because it's more easy than usnig session. On Fri, 15 Oct 2004 00:41:31 -0700, Brendon [EMAIL PROTECTED] wrote: I am building a web based community forum type software using PHP. I am currently working on how different user privelages are

[PHP] PHP websites (www/uk/us2)

2004-10-15 Thread Graham Cossey
I was wondering what the difference is between the various PHP sites linked to in this list, are they mirrors and what determines which site you get directed to when doing a search from www.php.net? http://www.php.net http://uk.php.net http://us2.php.net and presumably others... Thanks

[PHP] Re: : [PHP] Problem with MSSQL

2004-10-15 Thread Yusuf Tikupadang
I don't know if this can running on mssql. select limit m,n No, mssql can't do that. the only solution that i have is using cursor, but I can't use codecharge to do that (and need much more time to develop). Thanks for your idea. Best Regards, Yusuf Tikupadang -- PHP General Mailing List

[PHP] Re: : [PHP] Problem with MSSQL

2004-10-15 Thread Yusuf Tikupadang
I don't know if this can running on mssql. select limit m,n No, mssql can't do that. the only solution that i have is using cursor, but I can't use codecharge to do that (and need much more time to develop). Thanks for your idea. Best Regards, Yusuf Tikupadang -- PHP General Mailing List

Re: [PHP] PHP App User Permissions Tecnique

2004-10-15 Thread Ian Firla
Definitely store them in a session. A db lookup will mean a much heavier and process intensive procedure. Ian On Fri, 2004-10-15 at 09:41, Brendon wrote: I am building a web based community forum type software using PHP. I am currently working on how different user privelages are handled.

Re: [PHP] PHP websites (www/uk/us2)

2004-10-15 Thread Yusuf Tikupadang
They're mirrors. On Fri, 15 Oct 2004 09:20:10 +0100, Graham Cossey [EMAIL PROTECTED] wrote: I was wondering what the difference is between the various PHP sites linked to in this list, are they mirrors and what determines which site you get directed to when doing a search from www.php.net?

[PHP] Re: PHP websites (www/uk/us2)

2004-10-15 Thread Lester Caine
Graham Cossey wrote: I was wondering what the difference is between the various PHP sites linked to in this list, are they mirrors and what determines which site you get directed to when doing a search from www.php.net? If you download you will be directed to a mirror, and that will then be used

RE: [PHP] PHP websites (www/uk/us2)

2004-10-15 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 15 October 2004 10:00, Yusuf Tikupadang wrote: They're mirrors. On Fri, 15 Oct 2004 09:20:10 +0100, Graham Cossey [EMAIL PROTECTED] wrote: I was wondering what the

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Gareth Williams
Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 substr($_POST['mobile_number'],0,3) != 447) { $error=Invalid Number; } On 15 Oct 2004, at 13:38, Shaun wrote: Hi, Could anyone help me with a reugular expression for a UK mobile phone number? So far I have tried

[PHP] SimpleXML: DOM, SAX or Other?

2004-10-15 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hi, Does anybody have any depthful knowledge of the SimpleXML extension in PHP5?.. More accurately, do you know if the simpleXml-xpath() method uses DOM, SAX or some other method of parsing a loaded XML document? I ask because I am trying to parse arbitrary XML documents as efficiently as

[PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Shaun
Hi, Could anyone help me with a reugular expression for a UK mobile phone number? So far I have tried this but with no success snip $regexp = /^447[0-9]{9}$/; if(!preg_match( $regexp, $_POST[mobile_number] )){ $error = Invalid Mobile Number; /snip The number nust be 11 numbers long, be

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Robert Cummings
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote: Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 substr($_POST['mobile_number'],0,3) != 447) { $error=Invalid Number; } This doesn't verify that the portion following 447 is also a number.

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Jason Wong
On Friday 15 October 2004 19:38, Shaun wrote: Could anyone help me with a reugular expression for a UK mobile phone number? So far I have tried this but with no success snip $regexp = /^447[0-9]{9}$/; if(!preg_match( $regexp, $_POST[mobile_number] )){ $error = Invalid Mobile Number;

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread John Nichel
Shaun wrote: Hi, Could anyone help me with a reugular expression for a UK mobile phone number? So far I have tried this but with no success snip $regexp = /^447[0-9]{9}$/; if(!preg_match( $regexp, $_POST[mobile_number] )){ $error = Invalid Mobile Number; /snip The number nust be 11 numbers

RE: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 15 October 2004 12:39, Shaun wrote: Hi, Could anyone help me with a reugular expression for a UK mobile phone number? So far I have tried this but with no success

[PHP] add item to end of (multidimensional) array

2004-10-15 Thread Arnold
Hi, How can i add new items to an array without using an index. Normally (single dimension) you can do: Arr[]=x and this item is added to the array, but what if i have subitems like: Arr[]['name']=arnold; Arr[]['address']=street. This last example doesnt work and i think there will be an

Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Robert Cummings
On Fri, 2004-10-15 at 08:34, Arnold wrote: Hi, How can i add new items to an array without using an index. Normally (single dimension) you can do: Arr[]=x and this item is added to the array, but what if i have subitems like: Arr[]['name']=arnold; Arr[]['address']=street. This last

Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Chris Dowell
try $Arr[] = array('name' = 'arnold', 'address' = 'street'); Arnold wrote: Hi, How can i add new items to an array without using an index. Normally (single dimension) you can do: Arr[]=x and this item is added to the array, but what if i have subitems like: Arr[]['name']=arnold;

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Chris Dowell
Try is_int($_POST['mobile_number']) or ctype_digit($_POST['mobile_number']) HTH Cheers Chris Robert Cummings wrote: On Fri, 2004-10-15 at 07:45, Gareth Williams wrote: Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 substr($_POST['mobile_number'],0,3) != 447) {

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Gareth Williams
You could add is_integer() into the if statement. On 15 Oct 2004, at 14:07, Robert Cummings wrote: On Fri, 2004-10-15 at 07:45, Gareth Williams wrote: Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 substr($_POST['mobile_number'],0,3) != 447) {

Re: [PHP] SimpleXML: DOM, SAX or Other?

2004-10-15 Thread Christian Stocker
Hi On 15 Oct 2004 11:51:33 -, PHPDiscuss - PHP Newsgroups and mailing lists [EMAIL PROTECTED] wrote: Hi, Does anybody have any depthful knowledge of the SimpleXML extension in PHP5?.. More accurately, do you know if the simpleXml-xpath() method uses DOM, SAX or some other method of

[PHP] test

2004-10-15 Thread Cosmin
test -- c3f7bc9d7683857572da3d1fa3d31af17bde4ebbc5c0f0dc2b7f6f

[PHP] RE: [PHP-DB] How to optimize select of random record in DB ?

2004-10-15 Thread Bastien Koert
skip the two step process and use RAND in the sql statement SELECT * FROM table1, table2 WHERE a=b AND cd ORDER BY RAND() LIMIT 1000; bastien From: -{ Rene Brehmer }- [EMAIL PROTECTED] To: [EMAIL PROTECTED],[EMAIL PROTECTED] Subject: [PHP-DB] How to optimize select of random record in DB ? Date:

Re: [PHP] test

2004-10-15 Thread John Nichel
Cosmin wrote: test Had this been a real email, we would have been given instructions on how to reply. This has been a test of the emergency php email broadcast system. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To

[PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Mag
Hi! I need someone who is very good with maths to help me with this, unfortunatly I suck at maths so that someone can not be me. Ironically before I started my first computer course years back I asked the instructer if learning computers needed a lot of maths...she said 'no, just basics'..that

Re: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Chris Dowell
Problem 1) $h_1 = 600; $w_1 = 800; $h_2 = 120; $w_2 = $w_1 * ($h_2 / $h_1); Problem 2 a) Assuming you're wanting the central portion of the original image (which I think you are from what you've written) $h_1 = 600; $w_1 = 800; $h_2 = 120; $w_2 = 90; $x = ($h_1 - $h_2) / 2; $y = ($w_1 - $w_2) /

RE: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Gryffyn, Trevor
Good questions.. Here's some stuff to play with: Heres my maths problems in 2 parts: Problem 1) I need to scale down an image (eg: example.jpg) to height of 120 pixels while maintaining the images proportions. eg: if i have an image of (height and width) 800x600 what would the

RE: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Mag
DAMN! 2 minutes after posting to the list I get some pretty good mails from two people with answers on how to solve this,while i had a restless night trying to figure this out in my head! I LOVE THIS LIST! Thanks guys, will tell you how this goes and if i have any problems. Cheers, Mag =

Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Chris Boget
You mean like this... $sub = array ( 'name' = 'Ahnold', 'address' = '123 Someplace Nice', ); $bigArray[] = $sub; Something else that will work is the following: $arrPt = $Arr[]; $arrPt['name'] = 'bob'; $arrPt['address'] = 'wherever'; thnx, Chris --

Re: [PHP] Problem with MSSQL

2004-10-15 Thread Greg Donald
On Fri, 15 Oct 2004 12:42:21 +0700, Yusuf Tikupadang [EMAIL PROTECTED] wrote: I'm a new member in this mailing list. I have a problem with large data in mssql (more than 100.000 record in one table). If I want to browse it from record 10 until 19 (like when I press next button), php have to

Re: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Pankaj Kafley
Very helpful indeed. Until today I had used softwares like Photoshop to get the exact proportion rate. This really works, thank you guys. Cheers !!! On Fri, 15 Oct 2004 07:05:34 -0700 (PDT), Mag [EMAIL PROTECTED] wrote: DAMN! 2 minutes after posting to the list I get some pretty good mails

Re: [PHP] throw me a bone for a regexp please.

2004-10-15 Thread Robet Carson
Thank you for the tips and the help. I really appriciate it. You have given me something that I can use to learn regular expressions. Thanks, Robert On Fri, 15 Oct 2004 11:04:57 +0800, Jason Wong [EMAIL PROTECTED] wrote: On Friday 15 October 2004 10:35, Robet Carson wrote: need a

Re: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Jonel Rienton
it's algebra at work :) nicely done. On Oct 15, 2004, at 8:57 AM, Gryffyn, Trevor wrote: Good questions.. Here's some stuff to play with: Heres my maths problems in 2 parts: Problem 1) I need to scale down an image (eg: example.jpg) to height of 120 pixels while maintaining the images proportions.

Re: [PHP] throw me a bone for a regexp please.

2004-10-15 Thread Matt M.
Also if someone could direct me to a site that explains how to use and create regexp in a small minded manor since I have been unable to grasp the concepts. the regex coach has been a big help to me http://www.weitz.de/regex-coach/ you might find it useful -- PHP General Mailing List

RE: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Gryffyn, Trevor
Algebra! I aced that in 7th grade! (don't ask me about all the other years of math. Haha.. I think I just got bored and slept a lot or something) -TG -Original Message- From: Jonel Rienton [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 11:02 AM To: Gryffyn, Trevor Cc:

[PHP] Help with parsing result code

2004-10-15 Thread Carlos Alberto Bazan-Canabal
Hi. I'm setting up a credit card payment app. When I send the information through the form I get a result similar to this: NOT CAPTURED:00:428930479495:NA:1015:9755676331042890:1:1 This is the only data in the result page. I have never done parsing, and I have no idea of how to get

Re: [PHP] PHP 5.0.2 LDAP SASL Binds (GSSAPI specifically)

2004-10-15 Thread Curt Zirzow
* Thus wrote Quanah Gibson-Mount: I see that php 5.0.2 has added the ldap_sasl_bind function. I compiled php-5.0.2 against our OpenLDAP w/ SASL support libraries, and went ahead to give it a whirl: ... However, what I get back is: bWarning/b: ldap_sasl_bind() [a

Re: [PHP] Help with parsing result code

2004-10-15 Thread Matt M.
I'm setting up a credit card payment app. When I send the information through the form I get a result similar to this: NOT CAPTURED:00:428930479495:NA:1015:9755676331042890:1:1 This is the only data in the result page. I have never done parsing, and I have no idea of how to get

Re: [PHP] Help with parsing result code

2004-10-15 Thread Matt M.
http://us2.php.net/manual/en/function.preg-split.php should do it also http://us2.php.net/explode -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread ApexEleven
How come you guys always go for the simplest answer? why not do something like, $num = count($arrPt); $arrPt[$num]['name'] = Figntin' Bob; $arrPt[$num]['address'] = Under the Broad Street Bridge; Live a little... -Jasper On Fri, 15 Oct 2004 09:07:43 -0500, Chris Boget [EMAIL PROTECTED] wrote:

[PHP] Advanced maths help (part 2)

2004-10-15 Thread Mag
Hi again guys, :-) Thanks to the educated (and excellient) help of Chris and trevor I am now getting proportionate thumbs (which was problem 1, remember? ) Heres the code that i am using, if it may help anyone else: ** code start ** $src_img = imagecreatefromjpeg(tgp1.jpg); $img_dim =

Re: [PHP] PHP 5.02 and Fedora Core 2 Installation question

2004-10-15 Thread Brad Pauly
On Thu, 14 Oct 2004 16:30:42 -0400, Don [EMAIL PROTECTED] wrote: Has anyone had any luck installing with the --with-imap configuration option. IMAP doesn't seem to be installed (nor imap-devel) and the c library specified in the docs at php.net does not compile. I am also trying to do this.

Re: [PHP] throw me a bone for a regexp please.

2004-10-15 Thread Robet Carson
Thanks! On Fri, 15 Oct 2004 10:06:15 -0500, Matt M. [EMAIL PROTECTED] wrote: Also if someone could direct me to a site that explains how to use and create regexp in a small minded manor since I have been unable to grasp the concepts. the regex coach has been a big help to me

Re: [PHP] Help with parsing result code

2004-10-15 Thread Carlos Alberto Bazan-Canabal
Thank you Matt and Ed. I have solved the issue and started looking into parsing and regular expressions. Thx Carlos. On Fri, 15 Oct 2004 10:57:02 -0500, Matt M. [EMAIL PROTECTED] wrote: http://us2.php.net/manual/en/function.preg-split.php should do it also

[PHP] Getting info off an HTTPS page

2004-10-15 Thread Carlos Alberto Bazan-Canabal
Hi, I am working on setting up a VPOS system, and I need to read the results of sending the CC information to the bank. When sending the form I am doing it with HTTPS port 443 with POST method in my form and application/www-form-urlencoded When I get the results of my submission I get another

RE: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Gryffyn, Trevor
My interpretation of Problem 2 before was that you wanted to get a 120w x 90h (?) section of the original image, not of the thumbnail you generated by resizing the original. You seem to be working off of the adjusted height. Sorry, I didn't noodle all the way through this one, what I am missing?

[PHP] Re: Getting info off an HTTPS page

2004-10-15 Thread Manuel Lemos
Hello, On 10/15/2004 02:24 PM, Carlos Alberto Bazan-Canabal wrote: I am working on setting up a VPOS system, and I need to read the results of sending the CC information to the bank. When sending the form I am doing it with HTTPS port 443 with POST method in my form and

RE: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Mag
Hi Trevor, Sorry, am just a bit confused myself mostly because I am using a third party script to clip the 120x90 part out of the image...understanding the way the script is written is a little frustrating as it was written for something else and I am trying to adopt it. if you want to try your

RE: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Gryffyn, Trevor
No worries. But here's my thought: 1. You start with an image, getting it's current (original) proportions 2. You figure out the width and height proportions to resize it down to something small 3. Resize image (creating a new image.. At least to send to the browser if not in a file separate

[PHP] Print window function???

2004-10-15 Thread Tony Kim
Is there a function for print window in php? I tried javascript window.print() but this doesn't work in ie 5.2 on mac. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Print window function???

2004-10-15 Thread Steve Murphy
Web standards my friend. Use CSS, learn from the master: http://www.alistapart.com/articles/goingtoprint/ -Original Message- From: Tony Kim [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 3:10 PM To: [EMAIL PROTECTED] Subject: [PHP] Print window function??? Is there a function

Re: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Chris Dowell
I think you've a couple of problems with your second problem (problem problem problem). First of all, you're setting $dst_h to 0, which gives you a height of 0 - IIRC that's not what you wanted :) You should be setting that $dst_h = 120 as you always want it to be 120px I reckon that your code

Re: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Mag
Hey Chris, Thanks for replying. Dont worry about it, I got so p*ssed that I just striped the whole thing down to pretty much just the imagecopyresized() function, fiddled around with it to see how it works and got the sh*t working. The good thing now is I understand a bit better how the function

[PHP] php_printer functions, how to detect printer is ready to print out

2004-10-15 Thread CK
Hi. I am currently working on a project that the script should print-out documents whenever local users wishe to print-out. However, my concern is how to detect THE printer is ready to print out NOT only its driver is installed. Thank you in advance. CK -- PHP General Mailing List

Re: [PHP] PHP 5.02 and Fedora Core 2 Installation question

2004-10-15 Thread Brad Pauly
On Fri, 15 Oct 2004 10:49:27 -0600, Brad Pauly [EMAIL PROTECTED] wrote: I am also trying to do this. Dovecot is the default IMAP server on FC2. I haven't had time to try it yet, but here is a link I found about compiling PHP with dovecot:

Re: [PHP] Problem with MSSQL

2004-10-15 Thread Yusuf Tikupadang
Thanks, I will try it first On Fri, 15 Oct 2004 09:26:21 -0500, Greg Donald [EMAIL PROTECTED] wrote: http://pear.php.net/package/DB_Pager -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To

[PHP] Best way to figure out whether a query returns RESULT or NON-RESULT

2004-10-15 Thread Karam Chand
Hello, I have an app where one module is similar to phpMyAdmin (well only .1%) with error_reporting() set to E_ALL. Now a user can execute any query. What is the best way to know whether a query is result or non-result. e.g. $result = mysql_query ( $query, $mysql ); if ( !$result ) {