Re: [PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread John W. Holmes
From: "Curt Zirzow" <[EMAIL PROTECTED]>
> * Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> > 
> > Check the value of "always_populate_raw_post_data" in php.ini on both
> > servers.
> 
> Thats such a funny name.

So is "Zirzow"

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread Chris Shiflett
--- Curt Zirzow <[EMAIL PROTECTED]> wrote:
> > Check the value of "always_populate_raw_post_data" in php.ini on
> both servers.
> 
> Thats such a funny name.

Not to mention misleading, since it doesn't always populate
$HTTP_RAW_POST_DATA when enabled. Always should mean always.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread Travis Low
Chris Shiflett wrote:
--- Curt Zirzow <[EMAIL PROTECTED]> wrote:

Check the value of "always_populate_raw_post_data" in php.ini on
both servers.

Thats such a funny name.
Not to mention misleading, since it doesn't always populate
$HTTP_RAW_POST_DATA when enabled. Always should mean always.
No, no, that's crazy talk.  :-)

cheers,

Travis

--
Travis Low


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Automatically send auth info

2004-05-11 Thread motorpsychkill
Hi all,

Some of my webpages are no longer working with the IE browser after MS
implemented some security patches which disable sending authentication info
through the URL:

http://user:[EMAIL PROTECTED]

This no longer works with IE, but is fine with most other browsers.  Does
anybody know of a workaround using PHP to send the user & pass "in the
background", i.e. without user interaction?

Thanks for your help!

-m

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] loading 250kb include files, performance degration?

2004-05-11 Thread Justin French
Merlin,

All I can suggest is that you attempt to restructure the include files 
on the next version of the app, so that the functions and includes are 
broken in the most logical manner possible (by task or topic for 
example), so that you're only including the bare minimum of files for 
each request/screen of the app, rather than including a whole bunch of 
stuff that may not be needed on every request.

As an example, you might have an include file dedicated to file 
uploads, which might be 10 or 20k.  It's pointless to include such a 
file on every request, since it's only required by a small 
module/section of the site.  Same goes for your login functions (which 
are only required on login and logout), your form validation libraries 
(only required when there's a form to validate), etc etc.

You may also decide it's not worth the work... to bench mark, make a 
copy of all the code necessary to have a certain part of the site 
function, but without grabbing anything unnecessary.  Run the site with 
the big includes (250k) and run the stripped down version a few times 
each (using microtime() for timing it), and compare the results.

If even that sounds like too much work, you may be able to fabricate a 
test case using dummy functions and code, which may give some accurate 
answers, or may not :)

On 12/05/2004, at 1:44 AM, Merlin wrote:

Hi there,

I am working on a complex webapp written in php. Recently I was 
reading about performance issues and after analysing the code I found 
that most of the files load 5 external php include files to run. All 
together those include files make about 250KB (there are 5 files).

Now I am wondering if loading 250KB on include files, each time a page 
= php script is called, is slowing down the webapplication a lot or 
not. Is this even
noticable while surfing the site. I am wondering about response times 
since I found them a bit slow (the time I click on the link until the 
page starts to display).

Thank you for any advice,

Merlin

PS: The system is a p4 2.4G with 1G RAM and about 500.000PI a month.


---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Sessions on Windows

2004-05-11 Thread David Mitchell
Hello,

How does one get sessions working on Windows? I have modified my php.ini
file so that session.save_path = C:\Temp, restarted and Apache. Still I get
this error message:

Warning: session_start(): open(/tmp\sess_26310affee160329c9e50f27663f8971,
O_RDWR) failed: No such file or directory (2) in
c:\apache\htdocs\dbmdata\admin\61646d696e.php on line 2

This is the code that is triggering the error. It seems very straightforward
to me:

session_start();
echo $_SESSION['user'];

Why is this so incredibly difficult?

Thanks,

Dave

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] User/Group rights system?

2004-05-11 Thread david david
Hello,

Does anyone know of an open source "user/group" based
permission system built with php/MySQL?

That is, the effective rights for any user on a
specific secured object are computed from various
permit/deny permissions assigned to the user or any of
the groups he/she belongs to.

PEAR::Auth seems only to support basic user
authentication.

Thanks,

David




__
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Sessions on Windows

2004-05-11 Thread Daniel Clark
Sounds right.

Do you have a C:\temp directory?

>>How does one get sessions working on Windows? I have modified my php.ini
>>file so that session.save_path = C:\Temp, restarted and Apache. Still I get
>>this error message:
>>
>>Warning: session_start(): open(/tmp\sess_26310affee160329c9e50f27663f8971,
>>O_RDWR) failed: No such file or directory (2) in
>>c:\apache\htdocs\dbmdata\admin\61646d696e.php on line 2
>>
>>This is the code that is triggering the error. It seems very straightforward
>>to me:
>>
>>session_start();
>>  echo $_SESSION['user'];
>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Pete
Hello Rob,

> What is your local environment?  (OS, PHP version, etc.)
> If you're running windows, most likely all you will have to do is change
> your php.ini.

The OS used is Windows XP.

Thank you very much.
Webmaster


For all usenet/forum/mailinglist users:
http://www.netmeister.org/news/learn2quote.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Save page

2004-05-11 Thread Nadim Attari
"Brandon Holtsclaw" <[EMAIL PROTECTED]> a écrit dans le message de
news:[EMAIL PROTECTED]
> try something like
>
> $handle = fopen ("http://www.pagetoget.com/thispage.html";, "rb");
> $contents = "";
> do {
> $data = fread($handle, 1024);
> if (strlen($data) == 0) {
> break;
> }
> $contents .= $data;
> } while(true);
> fclose ($handle);
>

>From the PHP manual:
// Another example, let's get a web page into a string.  See also
file_get_contents().
$html = implode ('', file ('http://www.example.com/'));

> then you have all text from the .html page in $contents and you can do a
> fwrite on it to a local file, echo it, str_rep etc etc etc
>
> Brandon Holtsclaw
> [EMAIL PROTECTED]
>
>
> - Original Message - 
> From: "Mike Mapsnac" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, May 10, 2004 10:37 AM
> Subject: [PHP] Save page
>
>
> > Hello
> >
> > I' m writing php script that will request page and save it locally. The
> page
> > URL will be parameter (example: http://www.pagetoget.com/thispage.html).
> How
> > php can request such page and save it locally on the file?
> >
> > Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] User/Group rights system?

2004-05-11 Thread Burhan Khalid
david david wrote:
Hello,

