[Fwd: Re: [PHP] Some error in file upload.]

2002-11-23 Thread Marco Tabini
-Forwarded Message-

> From: Marco Tabini <[EMAIL PROTECTED]>
> To: Naif Al-Otaibi <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Some error in file upload.
> Date: 23 Nov 2002 07:56:06 -0500
> 
> I think this needs changing:
> 
> error-> if(isset(!$WINDIR) && !@unlink($userfile))
> 
> into
> 
> if(!isset($WINDIR) && !@unlink($userfile))
> 
> Also, this would only work if you had register_globals on.
> 
> Mind if I ask which book did you copy the example from?
> 
> 
> Marco
> -- 
> 
> php|architect - The magazine for PHP Professionals
> The monthly worldwide magazine dedicated to PHP programmers
> Check us out on the web at http://www.phparch.com
> 
> 
> On Sat, 2002-11-23 at 07:41, Naif Al-Otaibi wrote:
> > 
> > I copy a complete example from a book to upload file and I got this 
> > message error when I browse the file:
> > 
> > Parse error: parse error, unexpected '!', expecting T_VARIABLE or '$' 
> > in c:\inetpub\wwwroot\php5\file_upload.php on line 32
> > 
> > Here is the content of the file (file_upload.php):
> > 
> >  > // file_upload.php
> >   $archive_dir = "./docs";
> >   function upload_form() {
> > global $PHP_SELF;
> > ?>
> > 
> >  >   ACTION="">
> >   
> >   Upload file!
> >   
> >   
> > 
> >  
> >  >   }
> >   
> >   function upload_file() {
> > global $userfile, $userfile_name, $userfile_size,
> >$userfile_type, $archive_dir, $WINDIR;
> > 
> > if(isset($WINDIR)) $userfile = str_replace
> > ("","\\",$userfile);
> > 
> > $filename = basename($userfile_name);
> > 
> > if($userfile_size <= 0) die ("$filename is empty.");
> > 
> > if(!@copy($userfile, "$archive_dir/$filename"))
> >   die ("Can't copy $userfile_name to $filename.");
> > 
> > error-> if(isset(!$WINDIR) && !@unlink($userfile))
> >   die ("Can't delete the file $userfile_name.");
> >   
> > echo "$filename has been successfully uploaded.";
> > echo "Filesize: " . number_format($userfile_size) . "";
> > echo "Filetype: $userfile_type";
> > 
> > }
> > ?>
> > 
> > FILE UPLOAD
> > 
> >  > if($action == 'upload') upload_file();
> > else upload_form();
> > ?>
> > 
> > 
> > 
> > 
> > -- 
> > 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: [Fwd: Re: [PHP] Some error in file upload.]

2002-11-23 Thread Marco Tabini
Naif,

I think your problem is related to register_globals. The authors of the
book probably based their scripts on a version of PHP that had that
option turned on by default, but as 4.2.0, it's been turned off as it is
usually considered a security risk. So, either use the superglobal
arrays (like $_POST) to access your HTML form variables or turn
register_globals on in your php.ini file.

Cheers,


Marco

Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sat, 2002-11-23 at 08:16, Naif Al-Otaibi wrote:
> Thanks, I fix this error but now I have another one:
> Notice: Undefined variable: action in c:\inetpub\wwwroot\php5
> \file_upload.php on line 45
> 
> I have register_globals on
> 
> > -Forwarded Message-
> > 
> > > From: Marco Tabini <[EMAIL PROTECTED]>
> > > To: Naif Al-Otaibi <[EMAIL PROTECTED]>
> > > Subject: Re: [PHP] Some error in file upload.
> > > Date: 23 Nov 2002 07:56:06 -0500
> > > 
> > > I think this needs changing:
> > > 
> > > error-> if(isset(!$WINDIR) && !@unlink($userfile))
> > > 
> > > into
> > > 
> > > if(!isset($WINDIR) && !@unlink($userfile))
> > > 
> > > Also, this would only work if you had register_globals on.
> > > 
> > > Mind if I ask which book did you copy the example from?
> > > 
> > > 
> > > Marco
> > > -- 
> > > 
> > > php|architect - The magazine for PHP Professionals
> > > The monthly worldwide magazine dedicated to PHP programmers
> > > Check us out on the web at http://www.phparch.com
> > > 
> > > 
> > > On Sat, 2002-11-23 at 07:41, Naif Al-Otaibi wrote:
> > > > 
> > > > I copy a complete example from a book to upload file and I got 
> this 
> > > > message error when I browse the file:
> > > > 
> > > > Parse error: parse error, unexpected '!', expecting T_VARIABLE 
> or '$' 
> > > > in c:\inetpub\wwwroot\php5\file_upload.php on line 32
> > > > 
> > > > Here is the content of the file (file_upload.php):
> > > > 
> > > >  > > > // file_upload.php
> > > >   $archive_dir = "./docs";
> > > >   function upload_form() {
> > > > global $PHP_SELF;
> > > > ?>
> > > > 
> > > >  > > >   ACTION="">
> > > >   
> > > >   Upload file!
> > > >   
> > > >   
> > > > 
> > > >  
> > > >  > > >   }
> > > >   
> > > >   function upload_file() {
> > > > global $userfile, $userfile_name, $userfile_size,
> > > >$userfile_type, $archive_dir, $WINDIR;
> > > > 
> > > > if(isset($WINDIR)) $userfile = str_replace
> > > > ("","\\",$userfile);
> > > > 
> > > > $filename = basename($userfile_name);
> > > > 
> > > > if($userfile_size <= 0) die ("$filename is empty.");
> > > > 
> > > > if(!@copy($userfile, "$archive_dir/$filename"))
> > > >   die ("Can't copy $userfile_name to $filename.");
> > > > 
> > > > error-> if(isset(!$WINDIR) && !@unlink($userfile))
> > > >   die ("Can't delete the file $userfile_name.");
> > > >   
> > > > echo "$filename has been successfully uploaded.";
> > > > echo "Filesize: " . number_format($userfile_size) . "";
> > > > echo "Filetype: $userfile_type";
> > > > 
> > > > }
> > > > ?>
> > > > 
> > > > FILE UPLOAD
> > > > 
> > > >  > > > if($action == 'upload') upload_file();
> > > > else upload_form();
> > > > ?>
> > > > 
> > > > 
> > > > 
> > > > 
> > > > -- 
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > 
> > > 
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> 



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




RE: [PHP] Using Ping (was: using cookies)

2002-11-23 Thread Marco Tabini
I took the liberty of changing the subject of your e-mail because this
way everyone can follow it better.

Well, you can execute the ping command directly from within PHP and then
parse its input. For example:

/dev/null"), $a);

if (count ($a) && $a[1])
echo "success";
else
echo "failure";
?>

This will work only under Unix, but you can very easily adapt it to
whatever os you need, as long as it supports pinging from the command
line.

Marco


php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com


On Sat, 2002-11-23 at 16:08, Paul Marinas wrote:
> 
> dose anyone how to send a "ping" in local network
> 
> thanks
> 
> Paul Marinas
> Technical Support
> RDS Craiova
> 
> 
> Phone:  +402-51-410-194
> Mobile: +407-22-451-439
> Fax:+402-51-416-579
> www.rdsnet.ro
> .
> 
> Privileged/Confidential Information may be contained in this message. If you
> are not the addressee indicated in this
> message (or responsible for delivery of the message to such person), you may
> not copy or deliver this message to
> anyone. In such a case, you should destroy this message and kindly notify
> the sender by reply e-mail.
> 
> 
> 
> -- 
> 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] Passing Variables

2002-11-23 Thread Marco Tabini
Try looking into the manual for register_globals

Marco


php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sat, 2002-11-23 at 14:42, Craig Edgmon wrote:
> I am sure this question has been answered, but there is a ton of data to
> sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
> I am just working with variables and I cannot seem to get them to pass from
> my html file to the php call. I will get the html portion fine, but not the
> variable. I have checked my language and have compared my files with
> supposed good code from a reliable source with the same results. Any idea on
> this. It happens on multiple systems.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] PHP Syntax - mail statement

2002-11-23 Thread Marco Tabini
Probably just a problem with register_globals

Try:

$contents = "{$_REQUEST['firstname']}, {$_REQUEST['lastname']}, {$_REQUEST['email']}";

Marco


php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sat, 2002-11-23 at 18:13, Michael Sharp wrote:
> I have a html form that has just 3 fields and each are defined as
> name="firstname", name="lastname", and name="email" . The action is
> calling a sendmail.php file and the method is POST. Here is the contents
> of sendmail.php:
> 
>  $to = "[EMAIL PROTECTED]";
> $subject = "Form Submission";
> $contents = "$firstname, $lastname, $email";
> mail ($to, $subject, $contents);
> header ("Location: http://probsd.org/rlewis/thankyou.txt";);
> ?>
> 
> When submitting the form, mail gets sent to [EMAIL PROTECTED] with the
> subject defined in sendmail.php, but the contents simply displayes both of
> the commas from $contents =  and not $firstname, $lastname, and $email.
> 
> Syntax error or what?
> 
> Michael
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] php and caching

2002-11-24 Thread Marco Tabini
Caching is usually managed through a set of headers--for example:



You can use these in the pages that are dynamic and omit them in those
pages where you want to keep the information.

Cheers,


Marco

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sun, 2002-11-24 at 12:47, Alex wrote:
> Hi,
> 
> I have a few pages on my site that contains dynamical content that must be
> "processed" each time the page is loaded. But I'd also want to allow the
> users to be able to use the back button of their browser to go back to forms
> and that these forms still contain the information they entered (instead of
> being cleared).
> 
> Can someone give me a hint on how to accomplish this if there's a way to do
> it?
> 
> Thanks,
> 
> Alexandre Soares
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] Php Search Engine

2002-11-25 Thread Marco Tabini
Can you be a bit more specific as to what you need to search on? Is it a
database, a set of web documents or do you want to create a search
engine like Google, which crawls websites as needed?

Let us know!


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
I am in need of a search engine. I'd rather do one in PhP. Is there one
available that I can see or at least get the code for?

I'm a newbie to php. :)


Krystal

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



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


Re: [PHP] spawing new PHP process

2002-11-26 Thread Marco Tabini
Assuming you're working on UNIX--you need to use one of the execute
functions (search for exec in the manual). You can spawn a separate PHP
in the background in a number of way, for example, by using the screen
program. 

If I remember correctly, you can't instantiate it directly and run it in
the background because PHP does not close stdout and stderr--but this
might have changed and/or I may be mistaken (nothing new there).


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
I'm interested in spawing a new PHP process -- if that's the correct terminology.

The situation is that I've got a very slow loading page, where, for example, I'm using 
PHP to send, say, 1000 emails.  The user clicks submit, and, although PHP is firing 
out the emails, it appears to the user that page is hanging.  I'd like to somehow send 
that process to the background and let the page load straight-away.

In another scripting language I've used, this function was called "spawn."

Do we have something like this in PHP (I know we do!! Just can't find it.) I've looked 
through the docs but don't see what I'm looking for.

Thanks in advance.

-Bob


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



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


Re: [PHP] FTP and security

2002-11-26 Thread Marco Tabini
Rich,

Why don't you create an ssh tunnel between your two boxes and then
perform you ftp connection through there? This way, the connection would
be secure and you could impersonate whichever user you need to.

There is also a secure version of ftp, but I don't think that it can be
instantiated directly from PHP, and you would therefore have to run it
from a shell, which would give the same problems you have with ssh now.


Marco

-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---

My company, as a matter of policy, closes the ftp ports of the servers in the DMZ. 
However, I am not convinced that this is necessary, given the advent of very secure 
ftp servers. I would appreciate any comments on the security of an open ftp port. To 
relate this to php, I am ready to give up trying to make my 

system("scp ..");

code work, because I will have to give the apache user more permissions than I am 
comfortable with. So, I am thinking fo using php's ftp commands instead. I see nowhere 
in the documentation however, if the ftp_connect can be done via the ssh transport 
mechanism. Or, is this unnecessary, and can I use ftp (with plain text user and 
password passed to ftp_login()) on port 21 without worrying about getting hacked? 

muchas gracias

Rich

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


Re: [PHP] FTP and security

2002-11-26 Thread Marco Tabini
Well, as far as I know you need to have sshd (or an equivalent) running
on the receiving end. Then, on your server you call up a command like
so:

ssh -f -2 -N -L {source-port}:{end-address}:{end-port}
{sshd-server-address} -l {login}

This command causes ssh to create a secure tunnel that goes from
source-port on your server to end-address:end-port through the ssh
server {sshd-server-address}. Clearly, {sshd-server-address} and
{end-address} can be the same computer, but not necessarily--as long as
there is a direct route between the two and you can consider that route
secure.

Once you've established the connection, you can connect to your local
box on the {source-port}, and your data will be transparently (and
securely) redirected to the new box.

For example:

ssh -N -2 -f -L 3307:my.mysql.box:3306 my.mysql.box -l mysql_user

creates a secure tunnel for connecting to a remote MySQL server
securely. After you've established the connection, you can use
127.0.0.1:3307 on your local box to connect to MySQL and your data will
be transported securly to the other computer.

Hope this helps... a more complete (and probably more accurate)
explanation would take a long time, but if you look around on the Net
you should find plenty of resources.

Cheers,


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Marco,

Would you have any examples for using an SSH tunnel? I'm using fsockopen
to get data from proprietary server software (just returns data to me in
different formats) and I would like to have it secure. I'm just not sure
how I could incorporate that.

Thanks,

Bryan


On 26 Nov 2002, Marco Tabini wrote:

|Rich,
|
|Why don't you create an ssh tunnel between your two boxes and then
|perform you ftp connection through there? This way, the connection would
|be secure and you could impersonate whichever user you need to.
|
|There is also a secure version of ftp, but I don't think that it can be
|instantiated directly from PHP, and you would therefore have to run it
|from a shell, which would give the same problems you have with ssh now.
|
|
|Marco
|
|



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


Re: [PHP] URL hiding

2002-11-26 Thread Marco Tabini
If index.php is the index page of your website, then you do not need to
specify it at all.

i.e. www.whatever.com/index.php?uName=Kris

is functionally equivalent to www.whatever.com?uName=Kris

A way to get rid of the variables passed in the query string is to use
POST instead of GET as the method of your HTML form.


Hope this helps,


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi

When I pass variables to a new page in the address bare of the browser it looks like

www.whatever.com/index.php?uName=Kris&passWd=1234

How can I hide this so it's just

www.whatever.com/index.php or even better just

www.whatever.com

thanks

Kris


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


Re: [PHP] URL hiding

2002-11-26 Thread Marco Tabini
Then the only solution I can think of is to make them part of the POST
variables somehow--ie. through a hidden field, which you can even fill
dynamically with Javascript. AFAIK that's the only way.

Cheers,


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
I already use POST as the form method.
I know
www.whatever.com/index.php?uName=Kris can be the same as
www.whatever.com?uName=Kris

I just want to get rid of the ?uName=Kris part on the end
I still need the variables to be passed I just don't want the user to be
able to see them.

Thanks for your help

Kris

- Original Message -----
From: "Marco Tabini" <[EMAIL PROTECTED]>
To: "Kris" <[EMAIL PROTECTED]>
Cc: "PHP-General" <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 9:12 AM
Subject: Re: [PHP] URL hiding


> If index.php is the index page of your website, then you do not need to
> specify it at all.
>
> i.e. www.whatever.com/index.php?uName=Kris
>
> is functionally equivalent to www.whatever.com?uName=Kris
>
> A way to get rid of the variables passed in the query string is to use
> POST instead of GET as the method of your HTML form.
>
>
> Hope this helps,
>
>
> Marco
> --
> 
> php|architect - The magazine for PHP Professionals
> The first monthly worldwide magazine dedicated to PHP programmers
>
> Come visit us at http://www.phparch.com!
>






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


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



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


Re: [PHP] How to create zip files in PHP ?

2002-11-27 Thread Marco Tabini
You will have to invoke an external utility, like PKZIP on Windows or
zip on Linux to create the archives you need.


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi,sir:

How to create  zip files  in  PHP ?
I found that php's zip function  are read only...
Can any one help me with that ? 

Thanks

Fongming 2002-11-28






-
This mail sent through IMP: http://web.horde.org/imp/

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



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


Re: [PHP] String function

2002-11-28 Thread Marco Tabini
You can use strstr:

if (strstr ($str, '.'))
echo 'Full stop';
else
echo 'No full stop';

Marco

-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

On Thu, 2002-11-28 at 08:49, Shaun wrote:
> Hi,
> 
> Please can someone tell me how i can tell if a string contains a full stop?
> 
> thanks
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] php and https