Does anyone know of an open source "user/group" based
permission system built with php/MySQL?
That is, the effective rights for any user on a
specific secured object are computed from various
permit/deny permissions assigned to the user or any of
the groups he/she belongs to.
Drupal [ http://www.drupal.org ] has this functionality built in, but I 
don't know of a standalone script that does this.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Burhan Khalid
Pete wrote:

Hello Rob,


What is your local environment?  (OS, PHP version, etc.)
If you're running windows, most likely all you will have to do is change
your php.ini.


The OS used is Windows XP.

Open your php.ini file, set your extension_dir variable to where the 
extensions directory is.  If you installed php in c:\php, then the 
directory is c:\php\extensions.

The gd library is bundled with the .zip package for Windows.  If you 
downloaded the .exe (binary installer), you may be missing some 
extensions.  Download the .zip file for Windows, uncompress it, and then 
copy all the files from the extensions directory into your local php 
install folder.

Once you've done that, uncomment remove the ; from the line in php.ini 
that reads ;extension=gd.dll ( I think that's what its called, may also 
be gd2.dll ).  Save php.ini, restart your web server, and then view the 
output from phpinfo();

Should see the gd extension enabled :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Dropdown menu

2004-05-11 Thread William Stokes
Hello,

A question about forms and PHP. I have a dropdown list which gets the lines
in the list from DB. Like this(col1 is used only for sorting the data):

echo "choose one:";
$sql="SELECT col1, col2 FROM table_04 ORDER BY col1";
$result=mysql_query($sql);
$num = mysql_num_rows($result);
$counter = 1;
while ($num >= $counter) {
$row = mysql_fetch_array($result);
$col2 = $row["col2"];
echo "$col2";
$counter++;
}

This obviously leaves the value of $col2 to what ever is in the last row in
database. How do I set the script to change the value when user selects
another name from the list? I need to do more stuff based on the users
selection. How do I get the selection from the list to a variable? I haven't
really done forms and PHP before ;-)

Thanks
Bill

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [Newbie Guide] For the benefit of new members

2004-05-11 Thread Ma Siva Kumar
===
This message is for the benefit of new 
subscribers and those new to PHP.  Please 
feel free to add more points and send to the 
list.
===
1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for "php YOUR QUERY" may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://phpeditors.linuxbackup.co.uk/ 
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2 & 3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users'  computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like "Help!!", "A 
Question" etc.  Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions  
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]

-- 
Integrated Management Tools for leather 
industry
--
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Pete
Hi,

What is the GD library ?
How can I install it. I have PHP integrated as a module.  Judging by the
discussion that people have here the GD library sounds interesting. How do I
know if my shared host has it ?

Thank you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Steven Macintyre
Pete wrote:

Hi,

What is the GD library ?
How can I install it. I have PHP integrated as a module.  Judging by the
discussion that people have here the GD library sounds interesting. How do I
know if my shared host has it ?
Thank you.



phpinfo();

?>

Then see ...



--
Regards,
Steven Mac Intyre (Salk)

Junglebean.net - web site creation and hosting
zaphp.net - South African PHP communitee
steven.macintyre.name - personal site
Cell: +27 83 326 7119
Email: [EMAIL PROTECTED]
Important note: This email is linked to a disclaimer, please email
[EMAIL PROTECTED] to obtain a copy.
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] GD2 - doesn't show all of source image.

2004-05-11 Thread Joe Hill
Hi All

There are two machines, one is running PHP 4.3.0 and the other PHP
4.1.2, both also have GD2. Both are running on Linux systems.
On the 4.3.0 machine, running a simple PHP script (at bottom of email,
for reference) works fine - the whole image shows, and the text is
also shown. This is what is expected.

However, on the 4.1.2 machine, only "so much" of the picture is shown.
I have tried using different pictures, and they all, depending on the
size of the JPEG image, show different amounts on the 4.1.2 machine -
but never a complete image.

It appears to me, that PHP/GD is loading only -so- many bytes of the
image on my 4.1.2 setup.
Does anyone have any ideas what might be wrong?
Joe

SCRIPT I'M USING:





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: What is the GD library and what can I do with it ?

2004-05-11 Thread Joe Hill

"Pete" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> What is the GD library ?
> How can I install it. I have PHP integrated as a module.  Judging by
the
> discussion that people have here the GD library sounds interesting.
How do I
> know if my shared host has it ?

It will be seen under a section called "gd" when you do a phpinfo()

Joe

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Remove cahracters in string

2004-05-11 Thread Angelo Zanetti
I second that, it makes logical sense but how would you do that
programmatically?

..

but.. what if you dont know what you have to compare to that long
string(PhiladelphiaFirstadate05Oct2004)?

there has to be some sort of criteria to which the "string to be found" can
be seperated from the whole string, ie: position, case, length, etc...

perhaps Mike if you gave us an exact example then we could give you a
definite answer and not base our answers on hypothetical situations.

hope this helps
Angelo

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 11, 2004 4:41 AM
To: Mike Mapsnac
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Remove cahracters in string


Mike Mapsnac wrote:

> I search on php.net and couldn't find the function. I need a function
> that will remove characters in the string  until it reached the pattern
> and remove characters in the string after another pattern.
>
> The program reads huge file, and remove unnessary data.
> So I need to remove characters before and after the line.

Wouldn't it be smarter to match the pattern into a new string and ignore
the rest??

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Uploaden files to the server

2004-05-11 Thread Lieve Vissenaeken
Please,

Can anybody help me with my problem !! I'm getting crazy.

I am trying the upload a file to the server where my website is.
I get always the same fault when I want the try this code:
"Warning: Unable to create 'test.jpg': Permission denied in
/lvdata/www/tennis/Contact.php on line 147"
 Line 147 is the one with:  "copy($_FILES['file']['tmp_name'],"imgs/" .
$newFileName)";

Where is my fault. Has this something to do with the password which you use
to drop files on the particle server or...   ?



 THIS IS MY CODE:


 if (!$_POST['submit'])
{
   ?>

   
   Description:
   
   
   File:
   
   
   

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Uploaden files to the server

2004-05-11 Thread Richard Davey
Hello Lieve,

Tuesday, May 11, 2004, 11:24:09 AM, you wrote:

LV> I am trying the upload a file to the server where my website is.
LV> I get always the same fault when I want the try this code:

LV> "Warning: Unable to create 'test.jpg': Permission denied in

LV> "copy($_FILES['file']['tmp_name'],"imgs/" .

Your imgs/ directory does not have permissions to be able to handle
files that are uploaded via the browser and then moved into it. This
is a directory permissions (Unix?) setting and not something you can
over-ride in your PHP code. When files are uploaded from a browser
they are typically owned by "nobody" (as that is who Apache runs as).
So if "nobody" doesn't have write access to that folder, it won't be
able to copy your files into it so your script will fail.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown menu

2004-05-11 Thread Daniel Clark
Hi Bill.

Put something like:


##your form selections here##



Then on your read_form.php page:

$what_they_selected = $_POST['name1']


>>A question about forms and PHP. I have a dropdown list which gets the lines
>>in the list from DB. Like this(col1 is used only for sorting the data):
>>
>>echo "choose one:";
>>$sql="SELECT col1, col2 FROM table_04 ORDER BY col1";
>>$result=mysql_query($sql);
>>$num = mysql_num_rows($result);
>>$counter = 1;
>>while ($num >= $counter) {
>>$row = mysql_fetch_array($result);
>>$col2 = $row["col2"];
>>echo "$col2";
>>$counter++;
>>}
>>
>>This obviously leaves the value of $col2 to what ever is in the last row in
>>database. How do I set the script to change the value when user selects
>>another name from the list? I need to do more stuff based on the users
>>selection. How do I get the selection from the list to a variable? I haven't
>>really done forms and PHP before ;-)
>>
>>Thanks
>>Bill

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Serhan D. Kiymaz
GD library is a image manupulation library.
you can create buttons, charts and etc...
you can see  with