2002-11-29 Thread Marco Tabini
Is this related to PHP? Or are you getting the error from your browser?
In that case, are you using IE? If so, it might be a bug with IE--I've
seen it discussed in a few mailing lists.

Otherwise, it might indicate that the web server you're connecting to is
not configured properly.


Marco

-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi,

I'm trying to connect to a https site to get a file.

The target site replies to me: "Unable to service this URL without parent
cache."

Is there someone who knows what that means?

Thanks,

Greg.


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



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


Re: [PHP] Weblogs

2002-12-01 Thread Marco Tabini
b2, which you can find here:

http://cafelog.com/

Cheers,


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

On Sun, 2002-12-01 at 09:35, Randum Ian wrote:
> Can anybody recommend a good PHP weblog script?
>  
> Cheers in advance,
> Randum Ian
> [EMAIL PROTECTED]
> DJ / Reviewer / Webmaster, DancePortal (UK) Limited 
> DancePortal.co.uk - Global dance music media
>  



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




Re: [PHP] PHP Trouble-Ticket-Systems?

2002-12-01 Thread Marco Tabini
http://www.inicrm.com

Offered as an ASP (my company produces it, so... shameless plug)


Marco

On Sun, 2002-12-01 at 10:59, Thomas Seifert wrote:
> Hi folks,
> 
> I already searched through the web but couldn't find any which provide the features 
>I want.
> 
> What I would want to see in such a system:
> - adding TroubleTickets through webinterface or sending an email to an support 
>email-address
> - adding answers to troubletickets to their parent 
> - nice admininterface to answer support-requests and add comments (not sent to 
>visitors)
> - open/close/stalled/bogus ... and so on tags for the system
> - ...
> 
> 
> So the question is, does anyone know any good troubleticket/helpdesk-systems written 
>in PHP?
> 
> 
> Thanks,
> 
> Thomas
> 
> -- 
> 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] Call to undefined function: mysql_foo()...

2002-12-01 Thread Marco Tabini
Is it possible that phpBB is using a different copy of PHP?


On Sun, 2002-12-01 at 14:21, Adam Atlas wrote:
> I'm having a strange problem. If I run any MySQL function, I get the 
> error message "Call to undefined function: mysql_foo()". Why would I be 
> getting this? I've checked php.ini to see if it has the 
> extension=mysql.so line, and I've run a phpinfo() script which says PHP 
> was compiled with MySQL and it does have a MySQL section. The strangest 
> part is that I have a perfectly functional phpBB installation using a 
> MySQL database. Am I missing something obvious?
> 
> --
> Adam Atlas
> 
> "During my service in the United States Congress, I took the initiative 
> in creating the Internet." - Al Gore, March 9, 1999: On CNN's Late 
> Edition
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] PHP and the PDFlib

2002-12-02 Thread Marco Tabini
Take a look at the iText library--it's a Java library, but you can build
your Java classes and then instantiate them through PHP by executing
them as external apps.

That's what we use to personalize copies of our magazine.


Marco

-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

On Sun, 2002-12-01 at 21:58, Ryan Smaglik wrote:
> Has anyone found any other means of opening an existing pdf file and adding
> text to it?  The only thing I could find is the  PDI + PDFlib commercial
> combo which I do not have the $1000 to dish out right now...
> 
> Any Ideas? 



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




Re: [PHP] PHP Sessions

2002-12-04 Thread Marco Tabini
Are you sure? I thought $_SESSION was a superglobal.


Marco

On Wed, 2002-12-04 at 09:15, Justin French wrote:
> Good point -- are the included files functions, or other stuff??
> 
> function myfunc()
> {
> return $_SESSION['something'];
> }
> 
> will not work, but:
> 
> 
> function myfunc()
> {
> global $_SESSION;
> return $_SESSION['something'];
> }
> 
> will...
> 
> J
> 
> 
> 
> on 05/12/02 1:14 AM, Ryan Gibson ([EMAIL PROTECTED]) wrote:
> 
> > May be a silly question but are u using a global statement in the include
> > files, just a thought
> > 
> > 
> > on 4/12/02 1:11 pm, Andy Kirk at [EMAIL PROTECTED] wrote:
> > 
> >> Can anyone tell me if session variables should be available to scripts that
> >> are included into the main script?
> >> 
> >> It appears to me that they are not unless I am really missing the point.
> >> 
> >> 
> >> 
> > 
> 
> Justin French
> 
> http://Indent.com.au
> Web Development & 
> Graphic Design
> 
> 
> 
> -- 
> 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] Max File Size

2002-12-04 Thread Marco Tabini
Are you sure you're looking at the right php.ini? Try calling phpinfo()
and check where PHP is looking for the ini file.


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi,

I'm having a problem uploading files greater than 2mb, but I believe the
problem is related to php.ini.

UPLOAD_MAX_FILESIZE in my submit form is set to 1000.  Also, I set
upload_max_filesize = 1000 in php.ini.  After changing php.ini, I
stopped and then started httpd.  I thought this was enough to be able to
upload files greater than the default 2mb.

Even though php.ini has been changed, when I check phpinfo.php, I see that
upload_max_filesize is still 2mb and my file is not being uploaded.

Can anyone tell me what I am missing here.

Thanks,

Roger Lewis


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



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


Re: [PHP] force download with header()

2002-12-08 Thread Marco Tabini
Are you using Internet Explorer? Then it's a "feature" of IE--it ignores
the disposition headers sent by your server because its registry tells
it that PDF files must be "viewed" inline. There's a way around it,
although it's a bit kludgy--I wrote a small article about it that you
can find here (it's in PDF format, as well): 

http://www.phparch.com/issuedata/2002/december/sample.php

Essentially, you're telling IE to download a file with the extension
".pdf " (not the space) so that it can't match the MIME type anymore and
will follow your suggestion of downloading the file instead of
displaying it inline.

Hope this helps!

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
i was reading about php.net looking for a way to force a download of a txt file, 
rather than the browser displaying the file.
i ran into header() that seems to be able to accomplish it... but seeing as i'm very 
much a newbie at php, i can't seem to make this work
if the file i want to download is
nfo/60/ind.txt

how would i impliment this:



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


Re: [PHP] Question about "if" statement evaluating (0=="string")as TRUE

2002-12-13 Thread Marco Tabini
I think this is happening because you're comparing apples to oranges.
Your first comparison causes an integer to be compared to a string.
Because the string "string" evaluates to the integer value 0, the
comparison succeeds. The manual recommends the use of the identical
comparison operator (===) instead, or--better yet--the strcmp() function
when comparing two strings.

Cheers,


Marco

-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Erm... this seems a bit odd to me.  I'm using PHPv4.2.2 on Win32

Is that becuase PHP is not properly comparing the numerical value with
the string value?





--
Scott Hurring
Systems Programmer
EAC Corporation
scott (*) eac.com
--



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



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


Re: [PHP] Fw: Formatting dates (from MySQL)

2002-12-14 Thread Marco Tabini
You should be able to use strtotime() to transform the datetime string
into a UNIX timestamp, which you can then format back using date().
However, this is a very circuitous way--either use SQL to format it or,
if your DBMS supports it, have it returned already as a UNIX timestamp.
The actual SQL commands depend on which DBMS you actually use.


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Hey there,

I was just looking at the date/time functions
(http://www.php.net/manual/en/function.time.php) and I can't seem to find a
function that can format a date that is supplied in the format of a DATETIME
column.

So, I was wondering, is there a function that can format it properly or
should I let the database handle the formatting (I'm really new to SQL, I
didn't come across anything to mod in the select statement yet). I could
ofcourse split it on space for a time and a date var and then split the date
on -'s for years, months and days but efficient is something else I think
:-) In the archives I saw some examples doing exactly that, but nothing with
a single function (unless home defined ofcourse).

Kind regards and TIA




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



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


Re: [PHP] Undefined Variable

2002-12-14 Thread Marco Tabini
Best guess, your local server has register_globals on and your ISP
doesn't. However, without seeing your code it's going to be difficult to
tell for sure! :-)


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Using MS Win 98 / Apache Server:

I'm trying to test a form box using the php mail() function.

All is well when I fill in the text boxes and hit submit.

I receive the e-mail.

The form action in the html page is:

http://localhost/getform.php";  METHOD="POST">

_Now_

when I copy both of those files which are:

1. The html file for the form box

- I have now changed the form action to read:

http://www.narrowsburg.org/getform.php";  METHOD="POST">

and

2. the .php file for the script

and publish them to my site which is hosted on my ISP's MS Server, and then
input data in the form boxes and hit submit:

I now get the following:
..
NOTICE: Undefined Variable: name in
d:\inetpub\www.narrowsburg.org\getform.php  in line 7


Then, when I check my e-mail I get a message with no input data from the
variables like the name, e-mail, address, etc.

Thanking all in advance who might help me out.
Tony Ritter








--





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



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


Re: [PHP] Undefined Variable

2002-12-14 Thread Marco Tabini
Hey Anthony--

It's definitely a register_globals problem. Your ISP has turned it off
because it's generally considered a significant security risk.

The best way to solve it is to use the superglobal $_POST to access your
post data. In your PHP script, change all the variables that you take
from the form into their $_POST[''] equivalent (see below for a rough
example--I put the assignments at the beginning because I wanted to
touch your code as little as possible). Also, keep in mind that you're
not performing any checks on the data--I'm sure you want to do it once
you've sorted the current problem out, but the way it is now you're
leaving yourself exposed to a number of possible attacks.

$thename = $_POST['thename'];
$email = $_POST['email'];
$description = $_POST['description'];
$bizname = $_POST['bizname'];
$contactname = $_POST['contactname'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$mailing = $_POST['mailing'];
$town = $_POST['town'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$cat = $_POST['cat'];

if (($thename == "") && ($email == "") && ($description == "")) {
 header("Location: http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:$thename\n";
$msg .= $thename ."'s business name is:$bizname\n";
$msg .= "The contact person is:$contactname\n";
$msg .= $thename. "'s phone number is:$phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:  $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
>"Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Best guess, your local server has register_globals on and your ISP
> doesn't. However, without seeing your code it's going to be difficult to
> tell for sure! :-)
>
>
> Marco


Thanks for the reply Marco.

The following is the code.  Any advice would be greatly appreciated.
Happy holidays...
Tony


//this is the the html page


http://www.narrowsburg.org/getform.php"; METHOD="POST">

Your Name:
Business Name:
Contact Person:
Telephone Number:
e-mail address:
Mailing Address:
Town:State:  Zip Code:
Category:
Description of your business: 






//this is the .php file called "getform.php"

http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:$thename\n";
$msg .= $thename ."'s business name is:$bizname\n";
$msg .= "The contact person is:$contactname\n";
$msg .= $thename. "'s phone number is:$phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:  $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
.



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



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


Re: [PHP] Session: I RTFM

2002-12-14 Thread Marco Tabini
I haven't followed the rest of the thread, but how about using a
function?

function getvar ($varname)
{
if (isset ($_POST[$varname])
{
$_SESSION[$varname] = $_POST[$varname];
return $_POST[$varname];
}
elseif (isset ($_SESSION[$varname]))
return $_SESSION[$varname];
}

session_start();

// You don't need session_register anymore

$familyname = getvar('familyname');


and so on--just one line per variable.

Hope this helps.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
>Jason wrote:
>RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.

>Sessions depends on a number of factors
>including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
cleaner way?


";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname";
}




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



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


Re: [PHP] Session: I RTFM

2002-12-15 Thread Marco Tabini
Single quotes are normal strings. Double quotes are strings in which
substitutions can take place. For example:



Double quotes also expand escape strings (e.g."\n") whereas single
quotes don't.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Marco (or anyone)

What is the difference between:
$familyname = getvar("familyname");
and
$familyname = getvar('familyname');

What do single quotes do, as a general rule, that double cannot (he asks remembering 
something, but not sure what)?




Marco Tabini wrote:

> I haven't followed the rest of the thread, but how about using a
> function?
>
> function getvar ($varname)
> {
> if (isset ($_POST[$varname])
> {
> $_SESSION[$varname] = $_POST[$varname];
> return $_POST[$varname];
> }
> elseif (isset ($_SESSION[$varname]))
> return $_SESSION[$varname];
> }
>
> session_start();
>
> // You don't need session_register anymore
>
> $familyname = getvar('familyname');
>
> and so on--just one line per variable.
>
> Hope this helps.
>
> Cheers,
>
> Marco
> --
> 
> php|architect - The Magazine for PHP Professionals
> The monthly magazine dedicated to the world of PHP programming
>
> Check us out on the web at http://www.phparch.com!
>
>   
>---
>
> Subject: [PHP] Session: I RTFM
> Date: Sat, 14 Dec 2002 18:41:40 -0500
> From: John Taylor-Johnston <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Organization: FLSH, U-de-S
> To: [EMAIL PROTECTED]
>
> >Jason wrote:
> >RTFM again.
>
> Jason, again, I RTFM, but did not get it working.
> Otherwise I wouldn't have dared ask a question.
>
> >Sessions depends on a number of factors
> >including your version of PHP and the setting of register_globals.
>
> The FM manual says:
>
> "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
>
> So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)
>
> Ok. I quit using $HTTP_POST_VARS["familyname"].
>
> With a little rethinking, I have this working, I hope.
>
> Now ... is there a cleaner way to assign my variable "familyname"?
>
> Pseudo code:
>
> if _post["familyname"] exists set session variable
>  (no sense in setting it until I post it)
> if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
>
> I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
>cleaner way?
>
>  #session_name("TestALS");
> session_start();
>
> if (isset($_POST["familyname"]))
> {
> session_register("familyname");
> $familyname = $_POST["familyname"];
> echo "Yay: \$familyname= $familyname";
> }
>
> if (isset($_SESSION["familyname"]))
> {
> $familyname = $_SESSION["familyname"];
> echo "yay session works, \$familyname= $familyname";
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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



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


Re: [PHP] mail()

2002-12-16 Thread Marco Tabini
You need to use HTML mail. There's an example on how to this in the
manual.


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Is there anything special you have to do to send a link in an e-mail with
the mail function?

I used the mail function this weekend and set the mail contents like this:
$mailcontents="Thank you for registering with us /n"
  ."http://www.oursite.com";;

But in the actual e-mail sent, the link was plain text,not a link.  Can I
force it to be a link?

Thanks,
Eddie


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



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


Re: [PHP] PHP shell scripting not working right?

2002-12-16 Thread Marco Tabini
In Unix you need to specify the working folder when you are launching an
executable, otherwise Bash will try to look into its search path, which
does not include the current folder. Try:

./test.php

That should work. BTW--running "test" by itself only *looks* like
hitting enter--it's really a valid command. Try man test for more info.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
I'm trying to do shell scripting in PHP.  I have PHP installed in 
/usr/bin/php.  I have the following script:
#!/usr/bin/php -q

print "Success!\n";
?>
It's saved as test.php and CHMODed to 777.  When I type "test.php" at 
the command line, it says:

bash: test.php: command not found

When I type "test", it acts like I just hit enter.  Typing "/usr/bin/php 
-q test.php" does work.  Does anyone know what I'm doing wrong?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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


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


Re: [PHP] Divide into words

2002-12-16 Thread Marco Tabini
You could use strpos--there are easier ways if you don't need the
offsets.

Example:



This is from memory, but it looks like it should work even for weird
strings like the one above.

Cheers,


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi!

For example i have some words:

Today is very beautiful day and sun is shining

What i want to get from this is array

words
 [Today] => 0
 [Is] => 6,30
 [Very] => 8
 [beautiful] => 12
 ..

Can somebody please help me with this. Those nubers are
position of special word in above sentence. If word repeates
i want to have both positions saved in same row like word is.

I tried something but i think it's to lame.


-- 
bye,
 Uros


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



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


RE: [PHP] Divide into words

2002-12-16 Thread Marco Tabini
John,

I'm not sure this will work if there is more than one space between
words.

Also, my previous example won't work if there are duplicate words
(although it's easy to make an array out of each word and solve the
problem), nor if the words are delimited by any character other than
spaces, in which case regex are probably our best bet.

Cheers,


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
> For example i have some words:
> 
> Today is very beautiful day and sun is shining
> 
> What i want to get from this is array
> 
> words
>  [Today] => 0
>  [Is] => 6,30
>  [Very] => 8
>  [beautiful] => 12
>  ..
> 
> Can somebody please help me with this. Those nubers are
> position of special word in above sentence. If word repeates
> i want to have both positions saved in same row like word is.
> 
> I tried something but i think it's to lame.

Well you could've at least shown us what you had so far instead of
letting us solve the problem for you:

$string = "Today is a very beautiful day and the sun is shining";

$words = explode(" ",$string);
$pos = 0;

foreach($words as $word)
{
if(isset($w[$word]))
{ $w[$word] .= ",$pos"; }
else
{ $w[$word] = $pos; }

$pos += strlen($word) + 1;
}

print_r($w);

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



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


Re: Re[2]: [PHP] Divide into words

2002-12-16 Thread Marco Tabini
Yes, but my example was geared towards trying to work through a more
generic scenario. I'll bet if you try using perl regex with callback
it'll be even faster.


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---
Hi!

I have dome almost the same

$input = 'Today is a very beautiful day and the sun is shining';

$output = array();
$words = explode(' ',$input);

$cur_pos = 0;
foreach($words as $word) {
if(!empty($output[$word])){
$output[$word] .= ','.$cur_pos;
} else {
$output[$word] = $cur_pos;
}
$cur_pos += strlen($word) + 1;
}
unset ($word);


but i thought if there is some better way. I also tried
Marco's example and adjust it a little bit to get the same
results. And here is some benchmark i have.

with this example i get  0.0024310350418091
and with Marco's i get 0.0034389495849609s

So using two array is faster anyway. Probably of explode
speed.

-- 
bye,
 Uros
Monday, December 16, 2002, 6:36:37 PM, you wrote:

>> For example i have some words:
>> 
>> Today is very beautiful day and sun is shining
>> 
>> What i want to get from this is array
>> 
>> words
>>  [Today] => 0
>>  [Is] => 6,30
>>  [Very] => 8
>>  [beautiful] => 12
>>  ..
>> 
>> Can somebody please help me with this. Those nubers are
>> position of special word in above sentence. If word repeates
>> i want to have both positions saved in same row like word is.
>> 
>> I tried something but i think it's to lame.

JWH> Well you could've at least shown us what you had so far instead of
JWH> letting us solve the problem for you:

JWH> $string = "Today is a very beautiful day and the sun is shining";

JWH> $words = explode(" ",$string);
JWH> $pos = 0;

JWH> foreach($words as $word)
JWH> {
JWH> if(isset($w[$word]))
JWH> { $w[$word] .= ",$pos"; }
JWH> else
JWH> { $w[$word] = $pos; }

JWH> $pos += strlen($word) + 1;
JWH> }

JWH> print_r($w);

JWH> ---John W. Holmes...

JWH> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
JWH> today. http://www.phparch.com/


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



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


Re: [PHP] key pairs

2002-12-17 Thread Marco Tabini
This is a bit crude but should work:



Note that I made a bunch of assumptions here--that the data is always
properly formatted, that there is only one record in the $data, and that
you will later manipulate the key names so that they will actually work
as database columns. Still, this way you can manipulate each value
directly in the function, which is something that I always find very
practical, so you can add whatever additional checks need to be
performed.

Hope this helps!

Cheers,


Marco
-- 

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!

--- Begin Message ---

   I have the following bit of information coming in that I need to 
generate key pairs of so I can drop it all into a database.  I'm 
creating tables for each section (SHIP_TO and BILL_TO) with matching 
Unique_IDs.  What's the best way to go about this (creating the pairs, 
stripping off excess spaces from some fields that have them after the 
last character, etc., etc.)

-- data --
 SHIP TO:
 Business Name:
 Contact Name: Ashley Kirchner
 Day Number:   303 442-6410
 Evening Number:
 Fax Number:
 Address:  3550 Arapahoe Ave., Ste. #6
 Address:
 Address:
 City: Boulder
 State/Province:   CO
 Zip/Postal Code:  80303
 Country:  USA

 BILL TO:
 Business Name:
 Contact Name: Ashley M. Kirchner
 Day Number:   303 4426410
 Evening Number:
 Fax Number:   303 442-9010
 Address:  3550 Arapahoe Avenue
 Address:  Suite #6
 Address:
 City: Boulder
 State/Province:   CO
 Zip/Postal Code:  80303
 Country:  USA
--


--
W | I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.




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


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


Re: [PHP] Resource limit/performance questions

2002-12-20 Thread Marco Tabini
IMHO it depends on the amount of operations you have to perform on your
rows. If manipulating 2,600 rows takes several seconds, then either
you're performing some really complicated data manipulation or your db
could use some optimization. I have an application that manipulates
~150,000 rows on a Pentium II 350 MHz and that takes at most half a
second (although I'm doing really simple statistical stuff).

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
I'm working on a php/mysql ap, which looks as though it will be dealing
with an average of

160,000 rows of short text entries =
32 megs of drives space

Anybody have ideas about what if any limits I might hit? And how I might
be able to determine any limits at this point when we have only 2 weeks
(.6 megs and 2600 rows) of what will be 2 years of data? I have full
access to my linux server. I notice that when executing one set of
statements for one page, it is now using in the 80 to 90% range of CPU
states, and works for maybe 3 or 4 seconds to return the querys. I am at
present doing this testing on a 550 mhz processor, but will be running
the ap on a dual 500s.

Am I getting totally out of hand in thinking I can do this?

TIA
-- 
John Hinton - Goshen, VA.
http://www.ew3d.com

Those who dance are considered insane 
by those who can't hear the music

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



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


Re: [PHP] Resource limit/performance questions

2002-12-20 Thread Marco Tabini
Well, then, assuming your complexity grows linearly, I guess you'll have
to wait a few minutes with 160,000 rows on which you can expect to
perform 16,000 queries...

You mention that you perform the queries on objects--can you elaborate
on this point?


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
In one main instance, I'm doing 10 querys on an array of 26 unique
objects extracted from the database. So, I suppose it is running 260
queries on 2600 lines of code.

Marco Tabini wrote:
> 
> IMHO it depends on the amount of operations you have to perform on your
> rows. If manipulating 2,600 rows takes several seconds, then either
> you're performing some really complicated data manipulation or your db
> could use some optimization. I have an application that manipulates
> ~150,000 rows on a Pentium II 350 MHz and that takes at most half a
> second (although I'm doing really simple statistical stuff).
> 
> Cheers,
> 
> Marco
> --
> 
> php|architect - The Magazine for PHP Professionals
> The monthly magazine dedicated to the world of PHP programming
> 
> Check us out on the web at http://www.phparch.com!
> 
>   
> 
> Subject: [PHP] Resource limit/performance questions
> Date: Fri, 20 Dec 2002 15:31:58 -0500
> From: John Hinton <[EMAIL PROTECTED]>
> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> 
> I'm working on a php/mysql ap, which looks as though it will be dealing
> with an average of
> 
> 160,000 rows of short text entries =
> 32 megs of drives space
> 
> Anybody have ideas about what if any limits I might hit? And how I might
> be able to determine any limits at this point when we have only 2 weeks
> (.6 megs and 2600 rows) of what will be 2 years of data? I have full
> access to my linux server. I notice that when executing one set of
> statements for one page, it is now using in the 80 to 90% range of CPU
> states, and works for maybe 3 or 4 seconds to return the querys. I am at
> present doing this testing on a 550 mhz processor, but will be running
> the ap on a dual 500s.
> 
> Am I getting totally out of hand in thinking I can do this?
> 
> TIA
> --
> John Hinton - Goshen, VA.
> http://www.ew3d.com
> 
> Those who dance are considered insane
> by those who can't hear the music
> 
> --
> 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

-- 
John Hinton - Goshen, VA.
http://www.ew3d.com

Those who dance are considered insane 
by those who can't hear the music

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



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


Re: [PHP] Resource limit/performance questions

2002-12-20 Thread Marco Tabini
Well, the execution time depends on a number of factors. If your tables
are indexed properly and you take advantage of the indexes, then the
growth in execution time is not linear (I'm guessing the indexes are
maintained through balanced or semi-balanced trees or a similar method).
However, in your case, it's not the execution time but the number of
executions. Even under the best of circumstances, if the number of
queries increases in relation to the number of records, then you will
notice a proportional slowdown. If the queries do not use your indexes,
then the slowdown will probably be geometric, since the SQL engine will
have to spend more time sorting through the records for each query.

I usually say queries... it's worked so far :-)


Marco 
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
I was wondering if this would grow linearly... as the data collects? So,
if it takes 3 seconds to do 2600 rows, will it take 30 seconds to do
26000 rows? I am using a simple for statement to send the 26 records
through the 10 querys.

A typical select is:

SELECT DISTINCT DATE_FORMAT(date, '%Y%m%d'), field2 FROM $table WHERE
field2 NOT LIKE '$anoption' AND field3 LIKE '$field2[$i]' AND
TO_DAYS(NOW()) - TO_DAYS(date) <= 30";

This select is run over with five different date <= numbers... then done
without the DISTINCT again over the same five time periods.

The array of records being sent through the 10 querys should not grow
too very large (26 in fact is a fairly high representation of what would
be average), whereas the number of records will grow at a fairly
predictable rate, with the same basic number of records added each day.

I should have said records, instead of objects. (too many sessions with
crAccess, too little time talking to real people about databases)

Now... would you spell that querys or queries?

Marco Tabini wrote:
> 
> Well, then, assuming your complexity grows linearly, I guess you'll have
> to wait a few minutes with 160,000 rows on which you can expect to
> perform 16,000 queries...
> 
> You mention that you perform the queries on objects--can you elaborate
> on this point?
> 
> Marco
> --
> 
> php|architect - The Magazine for PHP Professionals
> The monthly magazine dedicated to the world of PHP programming
> 
> Check us out on the web at http://www.phparch.com!
> 
>   
> 
> Subject: Re: [PHP] Resource limit/performance questions
> Date: Fri, 20 Dec 2002 15:47:07 -0500
> From: John Hinton <[EMAIL PROTECTED]>
> To: Marco Tabini <[EMAIL PROTECTED]>
> CC: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> References: <[EMAIL PROTECTED]>
>  <[EMAIL PROTECTED]>
> 
> In one main instance, I'm doing 10 querys on an array of 26 unique
> objects extracted from the database. So, I suppose it is running 260
> queries on 2600 lines of code.
> 
> Marco Tabini wrote:
> >
> > IMHO it depends on the amount of operations you have to perform on your
> > rows. If manipulating 2,600 rows takes several seconds, then either
> > you're performing some really complicated data manipulation or your db
> > could use some optimization. I have an application that manipulates
> > ~150,000 rows on a Pentium II 350 MHz and that takes at most half a
> > second (although I'm doing really simple statistical stuff).
> >
> > Cheers,
> >
> > Marco
> > --
> > 
> > php|architect - The Magazine for PHP Professionals
> > The monthly magazine dedicated to the world of PHP programming
> >
> > Check us out on the web at http://www.phparch.com!
> >
> >   
> >
> > Subject: [PHP] Resource limit/performance questions
> > Date: Fri, 20 Dec 2002 15:31:58 -0500
> > From: John Hinton <[EMAIL PROTECTED]>
> > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> >
> > I'm working on a php/mysql ap, which looks as though it will be dealing
> > with an average of
> >
> > 160,000 rows of short text entries =
> > 32 megs of drives space
> >
> > Anybody have ideas about what if any limits I might hit? And how I might
> > be able to determine any limits at this point when we have only 2 weeks
> > (.6 megs and 2600 rows) of what will be 2 years of data? I have full
> > access to my linux server. I notice that when executing one set of
> > statements for one page, it is now using in the 80 to 90% ran

Re: [PHP] Date Subtraction

2002-12-23 Thread Marco Tabini
I don't think you can use strtotime in that case. However, assuming that
your data is properly formatted every time, you can use a simple
function like this (I'm doing it from memory, so it might not actually
work):



Hope this helps.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
I have two periods in time from a Cisco router that I would like to find the
difference in seconds. I am not sure the best way to do this since it is not
a date, but rather an amount of time since last reset.

Here is the numbers

181 days, 7:11:06.66
//stands for 181 days, 7 hours, 11 minutes, 6.66 seconds.

The next is

181 days, 7:16:6.75
//stands for 181 days, 7 hours, 16 minutes, 7.75 seconds.

I would probably shave off the .66 and .75 seconds while it was still a
string. It may be faster to round when it's in seconds, I really don't know.
Then what do I do?

I was thinking of using strtotime(); but because it's not really a date, I
am at a loss for what to do.

Any help with this would be great.



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



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


Re: [PHP] Does PHP recognize multiple selections in a form?

2002-12-27 Thread Marco Tabini
Hello Micah--

Yes, PHP supports multiple selections, but you need to change the name
of the control from submitID to submitID[], so that it will become an
array once inside your script.

Hope this helps!


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
grrr... I am trying to get several values from a selection form field (using
multiple) into PHP.  Is this possible?  The code I'm using to test this is
below.  After running the code and selecting more than one field, the last
field (the greatest number) is the only one that shows up as the only input
from the selection part of the form!!  Is there any other way??

thanks,
Micah








[] @ 




Item
 
'.$i.''."\n";
 }

?>








';
var_dump($_POST);
echo '';

echo '';
highlight_file($phpFile);
?>





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



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


Re: [PHP] Load Data Infile

2002-12-29 Thread Marco Tabini
I'm not sure how MySQL works under Windows, but you should either use
double backslashes (\\) instead of single backslashes or use forward
slashes (/) instead. MySQL is trying to escape your string.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

--- Begin Message ---
Off topic but I hope somebody can help.

Using MS Win98 / mySQL.

I'm trying to use LOAD DATA INFILE and coming up empty.

My text file is named:

test.txt
..

and is stored in C:\TextFiles

on the command line I type:
..
mysql>  LOAD DATA INFILE "C:\TextFiles\test.txt" INTO TABLE tony;

...
I get:

ERROR 1105 File c:\TextFile\ est.txt not found (Errcode:2)

\\please note that the "t" in test is not there.

Any help would be greatly appreciated.
Happy holidays,
Tony Ritter



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



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


Re: [PHP] creating a .doc file in php

2002-12-30 Thread Marco Tabini
My guess is that your best bet is creating either an HTML or RTF
documents, both of which are readable by MS Word. RTF is well documented
and it should be fairly easy to work with--you can save a template with
placeholders and simply replace them, since it's entirely text-based.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
I am creating a 'vacation' scheduling webpage for my company.  Currently,
when we want a day off, we fill out a document in word and send it to our
supervisor.  The page I am working on will have a calendar that displays who
is off when.  I would like for the employees to click on a date, enter their
information and then when the info is saved to the db, I would like to have
the .doc automatically created with the info and sent to their supervisor.
Is this possible??

Thanks,
Eddie


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



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


RE: [PHP] creating a .doc file in php

2002-12-30 Thread Marco Tabini
Yep. There should be a few SMTP/Email composing classes that can help
you with the attachment part. Just remember to delete your temp file
once you're done and you should be fine.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
Thanks Marco,

So I would just create the .rtf file with php, then store it on the server
and attach it to the e-mail?

Thanks,
Eddie

-Original Message-
From: Marco Tabini [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 9:17 AM
To: Edward Peloke
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] creating a .doc file in php


My guess is that your best bet is creating either an HTML or RTF
documents, both of which are readable by MS Word. RTF is well documented
and it should be fairly easy to work with--you can save a template with
placeholders and simply replace them, since it's entirely text-based.

Cheers,


Marco
--

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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



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


Re: [PHP] Multiple forms

2002-12-30 Thread Marco Tabini
You should be able to insert a hidden field in your form and that check
against that in your PHP script to determine which (if any) of your form
was submitted:











in your script:


--- Begin Message ---
Hi all,

I have an update page that has a form in it.

However, I want to add another form in the same page.  My current form acts
upon itself (i.e. Action = the same page).  If I set up another form to do
the same, how would my PHP determine with action submit button was acted
upon?

Currently, for the single form here is how it knows a form was submitted:

if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"]
== "form1")) {

How would I test which form submitted the action?

Thanks and if I didn't make myself clear, I apologize.

Doug




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



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


Re: [PHP] call_user_method_array

2003-01-01 Thread Marco Tabini
Chris--

On my system, the function works as expected (at least as I understand
it): myFunc receives the parameters "Hello!" and array("this"=>"that"),
which is what you pass to it in the first place. Were you expecting it
to expand $myArrayVar into individual parameters? If so, that's not how
it works--it expands the values of the array you pass to it (which, in
this case, you build explicitly during the call), but doesn't expand any
arrays that may be within that array.

Also, call_user_method_array is now deprecated--you should use
call_user_func_array instead (the manual page for call_user_method_array
explains how to do this with a class method).

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
How does this function really work?  I've been
beating my head against the wall for the last
8 hours trying to figure it out.  This is what
I'm trying and it isn't working:
{this is a very simplified version}

class MyClass {
  function myFunc( $stringVar, $arrayVar ) {
echo "$stringVar\n";
echo "\n";
print_r( $arrayVar );
echo "\n";

  }
}

$myClass = new MyClass();

$myStringVar = "Hello!";
$myArrayVar  = array( "this" => "that" );

call_user_method_array( 'myFunc', 
&$myClass,
array( $myStringVar, $myArrayVar ));

What's happening is that the values in the array 
are not being passed individually but instead is
being passed as an array.  Shouldn't it be passing
them individually?  If not, it wouldn't seem as if
you could use this function generically.  You'd have
to specificy write your method so it can (possibly)
be called by this function.  And that just doesn't
seem right.

Any light anyone can shed on this would be very much
appreciated!!

Chris

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


Re: [PHP] mail attachments

2003-01-02 Thread Marco Tabini
Nope--it's a bit more complicated than that. However, there are a number
of classes out there that can help you out with that.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
I hope you all had a great New Year.  Is attaching a document to an e-mail
simply a matter of adding a new header in the mail function?

Thanks,
Eddie


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



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


Re: [PHP] loading a different web page ...

2003-01-06 Thread Marco Tabini
Check the header() function--you want header ("Location:
http://www.xyz.com";). It has to be outputted before any other output.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
i know this is an elementary question, but i can't even figure out what to
search for at php.net 

i need php code that, when executed, takes you to a different web page, i.e.
when browser goes to www.abc.com, he's automatically redirected to
www.xyz.com ...

thanks in advance for the help.



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



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


Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Marco Tabini
Hi Chris--

Try this:

 0)
{
$kbitsout = float) $data['OctetsOut'] - $olddata['OctetsOut']) /
($data['UnixTime'] - $olddata['UnixTime'])) * 8 ) / 1000;
print str_pad ($i, 2, ' ', STR_PAD_LEFT) . ' -- ' . number_format
($kbitsout, 2) . " kbits/s\n";
}

$olddata = $data;
$i++;
}