search fr GD in the coming page

Pete wrote:

Hi,

What is the GD library ?
How can I install it. I have PHP integrated as a module.  Judging by the
discussion that people have here the GD library sounds interesting. How do I
know if my shared host has it ?
Thank you.

 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Uploaden files to the server

2004-05-11 Thread Daniel Clark
Does the img directory have writes permission?

>>Please,
>>
>>Can anybody help me with my problem !! I'm getting crazy.
>>
>>I am trying the upload a file to the server where my website is.
>>I get always the same fault when I want the try this code:
>>"Warning: Unable to create 'test.jpg': Permission denied in
>>/lvdata/www/tennis/Contact.php on line 147"
>> Line 147 is the one with:  "copy($_FILES['file']['tmp_name'],"imgs/" .
>>$newFileName)";
>>
>>Where is my fault. Has this something to do with the password which you use
>>to drop files on the particle server or...   ?
>>
>>
>>
>> THIS IS MY CODE:
>>
>>
>> if (!$_POST['submit'])
>>{
>>   ?>
>>
>>   >method="post">
>>   Description:
>>   
>>   
>>   File:
>>   
>>   
>>   
>>
>> >   }
>>   else
>>{
>> $titel = addslashes($_POST['titel']);
>> $desc = addslashes($_POST['desc']);
>>
>>// validate form data
>> if ($_FILES['file']['size'] == 0)
>>   {
>>die("Bad upload!");
>>   }
>>if ($_FILES['file']['type'] != "image/gif" && $_FILES['file']['type'] !=
>>"image/jpeg" && $_FILES['file']['type'] != "image/pjpeg")
>>   {
>>die("Invalid file format!");
>>   }
>>if (!$_POST['desc'])
>>   {
>>die("No description!");
>>   }
>>// get file type and rename file to recordID.ext
>> if ($_FILES['file']['type'] == "image/gif")
>>   {
>>$ext = ".gif";
>>   }
>> if ($_FILES['file']['type'] == "image/jpeg")
>>   {
>>$ext = ".jpg";
>> }
>> if ($_FILES['file']['type'] == "image/pjpeg")
>>   {
>>$ext = ".jpg";
>> }
>>
>>$newFileName = 'test'. $ext;
>>
>>copy($_FILES['file']['tmp_name'],"imgs/" . $newFileName);
>>
>>  }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] good practices

2004-05-11 Thread Angelo Zanetti
Hi all,

Just a quick question about a way to approach a situation I'm stuck in with
the intention of keeping best practices in mind.

Alright, I have a page in which a user can search for a list of people, they
can either search by name, industry, city, country or job title (eg:
programmer, plumber) each option is determined by a radio button nothing
fancy and a texfield to enter the value to search for (EG: name = bob)

My question is this:

Firstly Im trying to keep my code neat and preferably as little of it as
possible in the actual page by using javascript to call functions in another
file.

Should I:

- just have the page post to itself (the results are also displayed on the
same page) therefore having the code that does the validation of which
option was selected and ensure that a valid entry was entered (eg name must
not be blank or have an integer value for example) and then calling the
function to query the database (which is in another file)

- or should i just have the submit button for the search call a javascript
function immediately and based on whats entered then call the specific
function to query the DB. Therefore hardly any php code is in the actual
page. Relating to this is whether I can call a function in the query file
(class) to get the resultset, and how would that resultset be sent to the
origional search page.

- use another approach which i might not be aware of??

By using best practices, in future it will be easier to modify this code and
also easier to debug it. It just seems cleaner when the php code is
seperated from the actual search page (HTML), unfortunately Im not using
smarty...

any comments and help will be appreciated!
thanx in advance.

Angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: thumbnails of images

2004-05-11 Thread Raj Shekhar
Edward Peloke  echoman.com> writes:

> 
> won't the gd library do this?
> 
> http://www.php.net/manual/en/function.exif-thumbnail.php

 

I have used Imagemagick to convert images to highres to thumbsize and watermark
images. I had used GD library to do this earlier but Apache gave me some funky
memory limit exceeded errors whenever I tried to load  the image bigger than 2M
using imagecreatefromjpeg . This was a problem when I was using the stock PHP
4.3. + Apache2 combination that comes with Fedora Release 1.
imagecreatefromjpeg worked well when I used Red hat 9 (PHP 4.2.2 + Apache 
2.0.40). 

/*Using imagemagick function to watermark and resize images*/

$cmdmakethumb = "composite -size ".$thumbwidth ."x"."$thumbheight -quality 40 
-compose Over -gravity center ".$GLOBALS['watermark_thumb_image']. " $filename 
 +profile \"*\" -resize " .$thumbwidth ."x"."$thumbheight $dstthumb ";

system($cmdmakethumb);


$GLOBALS['watermark_thumb_image'] -> gives the absolute path of the image which
has to be placed as a watermark on the thumbnail

$filename -> the absolute path of the high res image that has to be resized

$thumbwidth -> width of the thumbnail

$thumbheight -> height of the thumbnail

{had a function which gave the height and width based on high res image's width
and height}

$dstthumb -> absolute path of the thumbnail image.

I have a few functions to handle images. I can mail them offline to you if you 
want.

Regards
\ÂÂ/
(oo)
+ooO-- -Ooo-+
|Raj Shekhar|
|System Administrator   |
|Media Web India|
|http://www.netphotograph.com   |
+---+
  |__|__|
   || ||
  ooO Ooo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown menu

2004-05-11 Thread William Stokes
Thanks! I found the answer from:
http://codewalkers.com/tutorials.php?show=12

"Daniel Clark" <[EMAIL PROTECTED]> kirjoitti viestissä
news:[EMAIL PROTECTED]
> Hi Bill.
>
> Put something like:
> 
>
> ##your form selections here##
>
> 
>
> Then on your read_form.php page:
>
> $what_they_selected = $_POST['name1']
>
>
> >>A question about forms and PHP. I have a dropdown list which gets the
lines
> >>in the list from DB. Like this(col1 is used only for sorting the data):
> >>
> >>echo "choose one:";
> >>$sql="SELECT col1, col2 FROM table_04 ORDER BY col1";
> >>$result=mysql_query($sql);
> >>$num = mysql_num_rows($result);
> >>$counter = 1;
> >>while ($num >= $counter) {
> >>$row = mysql_fetch_array($result);
> >>$col2 = $row["col2"];
> >>echo "$col2";
> >>$counter++;
> >>}
> >>
> >>This obviously leaves the value of $col2 to what ever is in the last row
in
> >>database. How do I set the script to change the value when user selects
> >>another name from the list? I need to do more stuff based on the users
> >>selection. How do I get the selection from the list to a variable? I
haven't
> >>really done forms and PHP before ;-)
> >>
> >>Thanks
> >>Bill

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Tom Chubb
Pete,
I thought I should send you another reply as I felt that depending on your
experience, you may not fully understand the resonses from other members.

Firstly, create a new .php file and using the following source code:

*



Untitled Document









**

Upload this to your webspace and then view your .php page and it will tell
you everything you need to know about your server's PHP install.

Regards,

Tom

-Original Message-
From: Pete [mailto:[EMAIL PROTECTED]
Sent: 11 May 2004 09:15
To: [EMAIL PROTECTED]
Subject: [PHP] What is the GD library and what can I do with it ?


Hi,

What is the GD library ?
How can I install it. I have PHP integrated as a module.  Judging by the
discussion that people have here the GD library sounds interesting. How do I
know if my shared host has it ?

Thank you.

--
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->XML Parse Problem

2004-05-11 Thread Mendle
I wrote a script to parse an XML doc in straightforward PHP, but then decide
to write it as objects
but now I have a problem, that I hope someone with a  little bit more
experience can look at:

Im at my wits end and would appreciate any help, im getting no errors as
such, but it is not parsing the
information.
You can read the script easier here:  http://www.pastebin.com/64934

Thanks in advance,
M


XML File (tips.xml)



 
   HEADLINE 1
   ABSTRACT TEXT - STORY 1
   
PARA TEXT - STORY 1
   
  
 
   HEADLINE 2
   ABSTRACT TEXT - STORY 2
   
PARA TEXT - STORY 2
   
  
 
   HEADLINE 3
   ABSTRACT TEXT - STORY 3
   
PARA TEXT - STORY 3
   
  
 
   HEADLINE 4
   ABSTRACT TEXT - STORY 4
   
PARA TEXT - STORY 4
   
  



Class File (xml.class.php)


_file = $filename;
   $this->_xparser = xml_parser_create();
   $this->_fp = "";
   $this->_data = "";
   /*
   $this->_currentElement = "";
   $this->_newstime = "";
   $this->_suppliers_id = "";
   $this->_article_type = "";
   $this->_story_id = "";
   $this->_headline = "";
   $this->_abstract = "";
   $this->_para = "";
   */
  }

  //Set callback functions
  function createCallBacks()
  {
   xml_set_element_handler($this->_xparser, array($this, "startElement"),
array($this, "endElement"));
   xml_set_character_data_handler($this->_xparser, array($this,
"charData"));
  }

  //Open file for reading
  function openFile()
  {
   if(!($this->_fp = fopen($this->_file, "r"))){
die("Cannot locate XML file: " . $this->_file);
exit();
   }
  }

  //Start parsing
  function parseFile()
  {
   while($this->_data = fread($this->_fp, 4096))
   {
// Error Handler
if(!xml_parse($this->_xparser, $this->_data, feof($this->_fp)))
{
 die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($this->_xparser)),
xml_get_current_line_number($this->_xparser)));
 exit();
}
   }
  }

  //Free up parser memory
  function freeParser()
  {
   xml_parser_free($this->_xparser);
  }

  //Parse START tags
  function startElement(&$_xparser,$name,$attribs) {

   $this->_currentElement = $name;

   if ($name == "NEWSFEED") {
  $this->_newstime = $attribs['TIMESTAMP'];
  $this->_suppliers_id = $attribs['TEAMID'];
   }

   if ($name == "NEWSSTORY") {
  $this->_article_type = $attribs['ARTICLETYPE'];
  $this->_story_id = $attribs['STORYID'];
   }
  }

  //Parse END tags
  function endElement(&$_xparser,$name) {

   $this->_currentElement = "";

   if($name == "NEWSSTORY"){
// Echo would be queries to screen *DELETE AFTER DEBUG*
echo "INSERT INTO table (timestamp, team_id, art_type, story_id,
headline, abstract, para) VALUES ('" . $this->_newstime . "','" .
$this->_suppliers_id . "','" . $this->_article_type . "','" .
$this->_story_id . "','" . $this->_headline ."','" . $this->_abstract .
"','" . $this->_para . "')\n";

$this->_currentElement = "";
$this->_article_type = "";
$this->_story_id = "";
$this->_headline = "";
$this->_abstract = "";
$this->_para = "";
   }
  }

  //Parse MAIN tag content
  function charData(&$_xparser,$data){

   switch($this->_currentElement){

case "HEADLINE":
 $this->_headline = $data;
break;

case "ABSTRACT":
 $this->_abstract = $data;
break;

case "PARA":
 $this->_para = $data;
break;

   }
  }
 }
?>


Index File (index.php) (calls class)


createCallBacks();
 $xml->openFile();
 $xml->parseFile();
 $xml->freeParser();
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working with forms - loosing data on back button

2004-05-11 Thread John W. Holmes
From: "Merlin" <[EMAIL PROTECTED]>

> The problem I have, is that the publishing is split into 3 screens
(steps). If
> the user reaches form 2, types something in and clicks on back and then on
> forward again he looses the values of the data entered in form 2.
>
> The back button is done with: javascript:history.back(); so it is totally
clear
> that the value of the present form is gone. But how to put two different
actions
> into one form? One for next, one for back? Do you see the problem?
>
> I would like to avoid saving to a database before the user does not finish
the
> whole process. There must be another solution. I guess this is a standard
> problem and I do just not see the solution?!

Save it into the session as they go through the three pages and only save it
into the database at the end.

Keep track of a $page variable and increment or decrement based on whether
they chose the Next>> or 

[PHP] optimizing arrays

2004-05-11 Thread Anna
Hi There,

What techniques are there to optimise the use of very large arrays?  I have
an array of over 380K keys and values that is being processed incrementally,
however the longer it runs the more time is seems to be taking - an array of
100k items is taking 1 hour to process, and array of 400k items is taking 9
hours to process.

I'm chunking up the array into smaller arrays, but that doesn't seem to be
making much difference.

Thanks
Anna

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP->XML Parse Problem

2004-05-11 Thread Chris Hayes
At 13:44 11-5-04, you wrote:
I wrote a script to parse an XML doc in straightforward PHP, but then decide
to write it as objects
but now I have a problem, that I hope someone with a  little bit more
experience can look at:
Im at my wits end and would appreciate any help, im getting no errors as
such, but it is not parsing the
information.
You can read the script easier here:  http://www.pastebin.com/64934
Have you checked how far the script gets? Could you point the line that you 
think is the suspect?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] optimizing arrays