?>

I suggest you add some code to check for divisions by zero, depending on
whether your data requires it! 

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
Ok here is what I did but it does not do anything.
I verified that is opening the file ok and everything, but it shows nothing.
It doesn't even produce an error. I am sure there is an easier way than
looping twice, but this is how I have it for now.

$Lines = array();
$TempDir = "tempdata";
$DataFromFile = file("$TempDir/$Dat.txt");
while(list(,$oneline) = each($DataFromFile)) {
 array_push($Lines, $oneline);
 }
$LineCount = 1;
while(list(,$oneline) = each($DataFromFile)) {
  $PriorLineCount = $LineCount - 1;
  list($OctetsInB,$OctetsOutB,$TimeB) = split("|", $Lines[$LineCount]);
  list($OctetsInA,$OctetsOutA,$TimeA) = split("|", $Lines[$PriorLineCount]);
  // After much help and work with Harry, this is the formula we came up
with to show data rates over time.
  // (((Counter_Now - Counter_Before) / (Time_Now - Time_Before(converted to
seconds))) * 8)) / 1000 = kbits per hour
  $kbitsout = ((($OctetsOutB - $OctetsOutA) / ($TimeB - $TimeA)) * 8 ) /
1000;
  print "$kbitsout Kbits - $LineCount\n";
  $LineCount++;
 }

"Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thank you, I am going to try this now.
> "Petre Agenbag" <[EMAIL PROTECTED]> wrote in message
> 1041861992.1993.36.camel@DELL">news:1041861992.1993.36.camel@DELL...
> > When you read the first line, split the data into it's components , then
> > assign each value to a variable.
> > Call them:
> > $octet_1,$unix_time_1 etc.
> > Now, start the loop.
> > Inside the loop, read the next line, assign to $octet_2, $unix_time_2
> > etc.
> > Do your calculations ( $answer = $octet_2 - $octet_1 etc. )
> > Now, before exiting the loop:
> > $octet_1 = $octet_2;
> > $unix_time_1 = $unix_time_1;
> > etc
> >
> >
> > On Mon, 2003-01-06 at 15:51, Christopher J. Crane wrote:
> > > Ok, this is the first time I will post a message without a line of
code.
> I
> > > am not sure how to go about this task. So I will describe it and maybe
> > > someone will have some thoughts.
> > >
> > > I use PHP to connect to our many routers and get data using snmp. I
have
> > > written a script that refreshes itself every 10 secs. It writes the
data
> to
> > > a text file. The key element of this data is the Octet counters, or
the
> > > amount of data that has been transfered both in and out. To keep it
> simple,
> > > I will only talk about outs. In order to find the amount od data being
> > > transfered, I have to compare two lines. Then run a calculation on
that
> and
> > > then push that data into an array to plot on a chart later on.
> > >
> > > Here is an example of the file the data is written to:
> > > OctetsIn:4300492881|OctetsOut:4300544503|UnixTime:1041629017
> > > OctetsIn:4305184236|OctetsOut:4305234971|UnixTime:1041629031
> > > OctetsIn:4308716675|OctetsOut:4308782481|UnixTime:1041629044
> > > OctetsIn:4312595737|OctetsOut:4312685815|UnixTime:1041629058
> > > OctetsIn:4315910414|OctetsOut:4315961443|UnixTime:1041629072
> > > OctetsIn:4318948400|OctetsOut:4318975102|UnixTime:1041629085
> > > OctetsIn:4322040239|OctetsOut:4322091605|UnixTime:1041629098
> > > OctetsIn:4324981522|OctetsOut:4325033235|UnixTime:1041629111
> > > OctetsIn:4327971528|OctetsOut:4328029496|UnixTime:1041629125
> > > OctetsIn:4332318792|OctetsOut:4332379277|UnixTime:1041629138
> > > OctetsIn:4335594241|OctetsOut:4335635318|UnixTime:1041629153
> > > OctetsIn:4339008729|OctetsOut:4339048246|UnixTime:1041629166
> > > OctetsIn:4342539875|OctetsOut:4342591776|UnixTime:1041629180
> > > OctetsIn:4346070439|OctetsOut:4346127821|UnixTime:1041629193
> > > OctetsIn:4350288360|OctetsOut:4350355417|UnixTime:1041629206
> > >
> > > I can open the file and read the contents line by line
> > > split up but the delimiters and get the data I needbut this is
what
> has
> > > to happen.
> > > If PHP is on line 1, do nothing (it's needs two lines to compare
> against)
> > >
> > > If it's on line 2, then subtract Line 1, OctetsOut from Line Line 2
> > > OctetsOut. Then do the same with the UnixTime. Now run a calculation
on
> that
> > > data and push that into an array as the first data point. Now move on,
> with
> > > a loop I would assume, and do the same for lines 2 and 3, and so on,
> until
> > > we reach the end.
> > >
> > > There could be 5 lines or 500 lines.
> > >
> > > I can loop through the file and do everything, the biggest p

Re: [PHP] restrictions

2003-01-07 Thread Marco Tabini
Hello Bruce--

That depends on what restrictions are imposed on your box, of course.
Does your company use an SMTP-compatible mail server for your internal
mail? If so, you could use the server your mail client points to to
perform your tests.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!
GET YOUR FREE COPY TODAY! Simply register & download!

--- Begin Message ---
I find that my the company that I work for is a little over protective.
My machine is quite restricted (as in firewall and accessability) when
it comes to ftp and telnet. Well basically my hands are tied in that
sense.
 
I am testing my database build on my local machine which runs fine and
all. I am curious though as to how these restrictions may affect my
attempts to send "mail()" I have tried various external SMTP srervers (i
am running off winxp pro) in my php.ini file and I get nothing. Just the
error code I have placed in (below).
 

 
Warning: Failed to connect to mailserver, verify your "SMTP" setting in
php.ini in c:\inetpub\wwwroot\_tasks\email.php on line 21
Mail could not be sent...
 
 
Would my local machines restrictions be stopping the mail function from
communicating with the SMTP server??
 
Cheers
 

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


RE: [PHP] restrictions

2003-01-07 Thread Marco Tabini
Couple of suggestions:

1) Try connection to the SMTP server manually with Telnet, and see if
you discover more that way

2) Simply use the same SMTP server that is configured in your mail
client at work

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
Well I can't be totally sure but I think all outgoing mail points to an
external SMTP server.

-Original Message-
From: Marco Tabini [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 08, 2003 9:11 AM
To: Bruce Levick
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] restrictions


Hello Bruce--