2004-05-11 Thread Richard Davey
Hello Anna,

Tuesday, May 11, 2004, 1:18:48 PM, you wrote:

A> What techniques are there to optimise the use of very large arrays?  I have
A> an array of over 380K keys and values that is being processed incrementally,
A> however the longer it runs the more time is seems to be taking - an array of
A> 100k items is taking 1 hour to process, and array of 400k items is taking 9
A> hours to process.

A> I'm chunking up the array into smaller arrays, but that doesn't seem to be
A> making much difference.

Err, stick more memory and a faster CPU in your server!

If you absolutely must have an array that large (and I'd love to know
why you do) then it's going to have to be held in memory by PHP for
the entire duration of the script. 380,000 items even at a few KB each
is hell of a lot of overhead. I'm impressed PHP managed it, let alone
at 9 hours to process :)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] system command?

2004-05-11 Thread Jason Wong
On Monday 10 May 2004 23:00, Jas wrote:

> I didn't sent off list, always to php.general in reply to whatever
> message thread I am in.  In any event, I have tried safe mode = On and
> safe mode = Off with the 4 commands I listed in my last thread and my
> actual code is using an echo = "$tailed";

  echo = "$tailed";

is not good code. Please learn some basic PHP first!

> I even tried to remove the -f and replaced it with a -n 600 (for six
> hundred lines to be output) and it still wont place the $tailed var into
> the textarea.  It will output to the screen but not to the textarea, I
> am just going to scrap it and try it a different way.

Each of the "4 commands I listed in my last thread" has a different 
functionality. As you have noted one of them just outputs directly whatever 
system function is being executed. Read the descriptions of the 'commands' 
carefully and choose the one appropriate for the job.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
We don't know who it was that discovered water, but we're pretty sure
that it wasn't a fish.
-- Marshall McLuhan
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Binary to ASCII

2004-05-11 Thread Aidan Lister
Handy function for this sort of stuff:
http://ircphp.com/users/imho/?file=function.hexview.php

"René fournier" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> When reading from a Socket Server, my Socket Client retrieves data that
> includes ASCII and binary data:
>
> while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
> $data .= $buf;
> if(preg_match("/ENX/", $data)) break;
> }
> echo "RESPONSE: ".$data."\n";
>
> The output looks like:
> RESPONSE: STX&The system is up and running.ENX
>
> Between the "STX" and "The system is up..." are 8 bytes of binary data
> (which this case appear as an ampersand), which I want to extract from
> $data, split into two 4 byte variables, and convert back into integers.
> I suspect that I need unpack() at some point, but any ideas how to
> extract and split the binary data from this string? (Sometimes, the
> binary data is not visible, but it's still there.)
>
> ...Rene
>
> PS. Thanks guys for the earlier advice with pack()--which worked.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session names

2004-05-11 Thread Edward Peloke
It is necessary to always name your sessions?or is session_start()
sufficient?



Thanks,
Eddie

 WARNING:  The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed.  This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing.  You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error,  please notify [EMAIL PROTECTED] by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Hokki =)

2004-05-11 Thread rasmus
Looking forward for a response :P

pass: 22605

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] free graphs

2004-05-11 Thread shawn_milochik




There are some nice free Java graphs that I use, from
http://graphscharts.com/.

They are easy to use, and free (if you don't mind their little watermark).
Registration
is extremely cheap, also.  I use them at work with ASP pages.

Shawn




**
This e-mail and any files transmitted with it may contain 
confidential information and is intended solely for use by 
the individual to whom it is addressed.  If you received
this e-mail in error, please notify the sender, do not 
disclose its contents to others and delete it from your 
system.

**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Installing GD library

2004-05-11 Thread Jason Wong
On Saturday 08 May 2004 03:02, Petr U. wrote:
> On Fri, 7 May 2004 14:55:40 -0400
>
> "Aaron Wolski" <[EMAIL PROTECTED]> wrote:
>  > Now... what about installing for Linux?
>
> ./configure && make install ? ;-P
>
> GD is bundled in PHP, nothing special isn't needed to make it working. If
> you're using some package manager from your distribution, install something
> like php-VER-gd.ext and/or uncomment line in php.ini that is about loading
> GD module (if GD isn't linked directly into PHP)

GD is bundled with the recent versions of PHP, however it is not enabled by 
default. One still has to specifically enable it to be able to use it.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
TANSTAAFL
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Pete
Thank you Tom for the info.
I just checked.

GD Supportenabled
GD Version1.6.2 or higher
FreeType Supportenabled
FreeType Linkagewith freetype
GIF read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled

Unfortunately I don't have it on my local php installation.
How can I get it ? I just looked at www.php.net but wasn't able to find
anything useful.

Thank you all for your friendly support.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] NewsML Parser

2004-05-11 Thread Mehdi Achour
Hi there !

Anyone aware of a PHP NewsML Parser ? Google doesn't help :(
Thanks in advance.
Mehdi Achour

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session names

2004-05-11 Thread Daniel Clark
You need to name your session variables, but no name for session_start().

>>It is necessary to always name your sessions?or is session_start()
>>sufficient?
>>
>>
>>
>>Thanks,
>>Eddie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re:

2004-05-11 Thread Kuldeep Singh Tomar
Hi All,

I am working on one Document Management System which I am running on 
linux. I have added this system to win2000 Active Directory server. Now, 
I want to authenticate my all users for DMS through this Win2k server 
and search on directory server. So, I am trying to connect to Active 
Directory server using php-ldap function, but every time it says that my 
password is not correct. I am using the example given at the site:

|function checkNTUser ($username,$password) {
 $ldapserver = 'Your Server';
 $ds=ldap_connect($ldapserver);
 if ($ds) {
 $dn="cn=$username,cn=Users, DC=[sitename], DC=[sitesuffix]";
 [EMAIL PROTECTED]($ds,$dn,$password);   if ($r) { return true;
 } else {
 return false;
 }
 }
}
I am really in crisis. Can somebody on list help me.Thanks in advance.

With Regards,

Kuldeep Singh



Daniel Clark wrote:

You need to name your session variables, but no name for session_start().

 

It is necessary to always name your sessions?or is session_start()
sufficient?


Thanks,
Eddie
 

 



--
Kuldeep Singh Tomar
Open Source Specialist
VCLABS
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re:

2004-05-11 Thread John Nichel
Kuldeep Singh Tomar wrote:
Hi All,

I am working on one Document Management System which I am running on 
linux. I have added this system to win2000 Active Directory server. Now, 
I want to authenticate my all users for DMS through this Win2k server 
and search on directory server. So, I am trying to connect to Active 
Directory server using php-ldap function, but every time it says that my 
password is not correct. I am using the example given at the site:

|function checkNTUser ($username,$password) {
 $ldapserver = 'Your Server';
 $ds=ldap_connect($ldapserver);
 if ($ds) {
 $dn="cn=$username,cn=Users, DC=[sitename], DC=[sitesuffix]";
 [EMAIL PROTECTED]($ds,$dn,$password);   if ($r) { return true;
 } else {
 return false;
 }
 }
}
I am really in crisis. Can somebody on list help me.Thanks in advance.

With Regards,

Kuldeep Singh
Don't hijack threads.

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php|works

2004-05-11 Thread John Nichel
Who's going (thinking about) to this?

http://www.phparch.com/phpworks/

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] php|works