That depends on what restrictions are imposed on your box, of course.
Does your company use an SMTP-compatible mail server for your internal
mail? If so, you could use the server your mail client points to to
perform your tests.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!
GET YOUR FREE COPY TODAY! Simply register & download!



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


RE: [PHP] restrictions

2003-01-07 Thread Marco Tabini
It should say "port 25". If it's just a typo in your message, then it
could either be the restrictions or a general network problem--I know
this sounds stupid, but can you connect *at all* to anything else--ie. a
website?

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!

--- Begin Message ---
Thanks,
Tried this and I get.

"Cannot opeen connection to host on port 23"



-Original Message-
From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 08, 2003 9:32 AM
To: Bruce Levick; 'Marco Tabini'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] restrictions


In windowsxp do the following:

Start -> Run

Open: cmd

At the shell type:

telnet x.x.x.x 25< x.x.x.x being the smtp server

If you get a prompt then you have other issues such as relay etc etc



HiTCHO has Spoken! 
Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED] 

> -Original Message-
> From: Bruce Levick [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 8 January 2003 9:25 AM
> To: Marco Tabini
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] restrictions
> 
> 
> Well I can't be totally sure but I think all outgoing mail
> points to an external SMTP server.
> 
> -Original Message-
> From: Marco Tabini [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 08, 2003 9:11 AM
> To: Bruce Levick
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] restrictions
> 
> 
> Hello Bruce--
> 
> That depends on what restrictions are imposed on your box, of
> course. Does your company use an SMTP-compatible mail server 
> for your internal mail? If so, you could use the server your 
> mail client points to to perform your tests.
> 
> Cheers,
> 
> 
> Marco
> --
> 
> php|architect - The Monthly Magazine for PHP Professionals
> Come check us out on the web at http://www.phparch.com!
> GET YOUR FREE COPY TODAY! Simply register & download!
> 
> --
> 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



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


Re: [PHP] Re: difference between shared and /usr/bin/mysql

2003-01-15 Thread Marco Tabini
On Wed, 2003-01-15 at 09:36, Leon Mergen wrote:
> Somebody correct me if I'm wrong, but from what I know is that when using
> shared it is compiled as a shared object and only loaded when needed. This
> decreases ram usage (which is good) , but increases load (which is bad) .

AFAIK, you should use a shared module when you're also using other
Apache modules that interface to MySQL. When you ./configure the PHP
interpreter, you get this info:

| You chose to compile PHP with the built-in MySQL support.  If you  |
| are compiling a server module, and intend to use other server  |
| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
| mod_perl) you must NOT rely on PHP's built-in MySQL support, and   |
| instead build it with your local MySQL support files, by adding|
| --with-mysql=/path/to/mysql to your configure line.|

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] x12 837

2003-01-16 Thread Marco Tabini
On Thu, 2003-01-16 at 16:10, Rodney Green wrote:
> Just curious. What is an 837?

I'm curious, too... what is it?

Not a good start, if you were hoping to get an answer eh? :-)))

Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] Re: Job Opportunity

2003-01-20 Thread Marco Tabini
Don't apologize... pass the job offers around instead ;-)

My Evolution has decided that I don't have a Calendar anymore. No matter
how hard I try. *sigh*

Cheers,


Marco

On Mon, 2003-01-20 at 13:53, Ray Hunter wrote:
> I apologize everyone...evolution is going crazy...
> 
> Ray
-- 
Marco Tabini <[EMAIL PROTECTED]>


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




Re: [PHP] Headers bust ?

2003-02-15 Thread Marco Tabini
On Sat, 2003-02-15 at 09:01, Malcolm wrote:
> Hello,
> 
>   I've been fooling with this for a few days now.
> I'm getting a hearders already sent error.
>  I know it means I've got output before the header but
> I can't figure how else to do this.

Hi Malcom--

Looks like you are outputting data right after your script starts (on
line to, you have an echo right away). You should either (a) turn on
output buffering, which should take care of the problem, or (b) (the
best solution because it makes your script behave the way it should)
move things around so that the decision on the redirect is made before
outputting anything. Try adding this at the beginning, before the echo:

if ($dog == 'mal')
header ('Location: ../aamaillist/ml_menu.php');


Hope this helps!


Marco
 
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] Block direct image loads but allow them in PHP

2003-02-15 Thread Marco Tabini
On Sat, 2003-02-15 at 11:00, Michael Mulligan wrote:
> Hi
> 
> I have a bit of a problem which might just be due to my lack of knowledge
> with Apache. Basically, what I want to do is to *not* allow users to enter
> particular URLs in their browser (namely to *.jpg and *.xml files under a
> particular directory, let's call it "imagesDir"). However, I can't simply
> Deny all or stick a .htaccess in the folder because I *do* want these images
> to load from within a particular PHP file I have coded.

I guess the easiest would be to filter those images through a php
script. Your PHP script would perform whatever checks are needed (for
example, you could check ther HTTP_REFERER variable, or a shared token
with the originating PHP script) and then output the image only if it's
appropriate to do so. This way, your images would not be accessible to
your users at all--unless you wanted them to be.

Cheers,


Marco


-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] Block direct image loads but allow them in PHP

2003-02-15 Thread Marco Tabini
On Sat, 2003-02-15 at 11:13, Michael Mulligan wrote:
> If the user knew the actual URL of the image though, wouldn't they be able
> to get around a script like this by simply typing it into their web browser?
> 
> Thanks! :-)

Only if you let them. The PHP script allows to put the appropriate
checks in place. For example, if you use sessions, you can verify that
the session is still valid and that the user has, indeed, the right to
access that image. At a later time, even if another user types in the
same URL but does not have a valid session (or a variable inside the
session that contains the right data), you would be able to block him
from reading the image.

Cheers,


Marco

-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] Block direct image loads but allow them in PHP

2003-02-15 Thread Marco Tabini
On Sat, 2003-02-15 at 11:24, Michael Mulligan wrote:
> The script that I will distribute will always make use of a very particular
> directory structure. In "imageDir", there will always be a specifically
> named XML file that points to a bunch of images in the directory. However,
> given security checks that I put in my script, not all of those images
> should be publicly viewable. However, if a savvy user were to just load this
> XML doc up in their web browser, they will have a complete listing of URLs
> to all of my images. I cannot modify this XML file.  (which is why I want to
> block a user from loading, say myserver.com/imageDir/picture.jpg)
> 
> Will your proposed idea still work in this situation?

Yes--but you need to make the image inaccessible to the outside (simply
put them in a folder that can't be seen from the web).

Here's an example. Suppose you have a script called page.php that needs
an image called img.jpg. Instead of calling img.jpg, you call another
script, serveimage.php as follows:



Now, in serveimage.php you do this:



Essentially, what I'm doing is I'm replacing a file with a script that
first checks the permissions and then, if the user is authorized,
outputs the file to the browser. This way, if the user is not authorized
to download a file, it will be blocked. Obviously, the files themselves
should be inaccessible to the web *except* through your scripts.

Hope it's a bit clearer now!

Cheers,


Marco

-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Weblog: http://blogs.phparch.com


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




Re: [PHP] IRR Function in PHP

2003-02-17 Thread Marco Tabini
On Mon, 2003-02-17 at 16:44, Jonathan Pitcher wrote:
> We are getting ready to automate a process that was currently done in 
> Excel to a Web page.
> 
> This process involves an IRR Calculation. Or Internal Rate of Return.
> 
> I have looked at PHP.net and spent the last couple hours searching for 
> a pre-built function to handle this but have come up blank.
> 
> Has anyone heard of something written in PHP that can handle this type 
> of calculation??

Never heard of it being done in PHP... what is your scenario?

Cheers,


Marco

-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] IRR Function in PHP

2003-02-17 Thread Marco Tabini
If I may barge in...

The IRR represents the actual return of an investment over an arbitrary
period of time (usually annualized).

Say, for example, that you invest $100 and, after two years, you have
$120. Your overall return is 20%. If your interest rate was constant
over the two-year period and you never took any money out or put any
money in, your annualized IRR, that is the percentage that best
approximates how much you've made on a yearly basis, is approximately
9.544% and is calculated through the simple formula

IRR = (EndAmount / StartAmount) ^ (1 / NumberofPeriods) - 1.

IRR = (120 / 100) ^ (1 / 2) - 1 =~ 0.95445

If it sounds like a straightforward calculation... it isn't, because you
rarely have a clean-cut situation like that. Most of the time, you have
to deal with variations in the cash flows (interest payments,
reinvestments, disbursements, taxes, and so forth) and partial periods.

In some cases, the problem can only be solved by interpolation and the
calculation can become quite complex.

Cheers,


Marco

On Mon, 2003-02-17 at 16:52, Greg Donald wrote:
> On Mon, 17 Feb 2003, Jonathan Pitcher wrote:
> 
> >This process involves an IRR Calculation. Or Internal Rate of Return.
> 
> Sorry, I don't think there are any accountants lurking on the list, so 
> please explain what the actual calculation for an IRR should be.
> 
> 
> -- 
> Greg Donald
> http://destiney.com
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Weblog: http://blogs.phparch.com


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




Re: [PHP] IRR Function in PHP -- MORE Info

2003-02-17 Thread Marco Tabini
Hey Jonathan--

This page has an excellent description of what the IRR is and how it's
calculated. 

http://invest-faq.com/articles/analy-int-rate-return.html 

I'd love to help more than this, but this is quite a bit of work and
without the actual spreadsheet I'm not sure that I'd be able to give you
meaningful help!

Cheers,


Marco

On Mon, 2003-02-17 at 17:08, Jonathan Pitcher wrote:
> I received an Excel Spread sheet with built in calculations for 
> creating our rate sheets that we pass out to our branches and so on.
> 
> In this rate sheet to calculate our APR the spread sheet calls built in 
> Finance Functions
> 
> IRR Internal Rate of Return
> PMT Calculates a Payment
> PV Calculates Present Value
> 
> My goal is to turn the excel sheet into a DB Driven Rate management 
> system for our Internal and External websites. With all input and 
> export going through a web based system.
> 
> I have all the information I need but I can't seem to find the right 
> formulas to make the calculations.
> 
> Thanks again,
> 
> Jonathan
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Weblog: http://blogs.phparch.com


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




Re: [PHP] file-upload.errors

2003-02-17 Thread Marco Tabini
On Mon, 2003-02-17 at 21:44, Nate wrote:
> Does this mean the file was examined by the browser and it determined it was
> too large OR does it have to upload the file temporarily and then check to
> see if its too large?
> 
> It sounds like browser would first examine the file before it gets uploaded,
> however, if I try to upload a 1mb file it takes noticably longer to produce
> an error than say a 501 byte file.
> 
> Please anyone that can help me with this I would really appreciate it.

The browser *should* check but it doesn't. In fact, the limit that's
being exceeded is probably the one set in your php.ini configuration
file. In any case, it's generally a bad idea to trust the client with
performing any checks for anything other than the convenience of the
user, because it's very easy for a malicious user to send out a request
that contains completely arbitrary data ignoring completely all the
controls that are built into your HTML file.

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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




Re: [PHP] Version 5?

2003-03-06 Thread Marco Tabini
On Thu, 2003-03-06 at 23:09, Larry Brown wrote:
> Someone mentioned a facet of version 5 to be expected that I am really
> looking forward to.  Does anyone know what the release target date is?  I
> didnt see any mention of it on php.net.

Version 5 is still being actively developed (at least as far as I know),
so chances are that the release date is still a ways off. I've heard
anything from Q2-Q3 of 2003 on.

You can, however, download the current PHP5 CVS tree. I've been
experimenting with it and it's fairly stable--although I've seen some
messages that it leaks memory, for testing and learning how the new
stuff works it should be fine, IMO.

Out of curiosity, which feature were you interested in?

Cheers,


Marco
-- 

php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!


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



Re: [PHP] quick question