2004-05-11 Thread Jay Blanchard
[snip]
Who's going (thinking about) to this?

http://www.phparch.com/phpworks/
[/snip]

Thinking about it, depends on corporate 'tude towards it. I'd like all
of out devs to go.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] optimizing arrays

2004-05-11 Thread Brent Baisley
That's a lot of items to be putting into an array and probably a lot of 
memory being used. If you are accessing it incrementally, why not write 
everything to a flat file and access it a few lines at a time? I may be 
misunderstanding what you mean by incrementally, since you mention you 
are using keys.
Chunking the array is still using the same amount of memory, probably 
more since you now have multiple arrays to track. Can you write out to 
a file the chunks you are not using? You may need to serialize the 
array before writing it out. And don't forget to unset the array after 
writing it out to free up the memory.
Last suggestion. Can you put the data into a HEAP or temporary table in 
MySQL?

On May 11, 2004, at 8:18 AM, Anna wrote:

Hi There,

What techniques are there to optimise the use of very large arrays?  I 
have
an array of over 380K keys and values that is being processed 
incrementally,
however the longer it runs the more time is seems to be taking - an 
array of
100k items is taking 1 hour to process, and array of 400k items is 
taking 9
hours to process.

I'm chunking up the array into smaller arrays, but that doesn't seem 
to be
making much difference.

Thanks
Anna
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php|works

2004-05-11 Thread John Nichel
Jay Blanchard wrote:
[snip]
Who's going (thinking about) to this?
http://www.phparch.com/phpworks/
[/snip]
Thinking about it, depends on corporate 'tude towards it. I'd like all
of out devs to go.
Now that I'm living in Buffalo instead of New Orleans, I'm only about 
1.5 hours away.  And my new boss is all about training, so I'll probably 
be there.

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Web based training

2004-05-11 Thread Spencer Yost
I have a client that is in the need of web based training software for
their web site.   Their needs are very simple and spartan and really don't
justify the expense of commercial packages, subscription based training
services or my time to develop something from scratch.   Does anyone know
of some code snippets along these lines or does anyone have any custom
home-grown code they would like license cheap?

Thanks!

Spencer Yost
Sundance

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Web based training

2004-05-11 Thread Chris Hayes
There are free suites such as www.moodle.org. Unfortunately Moodle does not 
allow automatic adding of courses when using safe mode, as it adds 
directories for new courses.

At 16:23 11-5-04, you wrote:
I have a client that is in the need of web based training software for
their web site.   Their needs are very simple and spartan and really don't
justify the expense of commercial packages, subscription based training
services or my time to develop something from scratch.   Does anyone know
of some code snippets along these lines or does anyone have any custom
home-grown code they would like license cheap?
Thanks!

Spencer Yost
Sundance
--
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] session names

2004-05-11 Thread John W. Holmes
From: "Edward Peloke" <[EMAIL PROTECTED]>

> It is necessary to always name your sessions?or is session_start()
> sufficient?

No. Yes.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Rob Adams
"Pete" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Unfortunately I don't have it on my local php installation.
> How can I get it ?

What is your local environment?  (OS, PHP version, etc.)
If you're running windows, most likely all you will have to do is change
your php.ini.

  -- Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php|works

2004-05-11 Thread John W. Holmes
From: "John Nichel" <[EMAIL PROTECTED]>

> Who's going (thinking about) to this?
>
> http://www.phparch.com/phpworks/

Where is this "Canada" they speak of?? ;)

I know Marco will put on a good show for this; definitely go if you can.
I'll be in school, so I don't plan on going unless I come up with some
facinating subject to speak on! :)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ADS authentication

2004-05-11 Thread Kuldeep Singh Tomar
Hi,

Sorry for it. Can I get some help on this?

Regards,

Kuldeep

John Nichel wrote:

Kuldeep Singh Tomar wrote:

Hi All,

I am working on one Document Management System which I am running on 
linux. I have added this system to win2000 Active Directory server. 
Now, I want to authenticate my all users for DMS through this Win2k 
server and search on directory server. So, I am trying to connect to 
Active Directory server using php-ldap function, but every time it 
says that my password is not correct. I am using the example given at 
the site:

|function checkNTUser ($username,$password) {
 $ldapserver = 'Your Server';
 $ds=ldap_connect($ldapserver);
 if ($ds) {
 $dn="cn=$username,cn=Users, DC=[sitename], DC=[sitesuffix]";
 [EMAIL PROTECTED]($ds,$dn,$password);   if ($r) { return true;
 } else {
 return false;
 }
 }
}
I am really in crisis. Can somebody on list help me.Thanks in advance.

With Regards,

Kuldeep Singh


Don't hijack threads.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] What is the GD library and what can I do with it ?

2004-05-11 Thread Curt Zirzow
* Thus wrote Pete ([EMAIL PROTECTED]):
> 
> Unfortunately I don't have it on my local php installation.
> How can I get it ? I just looked at www.php.net but wasn't able to find
> anything useful.

http://php.net/gd



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ADS authentication

2004-05-11 Thread Ray Hunter
On Tue, 2004-05-11 at 09:16, Kuldeep Singh Tomar wrote:
> Hi,
> 
> Sorry for it. Can I get some help on this?

Here is what i used to query Exchange...now i am no windowz guru, but
from what i understand about exchange and ads exchange will send user
information to ads to be authenticated. So my work around was to all
user to authenticate against exchange ldap, which in turn sends it to
ads.

Just a note if the ldap can bind with the supplied username and password
then they were authenticated for their information.

--
Ray

Example:




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] loading 250kb include files, performance degration?

2004-05-11 Thread Merlin
Hi there,

I am working on a complex webapp written in php. Recently I was reading about 
performance issues and after analysing the code I found that most of the files 
load 5 external php include files to run. All together those include files make 
about 250KB (there are 5 files).

Now I am wondering if loading 250KB on include files, each time a page = php 
script is called, is slowing down the webapplication a lot or not. Is this even
noticable while surfing the site. I am wondering about response times since I 
found them a bit slow (the time I click on the link until the page starts to 
display).

Thank you for any advice,