2003-03-10 Thread Marco Tabini
You should look at E-xact (http://www.e-xact.com). They have a solution
they call "tagged transactions" that actually replaces the credit card
numbers with "tags" that are only meaningful in the context of your
merchant account. That way, you can let your customers make repeat
purchases without actually having to store CC numbers on your site.

Cheers,


Marco

--
php|architect - The Magazine for PHP Professionals
Get your free copy today at http://www.phparch.com

On Mon, 2003-03-10 at 11:46, Doug Parker wrote:
> I'm sending credit card info to a 3rd party credit card processing site. 
>   I would like to keep the inputted values and, after the approval, have 
> them appear in the value part of the form so that they don't have to 
> re-input the same values they had just put in for the credit card.  how 
> can i do this?
> 


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



Re: [PHP] Problems compiling PHP 5.0.0b1

2003-07-01 Thread Marco Tabini
If you installed libxml2 from source--rather than from RPM--chances are
that it's been installed in a folder other than the system library
directory (/usr/lib). It's probably in /usr/local/lib instead. So you
can do one of two things: either reconfigure libxml2 specifying
--prefix=/usr or reconfigure PHP --with-libxml-dir= and your actual
libxml2 installation path.

Cheers,


Marco


On Tue, 2003-07-01 at 13:11, Mauricio Cuenca wrote:
> Hello,
> 
> I've tried several times compiling PHP 5.0.0b1 on a Linux RedHat 8.0 using
> this configure command:
> ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5
> 
> And I get the following error:
> configure: error: libxml2 version 2.5.1 or greater required.
> 
> Then, I downloaded and compiled  libxml 2.5.7 and the same error appears.
> 
> I've compiled several diffrent versions of PHP before without problems. Has
> anyone had a similar problem ?
> 
> TIA,
> 
> _________
> Mauricio Cuenca
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Avenue
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Web: http://www.tabini.ca


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



Re: [PHP] PHP5 - Bugs

2003-07-01 Thread Marco Tabini
Which platform are you running on?


Marco

On Tue, 2003-07-01 at 13:39, Michael A Smith wrote:
> Hey,
> 
> Can't figure this out... whenever I try to use any mysql functions or
> anything, I get problems. PHP throws a DNS error... what's up with that?
> 
> -Michael
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Avenue
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Web: http://www.tabini.ca


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



Re: [PHP] mysql detect

2003-07-02 Thread Marco Tabini
locate mysql.lib?

Can you be a bit more specific?


Marco

On Wed, 2003-07-02 at 03:05, [EMAIL PROTECTED] wrote:
> helo all ,
> 
> what command in linux , to see default direcktory instalation mysql
> database dan mysql library
> 
> 
> ##
> With best regards !
> Roy Daniel , ST
> IT Application Support & Development Engineer - PT BERCA
> [EMAIL PROTECTED]  // [EMAIL PROTECTED]
> ICQNumber : # 103507581 // Phone Cell : 0816-1192832
> ##########
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Avenue
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Web: http://www.tabini.ca


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



Re: [PHP] Eval var from query

2003-07-14 Thread Marco Tabini
On Mon, 2003-07-14 at 15:03, Shawn McKenzie wrote:
> How can I evaluate a var that is from a text field of a database?  Example:
> 

Hi Shawn--

Have you looked at eval?

http://www.php.net/eval.

Cheers,


Marco

-- 
php|architect -- The Magazine for PHP Professionals
NOW AVAILABLE IN PRINT! Get your free copy today at
http://www.phparch.com


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



Re: [PHP] Recommended package for online editing of HTML files

2003-03-18 Thread Marco Tabini
Hiya Brad--

We published a news item on this a few days ago; there's a free WYSIWYG
editor that works both on IE and Mozilla 1.3 called HTMLArea.

You can find it here:

http://www.interactivetools.com/products/htmlarea/reviews.html

(our news item is at http://phparch.com/newsarchive.php?s=htmlarea). I
use it in quite a few applications and it's both very useful and quite
stable.

Cheers,


Marco

--
php|architect -- The Magazine for PHP Professionals
Get your free copy today at http://www.phparch.com


On Tue, 2003-03-18 at 17:50, Brad Hubbard wrote:
> Can anyone recommend a package suitable for editing HTML files on a remote 
> server through a PHP interface? Basically, an online HTML editor.
> 
> Cheers in advance,
> Brad


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



Re: [PHP] Refreshing

2003-06-30 Thread Marco Tabini
Try using Javascript to reload an image instead of an HTML file. Images
don't click, and you can check whether new data is available by the size
of the returned image (e.g.: 1 pixel, no new data, 2pixels, new data).
You will need a small PHP script on the backend that generates the image
based on whether the data is available or not.

Cheers,


Marco

--
php|architect -- The Magazine for PHP Professionals
Get your free copy today at http://www.phparch.com!

On Mon, 2003-06-30 at 13:50, Stephen wrote:
> 1. This way would probably end up sending out 500 little clicks every
> minute...so... Could any client side script do this like JavaScript? I doubt
> it could but just a question.
> 
> With bubblegum in my shoe,
> Stephen Craton
> Senior Executive Web Developer
> Mophus.com, Inc.
> 
> 
> - Original Message - 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> To: "Stephen" <[EMAIL PROTECTED]>; "PHP List"
> <[EMAIL PROTECTED]>
> Sent: Monday, June 30, 2003 12:41 PM
> Subject: RE: [PHP] Refreshing
> 
> 
> [snip]
> I have a chat script. I want it to refresh the chat display area
> whenever there is a new message posted, but not every 10 seconds or so.
> How could I get the script to refresh only when there is a new entry
> into the database table?
> 
> Also, this may not be PHP but...does anyone know how to stop the
> annoying click on Internet Explorer when something refreshes?
> [/snip]
> 
> 1. Nope, not with PHP. Well, you could but it would require a script
> running in a loop in the background, checking for new data, then calling
> a header redirect of some sort. That is kludgy and would require the
> looping doohickey for each conversation within the chat.
> 
> 2. You can disable sounds in a themes thingie, depends on which windoze
> version you own.
> 
> HTH!
> 
> Jay
> 
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Avenue
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Web: http://www.tabini.ca


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



Re: [PHP] Refreshing

2003-06-30 Thread Marco Tabini
On Mon, 2003-06-30 at 13:57, Stephen wrote:
> Thank you for this method. I just have a few questions.
> 
> 1. How could javascript reload the image? I'm not 100% familiar with
> JavaScript really...

Set a timeout to x seconds (where x is the time you want to wait between
checks--say one or two seconds). When the timeout occurs cause the image
to reload by changing its src attribute (even to the same URL, of
course).

> 2. How could I use PHP to find the width of the image? I was reading up on
> image manipulation last night but only got as far as creating an image.

You don't need PHP to check the width of the image. PHP *generates* the
image of a given width based on whether new data is available or not. On
the frontend, you can set the onload event of the image to fire a
function of your choosing when the image is reloaded, where you check
its dimensions and act accordingly. Once you've done that, you reset
your timer, and the cycle starts over.

Cheers,


Marco

--
php|architect -- The Magazine for PHP Professionals
Get your free copy today at http://www.phparch.com!


> 
> With bubblegum in my shoe,
> Stephen Craton
> Senior Executive Web Developer
> Mophus.com, Inc.
> 
> 
> - Original Message - 
> From: "Marco Tabini" <[EMAIL PROTECTED]>
> To: "Stephen" <[EMAIL PROTECTED]>
> Cc: "Jay Blanchard" <[EMAIL PROTECTED]>; "PHP List"
> <[EMAIL PROTECTED]>
> Sent: Monday, June 30, 2003 12:52 PM
> Subject: Re: [PHP] Refreshing
> 
> 
> Try using Javascript to reload an image instead of an HTML file. Images
> don't click, and you can check whether new data is available by the size
> of the returned image (e.g.: 1 pixel, no new data, 2pixels, new data).
> You will need a small PHP script on the backend that generates the image
> based on whether the data is available or not.
> 
> Cheers,
> 
> 
> Marco
> 
> --
> php|architect -- The Magazine for PHP Professionals
> Get your free copy today at http://www.phparch.com!
> 
> On Mon, 2003-06-30 at 13:50, Stephen wrote:
> > 1. This way would probably end up sending out 500 little clicks every
> > minute...so... Could any client side script do this like JavaScript? I
> doubt
> > it could but just a question.
> >
> > With bubblegum in my shoe,
> > Stephen Craton
> > Senior Executive Web Developer
> > Mophus.com, Inc.
> >
> >
> > - Original Message - 
> > From: "Jay Blanchard" <[EMAIL PROTECTED]>
> > To: "Stephen" <[EMAIL PROTECTED]>; "PHP List"
> > <[EMAIL PROTECTED]>
> > Sent: Monday, June 30, 2003 12:41 PM
> > Subject: RE: [PHP] Refreshing
> >
> >
> > [snip]
> > I have a chat script. I want it to refresh the chat display area
> > whenever there is a new message posted, but not every 10 seconds or so.
> > How could I get the script to refresh only when there is a new entry
> > into the database table?
> >
> > Also, this may not be PHP but...does anyone know how to stop the
> > annoying click on Internet Explorer when something refreshes?
> > [/snip]
> >
> > 1. Nope, not with PHP. Well, you could but it would require a script
> > running in a loop in the background, checking for new data, then calling
> > a header redirect of some sort. That is kludgy and would require the
> > looping doohickey for each conversation within the chat.
> >
> > 2. You can disable sounds in a themes thingie, depends on which windoze
> > version you own.
> >
> > HTH!
> >
> > Jay
> >
> -- 
> 
> Marco Tabini
> President
> 
> Marco Tabini & Associates, Inc.
> 28 Bombay Avenue
> Toronto, ON M3H 1B7
> Canada
> 
> Phone: (416) 630-6202
> Fax: (416) 630-5057
> Web: http://www.tabini.ca
> 
> 
> -- 
> 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] Refreshing

2003-06-30 Thread Marco Tabini
The image should take care of the click, and also reduce the amount of
information transmitted somewhat (although not necessarily, depending on
what you send to your iframe).

Cheers,


Marco

On Mon, 2003-06-30 at 14:09, Jeremy Thibeaux wrote:
> > [snip]
> > I have a chat script. I want it to refresh the chat
> > display area
> > whenever there is a new message posted, but not
> > every 10 seconds or so.
> > How could I get the script to refresh only when
> > there is a new entry
> > into the database table?
> > [/snip]
>  
> I have implemented something along these lines for an
> online chess game (so the board would only refresh
> when the other player moves).  It did require a loop,
> as suggested.  I used a hidden IFRAME to check the
> data.  Basically, I would refresh the page referred to
> by the IFRAME every 10 seconds or so, and this page
> contained JavaScript that invoked a function on the
> containing page.  The JavaScript function on the
> containing page would then refresh the page when the
> parameter passed to it indicated that the other player
> had moved.  I did implement the site using PHP, but
> this really isn't a PHP specific approach.  
> 
> I imagine you would do something very similar for chat
> (in fact, I had been considering implementing it for
> the online chess site so that the users could send
> messages to each other during the course of the game).
> 
> And there is a performance issue if you are going to
> support a lot of users at one time; however, at least
> it is not as bad as refreshing the entire page every
> 10 seconds (this would be particularly disastrous for
> my chess board, which contained many images).
> 
> There are a number of references that talk about this
> trick if you search on "iframe rpc javascript" in
> google:
> 
> http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=iframe+rpc+javascript
> 
> You will still get the clicking, tho.  But users' can
> disable it if it annoys them -- sometimes it is nice
> to know that something is going on.
> 
> Hope this helps.
> 
> Jeremy
-- 

Marco Tabini
President

Marco Tabini & Associates, Inc.
28 Bombay Avenue
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Web: http://www.tabini.ca


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



Re: [PHP] eregi_replace help

2002-10-07 Thread Marco Tabini

Jennifer--

A couple of things. eregi_replace does not have a limitation parameter,
which means that if you use it *all* the strings that match your pattern
will be replace with the new pattern. In your case, if I read your code
correctly (and I may not--I'm doing this from memory), the eregi
replacement you perform will change *all* the paths you have in your
file, and not just the first one, which, I believe, is what you're
looking for. 

Also, there shouldn't be any need to make the replacements one by one. A
single replacement should be enough if all the original paths have to be
transformed into the same URL.

For example:

ereg_replace ("{/images/}{test.(jpg|gif)}",
"http://www.microsoft.com/images/\\2";, $t);

This would replace any occurrence of "/images/*.gif" and "/images/*.jpg"
to "http://www.microsoft.com/images/*.gif"; or *.jpg respectively (once
again, double check my regex...doing this from memory). If you *do* need
to change each occurrence individually, then you should use preg()
instead, which uses Perl syntax and has a limitation parameter.

Also--a minor thing and I'm sure you thought of it, but you're not
saving the file at the end :-)

Hope this helps.

Cheers,


Marco

On Mon, 2002-10-07 at 20:01, Jennifer Swofford wrote:
> Hello all,
> 
> I am trying to use php to read through an html file and replace all image
> paths, like such:
> 
> Change "images/firstimage.gif" to "http://www.blah.com/firstimage.gif"; ...
> Change "somesuch/images/secondimage.jpg" to
> "http://www.blah.com/secondimage.jpg";
> 
> So I am going through the file and matching the image path strings,
> stripping them down to just the image name using "basename", and then adding
> "http://www.blah.com/"; onto the beginning of them.  Except it's not working,
> and I'm not sure where my logic has gone awry.  Instead of replacing each
> image path with its respective image name, it is replacing all image paths
> with the *same* image name.
> 
> Here is the code.  (Yes I'm new, I apologize for the mess, there are a few
> lines in there I'm using for debugging purposes, to show me what it's
> doing.)
> 
>  $filename = "newexample.html";
> $fd = fopen ($filename, "r");
> $contents = fread ($fd, filesize ($filename));
> 
> while (preg_match('{(")([A-z0-9_/-](\/))*[A-z0-9_/-]+(.gif|.jpg)}',
> $contents, $matches)) {
> 
> echo "MATCHED: ".$matches[0]."\n";
> 
> $base = basename($matches[0]);
> $newimage = "http://www.blah.com/".$base;
> echo "base: ".$base."";
> echo "new image: ".$newimage."";
> echo "";
> 
> $contents = eregi_replace('\/*[A-z0-9_/-]+(.gif|.jpg)', $newimage,
> $contents);
> 
> print $contents;
> 
> }
> 
> fclose ($fd);
> 
> ?>
> 
> When I run it, I get:
> 
> ~
> MATCHED: "blah/images/first.gif
> 
> base: first.gif
> new image: http://www.blah.com/first.gif
> 
>  "http://www.blah.com/first.gif"; (when there are supposed to be lots of other
> images, such as second.jpg, etc).>
> ~
> 
> Where have I gone wrong?  Thanks to all, as usual, for your hints and help.
> 
> Jen
> 
> 
> -- 
> 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] MAIL taking 60 seconds to send... (too long)

2002-10-07 Thread Marco Tabini

Hey John--

Couple of ideas:

1) Is your sendmail configured as a relay? As such your PHP process may
have to wait for the e-mail to be relayed before returning, which might
explain why it's taking so long. The same might happen if your machine
is very busy (although that has never happened to me)

2) Under IIS, you must configure a mail server in order for mail() to
work, because Windows does not have an MTA similar to sendmail installed
by default. You can do so in your php.ini file. Note that the MTA
doesn't have to be on a separate computer--if you use Windows SMTP and
configure it properly it should do just fine to use localhost as your
mail host.

Hope this helps.


Marco

On Mon, 2002-10-07 at 12:25, Negretti, John (CCI-San Diego) wrote:
> Hello All,
> 
>   I have a script which is using mail() to send an e-mail message.  It seems to 
>be working, yet taking as long as 60-65 seconds just to send the e-mail.  The e-mail 
>has no attachments and only has one line in it.  Does anyone have experience with 
>this issue.  I am using "PHP/4.0.6" on "Linux Redhat" with "Apache/1.3.22".  Also, 
>not to mention when I test it with IIS, I get a "Failed to Receive" error.  Thanks 
>for any help.
> 
> John Negretti
> 
> 
> -- 
> 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] parsing variables through webpages

2002-10-07 Thread Marco Tabini

You can use $_POST in a similar fashion to retrieve values from form
that have been posted with the POST method. 

Also, you can use $_REQUEST to catch both at the same time. In this
case, you may have a problem if the same variable is passed through both
GET and POST, in that one will override the other depending on how your
php.ini is set up.


On Mon, 2002-10-07 at 12:19, Edgard Berendsen wrote:
> I send hidden variables from a form to a php. In the php
> I have the following code to convert the global vars sent:
> 
> If  (isset($_GET['foo']))
> $foo = $_GET['foo']
> else
> $foo = 0;
> 
> But this only works using the "GET" method!
> 
> Thanks for your answer.
> 
> 
> 
> -- 
> 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] Chat with php

2002-10-07 Thread Marco Tabini

But, Robert, doesn't this technique leave a connection open on the
server--and, won't it cause the server to run out of resources after a
very finite number of connections has been established?


Marco