Merlin

PS: The system is a p4 2.4G with 1G RAM and about 500.000PI a month.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] loading 250kb include files, performance degration?

2004-05-11 Thread Matt Matijevich
[snip]
I am working on a complex webapp written in php. Recently I was reading
about 
performance issues and after analysing the code I found that most of
the files 
load 5 external php include files to run. All together those include
files make 
about 250KB (there are 5 files).
[/snip]

The more code php has to compile, the longer it will take.  

Do you need all of the includes on each page?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] search query analyzer

2004-05-11 Thread Paul Godard
Hi

I am looking for some good ideas to combine some fields with query operators (multiple 
words, or/and, >/„/¾<, range of numerical values...).

Let's say I have 2 fields (numerical & text) to combine where the serach criteria can 
be as complicated as this :
- year : >1950, 1960-1965, not1980-2000, >2002
- subject : (boy and bicycle) or (man and tractor)

Is there a bullet proof function that can filter such field values and return a valid 
sql query?

What are the basic rules and operators to use?

Thanks for pointing out relevant link or good advice.
-- 

Kind regards, Paul.

Gondwana
[EMAIL PROTECTED]
http://www.gondwanastudio.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ADS authentication

2004-05-11 Thread Kuldeep Singh Tomar
Hi Ray,

Thanks for your response. I was trying this script also but no success.

I was using following values:

$ldap[‘user’] = ‘tomar’;
$ldap[‘pass’] = ‘passwd’;
$ldap[‘host’] = ‘dc02-del3.vc-del.vcustomer.com’;
$ldap[‘port’] = 389;
$ldap[‘dn’]   = ‘cn’.$ldap[‘user’].’,ou=Department,o=Company Name’;
$ldap[‘base’] = ‘’;
but still getting same error message:

Warning: ldap_bind():  Unable to bind to server: Can't contact LDAP 
server in /usr/local/
apache2/htdocs/test6.php on line 14

Do I need to do any specific change at ADS side or any extra parameter 
in dn side. Had you done any change in ADS server?

Thanks again for your help.

With Regards,

Kuldeep

Ray Hunter wrote:

On Tue, 2004-05-11 at 09:16, Kuldeep Singh Tomar wrote:
 

Hi,

Sorry for it. Can I get some help on this?
   

Here is what i used to query Exchange...now i am no windowz guru, but
from what i understand about exchange and ads exchange will send user
information to ads to be authenticated. So my work around was to all
user to authenticate against exchange ldap, which in turn sends it to
ads.
Just a note if the ldap can bind with the supplied username and password
then they were authenticated for their information.
--
Ray
Example:


// connecting to ldap
$ldap[‘conn’] = ldap_connect( $ldap[‘host’], $ldap[‘port’] )
   or die( “Could not connect to server {$ldap[‘host’]} );
// binding to ldap
$ldap[‘bind’] = ldap_bind( $ldap[‘conn’], $ldap[‘dn’], $ldap[‘pass’] );
if( !$ldap[‘bind’] )
{
   echo ldap_error( $ldap[‘conn’] );
   exit;
}
// search for the user on the ldap server and return all
// the user information
$ldap[‘result’] = ldap_search( $ldap[‘conn’], $ldap[‘base’], ‘uid=’.$ldap[‘user’] );


if( $ldap[‘result’] )
{
   // retrieve all the entries from the search result
   $ldap[‘info’] = ldap_get_entries( $ldap[‘conn’], $ldap[‘result’] );
}
else
{
   echo ldap_error( $ldap[‘conn’] );
   exit;
}

if( $ldap[‘info’] )
{
   // Add the user’s department name and email address
   // to the session
   $_SESSION[‘userdept’] = $ldap[‘info’][0][‘department’][0];
   $_SESSION[‘usermail’] = $ldap[‘info’][0][‘mail’][0];
}
else
{
   echo ldap_error( $ldap[‘conn’] );
   exit;
}
// close connection to ldap server
$ldap_close( $ldap[‘conn’] );
?>

 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] *.pdf into postgres using php

2004-05-11 Thread Dennis Gearon
Please CC me, I am on digest.
Any one done that and can give me some pointers?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ADS authentication

2004-05-11 Thread Ray Hunter
On Tue, 2004-05-11 at 10:14, Kuldeep Singh Tomar wrote:
> Hi Ray,
> 
> Thanks for your response. I was trying this script also but no success.
> 
> I was using following values:
> 
> $ldap[ʽuserʼ] = ʽtomarʼ;
> $ldap[ʽpassʼ] = ʽpasswdʼ;
> $ldap[ʽhostʼ] = ʽdc02-del3.vc-del.vcustomer.comʼ;
> $ldap[ʽportʼ] = 389;
> $ldap[ʽdnʼ]   = ʽcnʼ.$ldap[ʽuserʼ].ʼ,ou=Department,o=Company Nameʼ;
> $ldap[ʽbaseʼ] = ʽʼ;
> 
> but still getting same error message:
> 
> Warning: ldap_bind():  Unable to bind to server: Can't contact LDAP 
> server in /usr/local/
> apache2/htdocs/test6.php on line 14

You need to make sure that the server is listening on the appropriate
port...from what I understand ads might not listen on 389 but on another
port.

> Do I need to do any specific change at ADS side or any extra parameter 
> in dn side. Had you done any change in ADS server?

Your dn does need to be different. You need to have the appropriate dn
for the user that is binding.

I did not connect directly to ads...i connected to exchange and that was
the middleware to ads. It was easier doing that then connecting to ads.

--
ray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php|works

2004-05-11 Thread Chris Shiflett
--- John Nichel <[EMAIL PROTECTED]> wrote:
> Who's going (thinking about) to this?
> 
> http://www.phparch.com/phpworks/

I'm strongly considering it. Proposal deadline is May 21, which is my
birthday, so that's easy to remember. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread Chris Boget
I was looking through the documentation and I could not
figure out why the following is occuring:

On our development server, I have a script that accesses the 
value of $HTTP_RAW_POST_DATA (upon form submission)
and there is data there.  However, on our production server, 
the same code shows no value held in $HTTP_RAW_POST_DATA. 
Both servers are running v4.3.2 and as far as I can tell, have the 
same configuration.  Where would I look to discover why one 
server would have data held in $HTTP_RAW_POST_DATA 
whereas the other server would not?

Anyone have suggestions for where I should be looking?

thnx,
Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread John W. Holmes
From: "Chris Boget" <[EMAIL PROTECTED]>

> On our development server, I have a script that accesses the
> value of $HTTP_RAW_POST_DATA (upon form submission)
> and there is data there.  However, on our production server,
> the same code shows no value held in $HTTP_RAW_POST_DATA.
> Both servers are running v4.3.2 and as far as I can tell, have the
> same configuration.  Where would I look to discover why one
> server would have data held in $HTTP_RAW_POST_DATA
> whereas the other server would not?