On Mon, 2002-10-07 at 14:07, Robert Cummings wrote:
> You can have your script enter a loop to check for data in a database.
> If data output it then calls the flush() function to output to the browser.
> Then sleep for some time, then wakeup and repeat. You may have issues
> with some browsers using this technique, but generally it does work.
> The key is that you never close the connection to the browser. You'll
> also want to occasionally output some invisible content, otherwise the
> connection_status() stuff never give the right value (at least not in
> 4.1.2) It struck me that these functions update their flags on output
> only. Which means you need to output something to the browser to detect
> that the user has hit stop, or has disconnected.
> 
> Cheers,
> Rob.
> 
> Oliver Witt wrote:
> > 
> > I attempted to write a oage that you can chat on with php. It ended up
> > being a page that reloads itself all the time which isn't really what I
> > wanted. But I didn't know how to do it differently. Is there another
> > way? I heard something about flush()?
> > Kind regards,
> 
> -- 
> .-.
> | Robert Cummings |
> :-`.
> | Webdeployer - Chief PHP and Java Programmer  |
> :--:
> | Mail  : mailto:[EMAIL PROTECTED] |
> | Phone : (613) 731-4046 x.109 |
> :--:
> | Website : http://www.webmotion.com   |
> | Fax : (613) 260-9545 |
> `--'
> 
> -- 
> 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] Chat with php

2002-10-07 Thread Marco Tabini

Simple trick (well, not so simple, but kind of a Columbus' Egg):

1) Create an  tag in your web page that is hidden

2) Point the img tag to a php script that returns:

1) An image with a pixel width of 1 if there is new data to pick
   up from the server
2) An image with a pixel width of 0 otherwise

3) Create a javascript that refreshes the image every second (or every
two seconds, or however often you feel necessary--the more often, the
more responsive and "real time" your chat system will be).

4) Add an OnLoad event to the img tag that points to a Javascript that
checks the width of the newly reloaded image. If the width is one, then
you reload your chat text content (which you may want to put in an
iframe to avoid having to reload the whole page).

I don't have a script to show unfortunately, as it would probably be too
complicated and long for the list (and I have no time to write
it...), but hopefully, this will give you the gist of it.

Cheers,


Marco

On Mon, 2002-10-07 at 13:43, Oliver Witt wrote:
> I attempted to write a oage that you can chat on with php. It ended up
> being a page that reloads itself all the time which isn't really what I
> wanted. But I didn't know how to do it differently. Is there another
> way? I heard something about flush()?
> Kind regards,
> Oliver
> 
> 
> -- 
> 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] Sockets

2002-10-07 Thread Marco Tabini

Yep, if you're using UNIX and compiling from source, you must add this
switch to the command line when you're configuring and compiling PHP:

 --enable-sockets

(e.g.: ./configure --enable-sockets). If you're using a prepackaged
version (RPM or Windows) then you should look into the documentation for
your version to see if this extension was included when the package was
compiled from the source.

Cheers,


Marco

On Mon, 2002-10-07 at 14:22, Asmodean wrote:
> Hey everyone,
> 
> Does anybody know what the current support / functionality for PHP
> with sockets is? According to the documentation, all the socket_
> functions should be included in PHP >= 4.1.0. I'm currently running
> 4.2.1 and PHP doesn't seem to recognize these functions (socket_send,
> socket_write, etc).
> 
> Anybody know if there's anything special I have to do to get it
> working?
> 
> // Asmodean
> 
> 
> -- 
> 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] Chat with php

2002-10-07 Thread Marco Tabini

Oliver--

I'm afraid I wasn't too clear! If you do it the way I'm suggesting, your
page will look like it's reloading ONLY when there is new data
available, and not continuously. PHPChat is an example--it looks really
good and doesn't do any of the annoying things that reloading the page
usually does (like the stupid click click click in IE).


Marco

On Mon, 2002-10-07 at 14:25, Oliver Witt wrote:
> Brad Dameron schrieb:
> 
> > Another way is to use javascript with PHP to pull the database every so many
> > seconds. I have seen this in I think it was PHPChat. Been a long time
> > however.
> >
> 
> Well, that's pretty much how I've done it. And it is pretty crappy...
> Olli
> 
> 
> 
> -- 
> 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] Grabbing auto_increment during insert?

2002-10-07 Thread Marco Tabini

If you're using MySQL:

mysql_insert_id

If you're using MSSQL, you need to execute SELECT @@IDENTITY right after
your insertion operation. The result will give you the ID of your last
insertion. This won't work well if you're doing a bulk insert, though.


On Mon, 2002-10-07 at 15:46, Jason Young wrote:
> Apologies for what's probably an extremely newbie question..
> 
> Is there any way to have a database return its auto_increment field 
> during insert?  I have two different tables, when one inserts, I'd like 
> to be able to assign the value of the new auto_increment field to 
> another field in another table.
> 
> I guess I COULD go and make the second table auto_increment along with 
> it, but that would require a complete rewrite, and I'd like to avoid that...
> 
> Anyone have ideas, suggestions, or preferably.. an answer to my question? :)
> 
> Thanks
> -Jason
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] how to build a webmail

2002-10-07 Thread Marco Tabini

Try this:

http://www.horde.org/imp/

On Mon, 2002-10-07 at 16:26, Nagib Abi Fadel wrote:
> 
> Hi i want to build a webmail with PHP, can someone give me some guidelines.
> 
> thx.
> 
> 
> 
> -
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos, & more
> faith.yahoo.com



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




Re: [PHP] Deleting multiple items from database using checkboxes

2002-10-07 Thread Marco Tabini

Try WHERE EntryID IN (" . implode ($dele, ',') . ")"

However:

1) Anybody could fake a form post or query url to delete any data in
your database
2) It would also be possible to create a more dangerous post that could
give the attacker control over your entire database

Thus, I assume that you will want to put a *lot* of checking around that
code!


Marco

On Mon, 2002-10-07 at 16:05, Davy Obdam wrote:
> Hi people,.
> 
> I have a guestbook admin page were i would like to delete one item or
> more items from the database if necessary. I have modified my normal
> guestbookpage so that it has checkboxes in front of every entry. This is
> my code:
> 
> 
> 
> Now i can select multiple items. But i have tried to delete em, but it
> only deletes one item from the database, my query looks like this :
> DELETE  FROM gastenboek WHERE entryID=$dele . Can anyone help me. Thanks
> for your time.
> 
> 
> Best regards,
>  
> Davy Obdam,
> mailto:[EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] Execute...

2002-10-08 Thread Marco Tabini

Unfortunately no, because the calculator is a Windows application that
runs on your local desktop and cannot be seen by your web-based users.

If you need your customers to use a calculator through their browsers,
you're probably looking for a Javascript calculator. Take a look at this
as an example:

http://freespace.virgin.net/naeem.malik/calculator.htm


Marco


On Tue, 2002-10-08 at 06:55, Bsantos PHP wrote:
> Hi people:
> 
> Can anyone tell me if I can execute windows calculator trought a PHP script
> on a web page to allow customers to check final prices?!
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] PHP AND C

2002-10-08 Thread Marco Tabini

Passing that many parameters shouldn't be a problem, I think...argv/argc
parsing in the standard C library is pretty fast.

On Tue, 2002-10-08 at 06:04, karthikeyan wrote:
> Hi,
> 
>   I want to pass some 10 to 15 parameters as input to an C Program.  Does passing it 
>as command line argument through PHP using backquotes or system function is an 
>effective way to solve this issue or there are some other alternative which does this 
>without affecting the performance.
> 
>   Looking forward to you response.
> 
> karthikeyan.



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




Re: [PHP] shell_exec('cp...

2002-10-08 Thread Marco Tabini

Have you tried redirecting stderr to a file?

On Tue, 2002-10-08 at 11:50, Alec Solway wrote:
> I'm having problems running cp from shel_exec(). Nothing is returned, but 
> the copy is unsuccessful. The same call works as user nobody from the 
> actual shell. Any ideas?
> 
> -Alec
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] PHP socket connections with SSL

2002-10-08 Thread Marco Tabini

Hi Darren--

4.3 is not out yet; the reference is to the current CVS version (which
will, eventually, become 4.3, I suppose), which you can check out and
use, although it is not an "official" release and will therefore
probably be a bit unstable (I've been running it on my dev server for a
while without much in the way of problems).

An alternative would be to compile the curl library in a 4.2 release and
use that one to pull SSL pages.


Marco

On Tue, 2002-10-08 at 18:49, Darren Gamble wrote:
> Good day,
> 
> I'm trying to create a PHP app to connect to a remote port that uses SSL.
> 
> According to the documentation for fsockopen() ...
> 
> 
> 
> As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the
> hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
> connection over TCP/IP to connect to the remote host. 
> 
> 
> 
> I don't see a 4.3.0 version available for download.  The CVS changelog
> refers to a 4_3 branch someplace, so I presume I could get this feature by
> compiling from CVS, but there are a number of other applications that
> upgrading could break so I'd like to try to avoid using CVS if possible.
> 
> Is there any other way to do this via PHP, other than calling stunnel via a
> shell command and using fsockopen to the unencrypted endpoint?  I have
> Googled and searched though the PHP site, but I haven't come up with
> anything else.
> 
> I don't need to supply a client certificate, if that helps any...
> 
> Thanks in advance,
> 
> 
> Darren Gamble
> Planner, Regional Services
> Shaw Cablesystems GP
> 630 - 3rd Avenue SW
> Calgary, Alberta, Canada
> T2P 4L4
> (403) 781-4948
> 
> 
> -- 
> 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] Speeding up a Mysql Select

2002-10-09 Thread Marco Tabini

Also, probably a stupid question, but, is the `begintime` column
indexed? If it isn't, no matter what you do, the whole thing will keep
getting slower at an alarmingly fast pace :)


Marco


On Wed, 2002-10-09 at 07:14, Maurits Lawende wrote:
> You should include a LIMIT to the sql-query or mysql parses the whole 
> database
> 
> example:
> 
> SELECT * FROM `support` WHERE `begintime` > 'timestamp1' AND
> `begintime` < 'timestamp2' LIMIT 0,1';
> 
> 
> 
> John W. Holmes wrote:
> 
> >>I'm doing a select on a database that has about 45000 records and
> >>
> >>
> >growing
> >  
> >
> >>and its a bit SLOW.
> >>
> >>Its using a unix timestand to mark the beginning of a call and the end
> >>
> >>
> >of
> >  
> >
> >>a
> >>call.  This is also used so I know what date the call was received.
> >>
> >>When I do a
> >>
> >>select * from support where begintime between 'timestamp1' and
> >>'timestamp2';
> >>
> >>It takes a while to execute...  The timestamp fieldtype is
> >>
> >>
> >varchar(10)...
> >  
> >
> >>Will I see any speed difference with a different column type?
> >>
> >>Any advice on how to speed this up would be greatly appreciated! :)
> >>
> >>
> >
> >It would probably help to make it an INT column, since that's what
> >timestamps are and then index the column. Also, I've heard that it's
> >faster to use "begintime > timestamp1 and begintime < timestamp2"
> >instead of BETWEEN. It's probably minor, though, compared to the
> >advantage you'll get from an indexed INT column.
> >
> >---John Holmes...
> >
> >
> >
> >  
> >
> 
> 
> 
> 
> -- 
> 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] Encrypting passwords in a flat file before import

2002-10-09 Thread Marco Tabini

I think that generally you do not want passwords to be decryptable. What
I normally do is try to encrypt whatever the user enters as a password
and compare the resulting encrypted string with what's in the database
to make sure they correspond. If the encrypting function is univocal
(and md5 is) then the correct password will always return the same
encrypted string.

 On Wed, 2002-10-09 at 16:06, Scott Fletcher wrote:
> Can it be de-encrypt???  I don't see how since you just use the function
> md5().
> 
> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > If you don't need the file to be changed to contain md5 encrypted
> > passwords use *fgetcsv() *to read the contenta,
> > then use *md5()* on the password and insert it into database using
> > mysql_query. No need to write a new file.
> >
> > Verdon Vaillancourt wrote:
> >
> > >Hi,
> > >
> > >I hope this question isn't too basic...
> > >
> > >I have a flat file (CSV) that I want to import into a mySQL db via
> > >phpMyAdmin. The file has about 1200 rows and is in a format like:
> > >"value","value","password","value","value","etc"
> > >The passwords are in clear text. I need them to be encrypted in md5.
> > >
> > >Is there any advice out there as to how I could process this flat-file
> > >before I import into my db or after the fact?
> > >
> > >Thanks, verdon
> > >Ps. Please cc me if replying to list as I am on digest mode
> > >
> > >
> > >
> > >
> >
> 
> 
> 
> -- 
> 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] ASP Option Explicit equivalent in PHP

2002-10-09 Thread Marco Tabini

Well, you can set error_reporting to E_ALL, which will cause PHP to
complain if you use a variable without having it initialized. There is
no exact equivalent to Option Explicit--and there still isn't any need
to declare the variables, just to initialize them before use.


Marco

On Wed, 2002-10-09 at 18:47, R. Z. wrote:
> I'm on a roll with the ASP questions these days, since I picked up the 
> Chiliasp.
> 
> Here's one:
> 
> ASP has the function Option Explicit build in, it yells when you use 
> variables without prior declaration, couldn't find anything like that in 
> PHP documentation.
> Thanks in advance.
> 
> R>
> 
> -- 
> 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] problem with SUM and Postgres

2002-10-09 Thread Marco Tabini

Because pg_exec only executes the query and returns the resource that's
associated with the returns. If you want to read the results, you should
use pg_fetch_result():

$sql1 = "SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
'$webserver'";
$hosting_rs = pg_exec($connect, $sql1);
$hosting_data = pg_fetch_row ($hosting_rs, 0);
$hosting = $hosting_data[0];


Marco

On Wed, 2002-10-09 at 19:29, webmaster wrote:
> I can't figure out why the following code is not returning a column
> total:
> 
> $sql1 = "SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
> '$webserver'";
> $hosting = pg_exec($connect, $sql1);
> echo $hosting;
> 
> This returns: Resource ID #3
> 
> The only thing I can think of is that the hostingcost column's default
> value is set to MONEY which is a postgres specific constraint.  The
> query works fine within psql on the server, but not with php.
> 
> Thanks for any help.
> 
> 
> 
> -- 
> 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] problem with SUM and Postgres

2002-10-09 Thread Marco Tabini

Sorry, folks... I meant "result" and not "returns" below. End of day =
brain fried. :)


Marco