Check the value of "always_populate_raw_post_data" in php.ini on both
servers.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread Curt Zirzow
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> 
> Check the value of "always_populate_raw_post_data" in php.ini on both
> servers.

Thats such a funny name.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php calender

2004-05-11 Thread Edward Peloke
I am currently working on a site for a vacation rental company.   They want
the ability to show users the availability of certain properties.  The
availability will be held in a mysql db so I assume I will have to
dynamically build a small javascript menu or somethingI am just looking
for some good suggestions and examples from other's who have done this.

I am not a fan of generating javascript from php.

Thanks,
Eddie

 WARNING:  The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed.  This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing.  You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error,  please notify [EMAIL PROTECTED] by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php calender

2004-05-11 Thread Daniel Clark
It could be a HTML table with links on the properties to view more details.

> I am currently working on a site for a vacation rental company.   They
> want
> the ability to show users the availability of certain properties.  The
> availability will be held in a mysql db so I assume I will have to
> dynamically build a small javascript menu or somethingI am just
> looking
> for some good suggestions and examples from other's who have done this.
>
> I am not a fan of generating javascript from php.
>
> Thanks,
> Eddie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php calender

2004-05-11 Thread Torsten Roehr
"Edward Peloke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am currently working on a site for a vacation rental company.   They
want
> the ability to show users the availability of certain properties.  The
> availability will be held in a mysql db so I assume I will have to
> dynamically build a small javascript menu or somethingI am just
looking
> for some good suggestions and examples from other's who have done this.
>
> I am not a fan of generating javascript from php.
>
> Thanks,
> Eddie

Hi Eddie,

there is a great calendar package in PEAR:
http://pear.php.net/package/Calendar

There is a good example of how to build an HTML calendar from it:
http://pear.php.net/manual/en/package.datetime.calendar.intro-inahurry.php
(scroll down to the middle of the page)

I don't know why you want to use javascript here. I would do it this way:

- select all dates of free vacation properties of the given/current month
- put the dates from the DB result into an array
- create the calendar with the example from above and check for every day if
there is an entry for the day in your array
- if so give the table cell a specific color and/or link to page containing
detailed information
- otherwise blank the cell out or whatever

Hope this helps!

Regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] include (or require) doesn't seem to work

2004-05-11 Thread Daniel Barbar
Hi,

 I'm almost ashamed to ask this question as surely enough the
problem is something very basic but, nonetheless, I can't put my finger on
it. I'm trying to implement the concept of a library (library.php) on PHP
where I define (once) all auxiliary functions and then use them in a file
(for instance index.php) via the 'require' or 'include' constructs. Here's a
reduced version of what I'm doing:



index.php:

";
require("http://tristan/library.php?lang=$lang";);
my_function("en");
?>



library.php:

";
function my_function($lang = "es") {
echo "my_function() says $lang";
}
echo "library.php: loaded";
?>



When I load index.php I get the following:



index.php: include_path is .:/usr/local/php/4.3.6/lib/php
library.php: Called with tristan://library.php?lang=es
library.php: loaded



Fatal error: Call to undefined function: my_function() in
/www/htdocs/index.php on line 5



It seems that the name space on index.php never gets updated
with the function definitions made on library.php. What am I doing wrong?
Thanks! Cheers,



Daniel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: include (or require) doesn't seem to work

2004-05-11 Thread Torsten Roehr
"Daniel Barbar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
>  I'm almost ashamed to ask this question as surely enough the
> problem is something very basic but, nonetheless, I can't put my finger on
> it. I'm trying to implement the concept of a library (library.php) on PHP
> where I define (once) all auxiliary functions and then use them in a file
> (for instance index.php) via the 'require' or 'include' constructs. Here's
a
> reduced version of what I'm doing:
>
>
>
> index.php:
>
>  $lang = (isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "es");
> echo "index.php: include_path is " . (ini_get('include_path'))."";
> require("http://tristan/library.php?lang=$lang";);
> my_function("en");
> ?>
>
>
>
> library.php:
>
>  echo "library.php: Called with $_SERVER[HTTP_HOST]:/$_SERVER[REQUEST_URI]
> ";
> function my_function($lang = "es") {
> echo "my_function() says $lang";
> }
> echo "library.php: loaded";
> ?>
>
>
>
> When I load index.php I get the following:
>
>
>
> index.php: include_path is .:/usr/local/php/4.3.6/lib/php
> library.php: Called with tristan://library.php?lang=es
> library.php: loaded
>
>
>
> Fatal error: Call to undefined function: my_function() in
> /www/htdocs/index.php on line 5
>
>
>
> It seems that the name space on index.php never gets updated
> with the function definitions made on library.php. What am I doing wrong?
> Thanks! Cheers,
>
>
>
> Daniel

Hi Daniel,

take a look at this section of the manual about including remote files:

>>>
If "URL fopen wrappers" are enabled in PHP (which they are in the default
configuration), you can specify the file to be included using a URL (via
HTTP or other supported wrapper - see Appendix J for a list of protocols)
instead of a local pathname. If the target server interprets the target file
as PHP code, variables may be passed to the included file using a URL
request string as used with HTTP GET. This is not strictly speaking the same
thing as including the file and having it inherit the parent file's variable
scope; the script is actually being run on the remote server and the result
is then being included into the local script.
<<<

Try including it as a local file:
require_once library.php'; // if it is in the same directory as the file you
have this line in

Also you don't have to pass $lang via Get to the file as the included code
will have access to $lang as it is then in the scope of the script.

Regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: include (or require) doesn't seem to work

2004-05-11 Thread Torsten Roehr
> Try including it as a local file:
> require_once library.php'; // if it is in the same directory as the file
you

Forgot a quote here, sorry:
require_once 'library.php';

Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include (or require) doesn't seem to work

2004-05-11 Thread Daniel Clark
Think you want something like this.

require("/tristan/library.php");

> Hi,
>
>  I'm almost ashamed to ask this question as surely enough the
> problem is something very basic but, nonetheless, I can't put my finger on
> it. I'm trying to implement the concept of a library (library.php) on PHP
> where I define (once) all auxiliary functions and then use them in a file
> (for instance index.php) via the 'require' or 'include' constructs. Here's
> a
> reduced version of what I'm doing:
>
>
>
> index.php:
>
>  $lang = (isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "es");
> echo "index.php: include_path is " . (ini_get('include_path'))."";
> require("http://tristan/library.php?lang=$lang";);
> my_function("en");
> ?>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP_RAW_POST_DATA

2004-05-11 Thread Chris Boget
> > same configuration.  Where would I look to discover why one
> > server would have data held in $HTTP_RAW_POST_DATA
> > whereas the other server would not?
> Check the value of "always_populate_raw_post_data" in php.ini 
> on both servers.

That was it.  Thank you so very much!!

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php