On Wed, 2002-10-09 at 19:32, Marco Tabini wrote:
> Because pg_exec only executes the query and returns the resource that's
> associated with the returns. If you want to read the results, you should
> use pg_fetch_result():
> 
> $sql1 = "SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
> '$webserver'";
> $hosting_rs = pg_exec($connect, $sql1);
> $hosting_data = pg_fetch_row ($hosting_rs, 0);
> $hosting = $hosting_data[0];
> 
> 
> Marco
> 
> On Wed, 2002-10-09 at 19:29, webmaster wrote:
> > I can't figure out why the following code is not returning a column
> > total:
> > 
> > $sql1 = "SELECT SUM(hostingcost) FROM $tablename WHERE webserver =
> > '$webserver'";
> > $hosting = pg_exec($connect, $sql1);
> > echo $hosting;
> > 
> > This returns: Resource ID #3
> > 
> > The only thing I can think of is that the hostingcost column's default
> > value is set to MONEY which is a postgres specific constraint.  The
> > query works fine within psql on the server, but not with php.
> > 
> > Thanks for any help.
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] Problems pulling up a certain url with curl

2002-10-10 Thread Marco Tabini

Did you compile curl from scratch? If so, did you enable https?


On Thu, 2002-10-10 at 12:13, Brandon Orther wrote:
> Hello,
>  
> I am farely familar with the use of curl.  I have used it in the past
> and it seems to be working going to test pages such as php.ner and so
> on.  When I try to goto
> https://members.ev1.net/rsmembers/english/index.asp?pge=ttick it doesn't
> return any headers or html at all.  But if you got there in a browser it
> shows up just fine.  Does anyone have any idead why it would do this?
>  
> Thanks,
> 
>  
> 
> Brandon Orther 
> 
> WebIntellects Design/Development Manager
> 
>   [EMAIL PROTECTED]
> 800-994-6364
> 
>   www.webintellects.com
> 
> 
> 
>  



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




Re: [PHP] help with mysql query / logic

2002-10-10 Thread Marco Tabini

Can you perhaps post the structure of your tables? That would make it
easier to help (at least for me)


On Thu, 2002-10-10 at 15:40, Pablo Oliva wrote:
> I have 2 tables, one with job ad information, and a second one with the
> locations that this ad applies to.
>  
> When a person queries the job ad table with their criteria, I would also
> have to query the location table to see if the location that they chose
> applies to this ad.  I am not sure how to construct the sql query
> though, or if there is a better way to set this up.
>  
> Any suggestions will be appreciated.



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




Re: [PHP] Undefined variables?

2002-10-10 Thread Marco Tabini

Of course, you should switch to UNIX :-)

Seriously, have you looked at the source on those lines? Can you post
the source code otherwise so we can take a look and let you know?

The error you are receiving usually means that a variable is used
without having been initialized. For example:

$b = $a * 10;

Will cause a warning if $a is not set to something.


Marco

On Thu, 2002-10-10 at 16:07, Justoman wrote:
> I get this with almost all the scripts I run,
> 
> It's a whole shit load of undefined variables! what are these and please,
> how can they be fixed?
> 
> Here's what I'm talkin bout,
> http://www.darkwatchclan.com/battlestats/bfserverinfo.php
> 
> -Justoman
> 
> 
> 
> -- 
> 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] Undefined variables?

2002-10-10 Thread Marco Tabini

I think the problem is simply that the other server had a different
configuration setting for error reporting, since I can't find
$debug_wintrmte configured anywhere.

I don't know what this code is for, so it's difficult for me to say how
to fix it, since any changes I make may affect the outcome in a way that
will cause the system to stop working properly.

The only suggestion is to contact the original author or (if you are the
original author) to figure out how those variables should be managed. As
a last resort, and only if you are satisfied with the way the site works
right now (aside from the errors, of course), as James Hicks was
suggesting, you can just "hide" the errors by typing 

error_reporting(0); 

on the second line of the file, right after the " 
> Thanks for the feedback,
> I've never actually posted here, so Kevin, cut me some slack.
> 
> Here's whats up,
> The script I'm trying to run is called "Battlestats"
> It's set up on at: http://www.darkwatchclan.com/battlestats/bfserverinfo.php
> (That's where I'm trying to get it to work)
> 
> Now, the exact same "unedited" scipt has been set up on,
> http://jk2.gamersimpact.com/bf1942/bfserverinfo.php and runs perfectly.
> 
> The source for it, could be found with this link:
> http://jk2.gamersimpact.com/download.php?op=getit&lid=3
> 
> So really, its not so much a programmer error, it just has something to do
> with either an error concerning OS working with script, or something wrong
> with the PHP that's set up on the server, because this isn't the only
> working script that doesn't parse properly on this server. All the errors I
> get are undefined variables.
> 
> -Justin "Justoman" Antolini
> 
> 
> 
> "Kevin Stone" <[EMAIL PROTECTED]> wrote in message
> 005701c2709c$b651d2e0$6501a8c0@kevin">news:005701c2709c$b651d2e0$6501a8c0@kevin...
> > Not to be rude.. but you have got to be kidding.  :-\
> >
> > There's no way for anybody to tell what's going on without seeing the
> code.
> > One way or another the script isn't being given the information it is
> > expecting.  My guess is that the programmer isn't doing any checking
> within
> > the script.  He's assuming that these values are set but when they're not
> it
> > spews this list of errors.
> >
> > Is this a script that you wrote or are you here on behalf of the
> programmer?
> >
> > -Kevin
> >
> > - Original Message -
> > From: "Justoman" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, October 10, 2002 2:07 PM
> > Subject: [PHP] Undefined variables?
> >
> >
> > > I get this with almost all the scripts I run,
> > >
> > > It's a whole shit load of undefined variables! what are these and
> please,
> > > how can they be fixed?
> > >
> > > Here's what I'm talkin bout,
> > > http://www.darkwatchclan.com/battlestats/bfserverinfo.php
> > >
> > > -Justoman
> > >
> > >
> > >
> > > --
> > > 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] MS SQL server TEXT column

2002-10-10 Thread Marco Tabini

Set TEXTSIZE usually does it for me:



Make sure that you select a database first and that the connection is
not closed between your Set TEXTSIZE op and the actual query. If you are
not specifying a connection in you mssql_query statement, make sure that
you haven't opened a different connection between Set TEXTSIZE and your
actual query--PHP uses the most recently opened connection as a default,
and if you open a new connection between the two queries, the second
connection will not have the TEXTSIZE set. Hope that helps.


Marco

On Thu, 2002-10-10 at 17:04, Vail, Warren wrote:
> Encountered the following problem with the Microsoft SQL Server interface.
> I am not sure where the problem exists, but I am looking for a workaround.
> 
> I inserted a row into a table that contained a text column, and inserted
> over 5kb string into the text field.  On retrieving the row the server
> returned the column values truncated to 4096 bytes exactly.  Tried to code
> SET TEXTSIZE nnn into my query string, the query refused to return anything
> at all.  Then I tried coding SET TEXTSIZE as a separate query on the same
> connection, just prior to my data query, both appeared to be successful, but
> still only got 4096 bytes of data.
> 
> select DATALENGTH(availabilitySample) from mftsmainframeavailability where
> availabilityID = 1
> 
> using the MSSQL 7 Query analyzer returns;
>  
> --- 
> 5242
> 
> (1 row(s) affected)
> 
> This shows that my text was stored, I just can't seem to get the server (or
> the interface) to give me back more than 4096 bytes.
> 
> any clues would be greatly appreciated.
> thanks in advance,
> 
> Warren Vail
> Tools, Metrics & Quality Processes
> 
> -- 
> 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] Accessing serial ports from PHP

2002-10-11 Thread Marco Tabini

If you're using UNIX, you can try reading and writing to/from /dev/ttyS*
or /dev/ttyS/*

On Fri, 2002-10-11 at 06:34, José León Serna wrote:
> Hello:
>I would like to read and write to serial ports from PHP, is possible? 
> if so, how?
> 
> Regards.
> 
> 
> -- 
> 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] MSSQL_RESULT Problem

2002-10-11 Thread Marco Tabini

Hi!

This is actually a limitation of the sql libraries used by PHP (I assume
you're using Windows). Try using a cast to a text field:

Select Cast(Field As Text) As Field

This should (and I say should because I can't test it right now :) take
care of the problem, although it might make your db a bit slower.

On Thu, 2002-10-10 at 10:19, Francky wrote:
> i have some trouble with mssql_result cause it will return me a result
> limitted at 255 char max.
> 
> in my php.ini i set this value :
> mssql.textsize=65536
> mssql.textlimit=65536
> 
> and in SQLSERVER my field type is VARCHAR(2048)
> 
> can you help me please ???
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] how to configure with ldap?

2002-10-11 Thread Marco Tabini

You need an LDAP package like OpenLDAP:

http://www.openldap.org/

On Fri, 2002-10-11 at 10:37, Jody Cleveland wrote:
> Hello,
> 
> I'm trying to configure php with ldap support. Looking at ./configure
> --help, I noticed that when I configure it, I need to put this in:
> ./configure --with-ldap=[dir]
> 
> My question is, where is ldap? I'm running Redhat 7.3 with Apache 2.
> 
> My ultimate goal is, I'm running Squirrelmail, and I want to connect to an
> Exchange global address list.
> 
> Any help would be greatly appreciated.
> 
> Thank you.
> 
> -Jody Cleveland
> 
> Winnefox Library System
> Computer Support Specialist
> [EMAIL PROTECTED]
> 
> "I thought I had an appetite for destruction, when all I really wanted was a
> club sandwich."
> - Homer -
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] php cgi question

2002-10-13 Thread Marco Tabini

Without seeing your code... only one guess: what are the permissions on
the file like? When you're running the script from the web server,
you're running it as the user under which the web server is running
(usually nobody or apache if you're using Apache on Linux), and this
causes problem if that particular user doesn't have access to the file.

There are very few solutions to this problem (at least as far as I
know). One is the suexec module for Apache, that lets you impersonate
root or another user, but you have to be *extremely* careful with the
permissions. The other is to change the default permissions of the file
so that everyone can delete and modify it, but that might not work well
for your needs. Yet a third one would be to impersonate directly from
PHP, for example through a call to su, but there are pitfalls there as
well.

Hope this helps.

On Sun, 2002-10-13 at 02:37, David Cook wrote:
> Hi all,
> 
> Got a question regarding using php scripts as cgi's.
> 
> What I am trying to do is this. (ya may need a bit of background, it gets a
> little complicated... well for me its complicated)
> 
> Im building a web based email system using php (duh) as the front end and
> glue for everything, part of it is using a program called getmail to
> retreive remote pop accounts to the virtual accounts on the server (its all
> virtual using qmail/vpopmail and courier-imap). The various setttings for
> this are in a file called getmailrc, in the virtual users home dir, (this
> will also be theoretically relevant when I try and do the same thing with a
> server side filtering program called maildrop.. but one at a time I reckon
> :))
> 
> ie. /home/vpopmail/domains/some.email.domain/someuser/.getmail/getmailrc
> 
> This file is owned specifically by a user/group otherwise getmail wont work
> 
> ie: -rw-r--r--1 vpopmail vchkpw585 Sep 29 07:16 getmailrc
> 
> any permissions other than this will tweak getmails internal security and
> stop it.
> 
> I decided to minimise security problems and use mysql as an intermidiary
> storage for any rules created for getmail, which works fine. :) (yay me..
> lol)
> 
> NOW comes the problem, I need to write (overwrite) that getmailrc file after
> the user has finished messing with their settings, to do this I decided that
> since the file can only be read/written to by the vpopmail/vchkpw
> user/group, that I would knock up a php script to run as a cgi, that would
> do only one thing: Upon a button being pressed to 'finish edit' the new
> rules would be written to the mysql table, then the cgi would be invoked
> with a particular identifier so that it could then look up the mysql table
> (using that identifier so it gets the right rows), and following some rules
> inbuilt, write out the getmailrc file with that restrictive permissions set.
> 
> I wrote up a script that was just for POC, that would get the data for where
> that file was supposed to be (the /home/vpopmail/etc...etc) and read it,
> then break out the various details and display it, basically just showing me
> what was already in the file. (using the shebang method, as my php cgi
> interpreter is OUTSIDE the web tree, but thats another story of getting the
> damn thing to work at all... damn RPM'S sometimes...
> that --enable-force-redirect had me stuck for a few days)
> 
> When I tested it out from the shell, using ./getmailtest.cgi as root, it
> worked, in that it did what it was sposed to.. display the contents of the
> getmailrc file. This cgi php script is owned by vpopmail/vchkpw which should
> allow reading the file as said above
> 
> Great, thought I, and proceeded to attempt linking to it from within the
> editing script, using both an attempt with a 'submit' button and a click
> through link.
> 
> Now comes the prob, it fails, with an error of being unable to either open
> the file, or that the file doesnt exist (depending on what I fiddle with in
> the script).
> 
> Would anyone have any ideas as to what may be going wrong here? I havent
> tried doing this before, using php as a cgi to do stuff to files on the
> system, so I am at quite a loss, and any help would be appreciated.
> 
> Regards
> 
> David Cook
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



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




Re: [PHP] PHP/mySQL help or advice

2002-10-13 Thread Marco Tabini

There are a few PHP calendars:

http://www.cascade.org.uk/software/php/calendar/index.php

for example, that you can start from. It should be relatively easy then
to write a small table that contains just one field:

Date (datetime)

All you do is insert a row in the db for each day that is booked and
then whenever you have to check just hit the database: if there is a row
corresponding to the day you're checking, then the day is booked,
otherwise it isn't.

This is kind of the short version, but hopefully it should give you
enough to get going!

Cheers,


Marco

On Sun, 2002-10-13 at 07:48, Ray Healy (Data Net Services) wrote:
> Hi All
> 
> I have been trying to write a database and scripts for a calendar that shows which 
>days are booked and have failed at each point.
> 
> What i would like it to do is to show a calendar which have the dates that are 
>booked in a cell which are colour coded (say red) when it is unavailable and say 
>white when available.
> 
> The admiministartor should be able to enter multiple dates at a time (say a holiday 
>is booked for 5 days). perhaps a section for nortes that is only available for admin 
>use only would be handy.
> 
> An option to view 2 months at a time or perhaps the whole year would also be nice.
> 
> I have downloaded various scripts and tried to write my own but I cannot seem to be 
>able to enter multiple dates or colour code the output.
> 
> Can anyone help me or perhaps someone already has a script & database that does this 
>and would be willing to share.
> 
> Otherwise it there a script already out there that will do this - all the one that I 
>can find seem to do too much by allowing multiple users and storing a lot more data 
>which is something I do nort need.
> 
> Any help would be appreciated as I am tearing my hair out at the moment.
> 
> Thanks for your time
> 
> Ray Healy



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




  1   2   3   >