RE: [PHP] File information JPEG Files

2003-01-12 Thread Warren Vail
I you are into bit crunching, check out

http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/JPEG.txt

if not, somehow view the jpeg in ie, right click on the picture, and select
properties, look under dimensions.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 12, 2003 8:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP] File information JPEG Files


How can i get the file information of a uploaded jpeg-file.
i need the heigt and width in pixel and the resolution.
Thanks Harry



--
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] Access to Pear

2003-01-27 Thread Warren Vail

I know how to load extensions if they are not included in PHP.ini (dl
function), but how do I gain access to PEAR?

I can see the directory /apache/php/pear/ on my test machine, but when I try
to reference via

include_once("DB.php");

not found on include list error, can I dynamically change include list,
and what kind of security hole would that represent?  my test machine is
windows, and my production machine is Redhat Linux, so I need to find a way
to gain access to pear in both environments.

Warren Vail
[EMAIL PROTECTED]



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




RE: [PHP] Controlling browser windows with php?

2003-02-09 Thread Warren Vail
Since PHP executes server side and not in the browser, you may want to
resort to something that runs in the browser, like Javascript, which PHP can
output as part of the html it feeds to the browser.

check out http://www.hotscripts.com/ for lots of handy examples of how
Javascript opens an additional window on the browser, note that the URL for
the new window can point to another PHP (server side) script to fill it with
information.

You might want to check out the PHP section as well, there are lots of
useful routines there.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Geoff Lists [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 09, 2003 10:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Controlling browser windows with php?


Hi,
I'm relatively new to php and neither of the books I am using for
reference mention anything about controlling a child window.

What is the correct syntax to:
open window( width, height, menu, scrollbars)  and position it on the
screen?

Any help would be gratefully and humbly accepted I need to know how to
do this now!
OR
How to call an existing javascript to do it for me.

Thank you.
Heff.


--
Geoff Hill
Information Technology Training & Solutions
A.B.N. 28 712 665 728

P.O. Box 7156
Lismore Heights, NSW, 2480.

Ph:  02 6688 6381


--
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] Still having a problem with IF/ELSE Statement

2003-03-06 Thread Warren Vail
Jess,

In your statement;

if("$status=='active'"){

the conditional inside quotations is treated as a string and not evaluated,
remove the outer double quotes :->

hope this helps,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Ray Hunter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 8:02 AM
To: Hunter, Jess
Cc: PHP Mailing List
Subject: Re: [PHP] Still having a problem with IF/ELSE Statement


Maybe throw in the code where $status or $Row[status] get initialized.

but i would do it like this:

if( $status == 'active' ) {
echo "active line\n";
} else {
echo "inactive line\n";
}

or

if( $Row['status'] == 'active' ) {
echo "active line\n";
} else {
echo "inactive line\n";
}

One of those should work based on the code.  However, based on the
variables $Row and $status that might not be the case.

--
Ray


On Thu, 2003-03-06 at 05:31, Hunter, Jess wrote:
> I want to tahnk those that responded to my previous post, seems I was
doing
> this all the wrong way.  I am still having an issue with the syntax:
>
> if("$status=='active'"){
> echo("active line\n");
> }else{
> echo("inactive line\n");
> };
>
> When I display an employee record that has the employment status
> $Row[status] of active, then the "active line" displays no problem, when I
> display an employee record of an inactive employee, I still get the
"active
> line".
>
> I have also tried to do it this way but to no avail:
>
> if("$Row[status]=='active'"){
> echo("active line\n");
> }else{
> echo("inactive line\n");
> };
>
>
> Not to mention numerous ways of adding/removing/changing double quotes and
> single quotes around.
>
> Any and all help would be greatly appreciated
>
> Jess
>
> --
> 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] Some SESSION Vars not Registering

2003-07-22 Thread Warren Vail
Don't all variables registered to a session need to be declared as global?

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 6:15 PM
To: Jeff Stillwall
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Some SESSION Vars not Registering


Hi,

Wednesday, July 23, 2003, 6:22:58 AM, you wrote:
JS> I have a function that assigns some session variables I need available
JS> during a user's visit.  Oddly enough, as I assign about 7 variables, I
JS> noticed that not all had data.  This is the function:

JS> function setupUserEnv ($userArray) {
JS> $_SESSION['loggedIn'] = 1;
JS> $_SESSION['id'] = $userArray['id'];
JS> $_SESSION['uid'] = $userArray['uid'];
JS> $_SESSION['fname'] = $userArray['fname'];
JS> $_SESSION['lname'] = $userArray['lname'];
JS> $_SESSION['dateapproved'] = $userArray['dateapproved'];
JS> $_SESSION['email'] = $userArray['email'];
JS> }

JS> Pretty straight forward.  I've used var_dump as soon as I enter the
function
JS> to make sure $userArray is populated the way I expect - it always is.
Only
JS> the session variables for 'loggedIn', 'uid' and 'dateapproved' stay set
JS> outside of this function.  However, I can set a session var not used in
my
JS> program in this function, and it'll stick: $_SESSION['justTesting'] =
JS> "test"; will stay set outside of this function.

JS> If I put a var_dump at the end of the function for $_SESSION, I see all
JS> session vars are set within the scope of the function.  Once outside of
the
JS> function, some stay set, some do not.

JS> I've read the chapter in the manual about variable scope, and it seems
JS> pretty clear that $_SESSION is a superglobal, and I do not have to
declare
JS> it with the 'global' keyword.

JS> I've tested this on three separate installations of PHP/Apache, and I
get
JS> the same behavior each time.

JS> Anyone clue me in to what I'm doing wrong?  Thanks!
JS> --
JS> Jeff Stillwall

Try passing a reference to the array like this

function setupUserEnv (&$userArray) {
$_SESSION['loggedIn'] = 1;
$_SESSION['id'] = $userArray['id'];
$_SESSION['uid'] = $userArray['uid'];
$_SESSION['fname'] = $userArray['fname'];
$_SESSION['lname'] = $userArray['lname'];
$_SESSION['dateapproved'] = $userArray['dateapproved'];
$_SESSION['email'] = $userArray['email'];
}

Otherwise no idea at this point :)
--
regards,
Tom


--
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] remote file moddatetime

2003-06-08 Thread Warren Vail
I am trying to upload a file using php's ftp functions between two RedHat
7.3 systems.  I'd like to make sure the destination file has the same
modification date as the source file, so that I can later compare to see if
it has been modified on the remote machine, but not sure how to approach
this.  I tried to use the SITE command to pass a touch command, but that
didn't work.
Other than the obvious places, where do I go from here?

thanks in advance,

Warren Vail
[EMAIL PROTECTED]


RE: [PHP] PHP Certification

2003-06-26 Thread Warren Vail
Certification programs, imho, exist primarily for two reasons;

1. it allows developers with little experience to add credibility to their
claims that they know how to develop software.

2. it allows non-technical people involved in the hiring chain to make
judgements when they have no clue at all how to judge good technical
competence.  Course, after you've been around a while, you learn that you
cannot do a proper job of judging anyone's competence, even after many hours
of interviews.  The proof is in the project outcome.

3. Ok, I forgot the third reason... Someone will make lots of money selling
training materials and administering the tests.  Did you really think
Microsoft got into this side of the business just to improve the quality of
technical consulting.

my 2 cents (ok, maybe 4 cents),

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 8:15 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] PHP Certification


 I find the value of such certification programs
> extremely questionable.

here here :D



--
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 Certification

2003-06-26 Thread Warren Vail
A working public website, that solves a business problem, is a good
credential.  I can't help but wonder if it takes more hours to develop a
respectable site or to study and take an exam.  Do you suppose the
certification exam might actually be an easier option?

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 8:59 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: [PHP] PHP Certification


yeh well these exams come in modules , and are extremely pricey , i think
good web examples, screenshots and experience should be enough, sadly i
have not done uni so am frowned upon when looking for work but have
experience in the work force, 4 years in IT now ok thats not enough but i
have fine tuned my programming skills, i am wanting to move in java also
now, i contract also but dont have much on my portfolio to show to get the
jobs , just starting the business side of things and may have to work for
near nothing just to get examples up, so i think portfolio examples are
more important than certification.


> Certification programs, imho, exist primarily for two reasons;
>
> 1. it allows developers with little experience to add credibility to
> their claims that they know how to develop software.
>
> 2. it allows non-technical people involved in the hiring chain to make
> judgements when they have no clue at all how to judge good technical
> competence.  Course, after you've been around a while, you learn that
> you cannot do a proper job of judging anyone's competence, even after
> many hours of interviews.  The proof is in the project outcome.
>
> 3. Ok, I forgot the third reason... Someone will make lots of money
> selling training materials and administering the tests.  Did you really
> think Microsoft got into this side of the business just to improve the
> quality of technical consulting.
>
> my 2 cents (ok, maybe 4 cents),
>
> Warren Vail
> [EMAIL PROTECTED]
>
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 26, 2003 8:15 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP Certification
>
>
> I find the value of such certification programs
>> extremely questionable.
>
> here here :D
>
>
>
> --
> 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] CPanel adding POP account

2003-09-14 Thread Warren Vail
Try;

http://www.cpanel.net/docs/cp/

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dasmeet [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CPanel adding POP account


I am having a server that runs CPanel/WHM... I wish to create a free 
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

-- 
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.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



RE: [PHP] CPanel adding POP account

2003-09-14 Thread Warren Vail
found a better programming resource at

http://cpanel.net/docs.htm

Seems you may be able to access each cpanel function (see the sample PHP
script).

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:59 AM
To: Dasmeet; [EMAIL PROTECTED]
Subject: RE: [PHP] CPanel adding POP account


Try;

http://www.cpanel.net/docs/cp/

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dasmeet [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CPanel adding POP account


I am having a server that runs CPanel/WHM... I wish to create a free
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

--
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.com

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

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

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



RE: [PHP] Reading URL is changed

2003-09-19 Thread Warren Vail
What Dan says is true,,, IF there are other form fields on the form where
your user is making his choices.  Since the hotlink fakes a "Get" type of
header, and does NOT cause the other fields be submitted as well, any last
minute changes to those formfields will be ignored by your form processing
routine.

On the other hand, if the click is the only value to be transfer the hotlink
technique should be adequate.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dan Anderson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 19, 2003 5:58 PM
To: Dan J. Rychlik
Cc: PHP List
Subject: Re: [PHP] Reading URL is changed


First of all, you can use Javascript to submit a form when the link is
pressed.

Andu has a good idea too, but I figured I'd elaborate:

If you create a form like:

  
  
  


The browser visits the URL:

http://www.foo.com?foo=bar&bar=foo

This is called GET method in a form.  Do a google search.

Note that you will have to URL encode all variables and data.  PHP
manual has a good section.

-Dan

--
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] Mailing List

2003-11-02 Thread Warren Vail
Allowing scripts to run without some kind of time limit may not be prudent,
but settling for the timelimit imposed on online web pages is not reasonable
either.  I would recommend you reset the time limit to something reasonable
to perform your email tasks on the computer you have available.

http://www.php.net/manual/en/function.set-time-limit.php

As long as you don't have a "run away" program, I can't think of any reason
not to allow it to have the time it needs to get the job done.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: PHPLover [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 02, 2003 10:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Mailing List


Dear All,

I would like to setup a mailing list for my company.
I have a database containing email address of my clients along with other
details.
How can I send them mails ?
If i write a script containing the mail function and loop the address, I
think that might generate a script timeout error. I feel increasing the
script timeout is not a good solution. I would like to know how you manage
such situations. I feel this is a common problem but i didnt find any
solution on the net. Do I need to use any sw or are there any already
available scripts.

Thanks a Lot !!
Long Live PHP !!

Thanks & Regards,
___
PHPLover
"Göd döësn't pläy dícë."
- Älbërt Ëínstëín

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



RE: [PHP] ssh command in php script

2003-11-11 Thread Warren Vail
Don't know if this will help, but I worked on one implementation that
involved writing a daemon (we used perl, but php would work as well) which
runs as a user privileged script (started from cron), and waits for a
connection from my web app, and verifies that the request is coming from the
proper server and script, executes the ssh, and returns the controlled
result to the web app.  We also used this daemon to fork some processes and
create multi-threaded collection process (but that's another nut).

In my case the apache web server tasks ran as a user named "nobody", which
had no system privileges at all, a common safeguard, on RH Linux.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 10:38 PM
To: tirumal b
Cc: PHP-General
Subject: Re: [PHP] ssh command in php script


On Tue, 2003-11-11 at 01:34, tirumal b wrote:
> Hello All
>
> I have written the following command in PHP script
> echo `ssh  `. I have the remote ip
> addr as trusted, dont ask for the password at all.
> when the execute the php file from the browser it does
> not go to the remote ip at all though this command
> works fine in a normal bash script. what is the
> problem. Thanks in advance.

Shell commands run from the browser inherit the browser's user -- this
is usually httpd or apache.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
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] Calling PHP functions from within javascript

2003-11-13 Thread Warren Vail
I suspect you need to be careful how you use the term "call".  It is
possible for javascript, which runs on the "client side" or in the browser,
to cause the browser to perform a form submit, and if the action field of
the form points to a php script on a server "server side", then the php code
will execute on the server, processing the form content on the server and
sending new results in the form of html and javascript back to the browser
"client side".

That may have appeared to you as a "call" but most PHP developers would not
use that term.  Two items you may not have control of yet, is that in this
case the PHP always runs on the server machine, and javascript always runs
on the browser machine, and the only way they can both execute on the same
machine, is if the server and browser are both on the same machine.  The PHP
will always run in the memory space of the server, and the javascript runs
in the memory space of the browser.

The only exceptions to the last statement is when the PHP runs from the
command line, at which time it is not communicating to a browser (often
referred to as a CGI, even though it isn't) and the only time, I believe,
that javascript can execute on a server is using an old product, that I have
only heard of but never used, referred to as "server side" javascript.

hope this helps,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Nitin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 10:52 PM
To: Jake McHenry; [EMAIL PROTECTED]
Subject: Re: [PHP] Calling PHP functions from within javascript


First thing is, it's possible, i've done it in the past myself, it's just
not working due to some reason. Second, functioning cann't be achieved with
javascript, cauz it's DB related.

anyway thanx for ur reply
Nitin

- Original Message -
From: "Jake McHenry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 13, 2003 12:16 PM
Subject: RE: [PHP] Calling PHP functions from within javascript


> > -Original Message-
> > From: Nitin [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, November 13, 2003 1:35 AM
> > To: PHP-General
> > Subject: [PHP] Calling PHP functions from within javascript
> >
> >
> > Hi all,
> >
> > can anybody tell me how to call PHP functions from within
> > javascript, as I want my PHP function to be interactive. I
> > need to call the function written in the same page, with the
> > values selected by the user
> >
> > Thanx in advance
> >
> > Nitin
> >
>
> Someone correct me if I'm wrong, but this isn't possible unless you
> have your javascript continuously refreshing the page, and changing
> the url, or posting data. PHP is server side, so the only way for php
> script to be executed is when the page loads. It might be more
> productive if you create the functions you want executed in javascript
> instead of php.
>
>
>
> Thanks,
>
> Jake McHenry
> Nittany Travel MIS Coordinator
> http://www.nittanytravel.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

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



[PHP] Comparison PHP to Perl

2004-01-05 Thread Warren Vail
I am looking for a comparison of features supported by PHP vs those
supported by Perl.

My gut tells me PHP is more robust, but we are trying to implement something
in a company that has long had a standard allowing Perl as a "sanctioned"
language, but current management does not want to fight for PHP as a new
"sanctioned" language (most managers there have never heard of PHP and the
resident Java zealots have almost established a monopoly).  The kind of
thing I am looking for is SESSION support, I know it's supported by PHP, but
not sure about Perl.  I don't want to have to grow my own session manager.
One alternative is mainframe COBOL, which clearly will not support what we
want to do.

What would I lose by implementing in Perl (other than my mind)?

thanks in advance,

Warren Vail
[EMAIL PROTECTED]


RE: [PHP] Installing PHP on 2nd Windows Drive

2004-01-14 Thread Warren Vail
There is only one port 80 (the port used by your browser by default to
connect to apache), choose a different port for the second instance, and you
should be ok, but all url's will have to have a non-standard port number.

Same is true for MySQL (different port number, but same conflict).
Configure your 2nd MySQL to listen to a different port, and make sure that
all your PHP code connects to MySQL using the different (non-standard) port
number.

I'm guessing two things; 1) if there are other common dependencies, like
system registry (there is only one per machine) you will run into those and
2) other configuration dependencies (like things that need to be on the C:
drive) will pop up (like php.ini?).

My recommendation would be to get a 2nd cheap machine, and network them.  My
experience at doing this tells me machines are less expensive than the
headaches you are going to have with conflicts.  But you do stand to learn a
lot, or at the very least a lot of things that you will never use again.

good luck,

Warren Vail


-Original Message-
From: Freedomware [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 1:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Installing PHP on 2nd Windows Drive


I got a preconfigured package - Apache 2.0/PHP/MySQL - up and running,
then I installed Apache 1.3. Everything seems to be working fine, and
I'm ready to start tweaking it.

In the meantime, I bought a book about Apache, PHP and MySQL, which
includes tutorials on downloading the programs individually.

I don't want to mess up what I've already installed, but I have an
external hard drive that I use for backing up my documents. Could I
install new Apache, PHP and MySQL programs on that drive? They wouldn't
interfere with the equivalent programs on the C drive, would they?

In fact, is it possible to have PHP programs from two hard drives open
at the same time? After all, I can open up documents on both drives with
Windows Explorer.

Of course, I guess I'd have to install Dreamweaver on the second drive,
too, so I'd be able to test PHP and make sure it's working.

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



[PHP] Telnet from PHP

2001-04-16 Thread Warren Vail

I've seen a number of requests for info on this subject with no answers.

Is anyone working on a tn (Telnet) screen scrapper connectivity toolset for
PHP?
How about tn3270?

Warren Vail
Availabletech.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Incrementing dates

2001-04-22 Thread Warren Vail

If you are looking for a PHP only solution you might try hand calculating
the amount of time you want to adjust in seconds (i.e. 60 seconds x 60
minutes x 24 hours x 10 days = 864000)

$newdatetime = (strtotime($otherdatetime) + 864000;
I often use something similar to adjust for timezone differences.

There are lots of other datetime functions in the manual ;)

Warren Vail

-Original Message-
From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 3:09 AM
To: Martin Skjoldebrand; [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


you can then do this:

INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
bla=bla;

it is just a way to do it. you will definitely have to play with it.

However you can easily make two queries to read the previous date combining
it with INTERVAL and then do an insert.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


PHPBeginner.com wrote:

> I am not sure on how your possibilities are,
> but doing this in PHP means literally "adding useless lines and loops"
>
> If possible, do it with SQL queries. Read the documentations on date
> datatypes, this is so much easier... almost magic.
>

AND

> You can (mySQL, right?) do the following:

>UPDATE table SET date=(date+INTERVAL 10 DAYS);

>so if date there was 04-28, it will be added 10 more days and so will
>become
>05-08

>Use SQL for this things, it treats dates as 'dates' while PHP treats them
>as
>integers and strings.

Sounds even easier. But what if I'm not doing an UPDATE but an INSERT? Can
it read the previous date? I am inserting a batch of bookings at one time.

Martin S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] session_register()

2001-05-02 Thread Warren Vail

Jennifer,

I could be wrong but this is what I think you have;

When the session_register is executed the session contents are partially
updated.
Your first test actually executed the session_register that posted the
variable with 0 string length, because the variable had not yet been
initialized (the bad return is the only indication of this).
Your test that the variable is registered would seem to suggest this.
You then changed the variable value and failed to register this new value.

The second page found the only value you registered (the uninitialized
variable with zero length) and displayed that.

You can identify what actually happened by viewing the session file contents
after your two pages are displayed.

hope this helps,

Warren Vail

-Original Message-
From: Jennifer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 10:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_register()


"Johnson, Kirk" wrote:
>
> > -Original Message-
> > From: Jennifer [mailto:[EMAIL PROTECTED]]
> > Do you need to register a variable with the session before you
> > assign it a value?
>
> Not in my experience.
>
> > session_register should return true if the variable was
> > successfully registered?
>
> It returns "1".
>
> > The variable name and it's value should be written to the file
> > with the same name as session_id()?
>
> Yes, here's a sample from a session file: superUser|s:3:"Yes";
> Here's a sample session filename: sess_01bc2e24aa5291300887948f0af74899


This is all what I thought, but I am still having problems and I
don't have a clue what I am missing. Here's an example that I
have been paying with for testing.

page1.php contains
\n";
if (session_register("testing")) {
echo "session_register worked.\n";
}
else {
echo "session_register did not work\n";
}
if (session_is_registered("testing")) {
echo "testing is a registered variable\n";
}
else {
echo "testing is not a registered variable\n";
}
$testing = "Let's see if this works.";
?>
Go to next page.


The output of the above page, gives me
session id is e35c2893382e28a14fa0455302edb06e
session_register did not work
testing is a registered variable
Go to next page.


and page2.php contains
\n";
echo "Testing: $testing\n";
?>


The output of page2 gives me
session id is e35c2893382e28a14fa0455302edb06e
Testing:

I am totally confused.  First off, why isn't it registering the
variable? There is a file named e35c2893382e28a14fa0455302edb06e
in my /tmp directory, but it is empty.

Second, if it isn't registering the variable then why is
session_is_registered("testing") returning true?

Jennifer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] installing php3 and php4 on the same server

2002-01-27 Thread Warren Vail

I have a follow-on question to this one.

I do implementations for clients in PHP and do my development and testing
under windows (OK, I know), and the systems are targeted for servers that
have PHP3 and others with PHP4.  I would think that I could direct files
with suffix php3 to use the php3 engine, and php to the php4 engine, but I
can't seem to get this to work.  Granted PHP4 will handle php3 code (as near
as I can tell), but I expect I will inject some php4 dependencies into the
code destined for a PHP3 server.  The clients using php3 don't control the
server so they can't their ISP to upgrade for them.  Moving them to a site
that will work with them is not the question here.  The question here is how
can PHP4 and PHP3 co exist, and where can I get information on how to set
that up on windows system.  I am running php4 successfully with apache and
mysql, trying to activate the php3 version, regardless of changes I have
made to httpd.conf, my php3 scripts invoke php4.

Thanks,

Warren Vail


-Original Message-
From:   Manu Verhaegen [mailto:[EMAIL PROTECTED]]
Sent:   Friday, January 18, 2002 12:59 AM
To: Alex Dowgailenko
Cc: [EMAIL PROTECTED]
Subject:Re: [PHP] installing php3 and php4 on the same server

We have the following problem, we have now apache 3 and php 3 ,we have
upgrade the apache and the php3 tot php4 evereting will working fine. 2
internetproviders in belgium will working with proxyservers if you want to
view a webpage on the lastversion of apache an php4 the page will not
correct viewed



Greetings,

- Original Message -
From: "Alex Dowgailenko" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 18, 2002 8:44 AM
Subject: RE: [PHP] installing php3 and php4 on the same server


>
> Question is, why would you want to?
>
> php3 scripts will work fine under php4.
> > -Original Message-
> > From: Manu Verhaegen [mailto:[EMAIL PROTECTED]]
> > Sent: January 18, 2002 2:39 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] installing php3 and php4 on the same server
> >
> >
> > Hi,
> > We have installed apache 3 and PHP3, can we install PHP4 on the
> > same server
> > the we can use PHP3 and PHP4
> >
> > Thanks,
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP] Exchange Server Access

2002-02-26 Thread Warren Vail

I am trying to figure out how to access a Microsoft NT Exchange Server using
PHP on windows.  I have NOT found success using IMAP to connect to the
supposedly IMAP compliant server or trying to use COM to access that server
via Outlook.  I have considered trying to invoke the MAPI API, but not sure
how to go about that, and I have considered trying a JAVA API, but not sure
where to start here either.

My goal is to read email, and move that email between folders, from a CGI
app that runs every 5 minutes or so on a windows platform, updates a MySQL
database which is used to support Helpdesk analysts who respond to reports
of problems made via email.  Has anyone had any success with MS Exchange, I
will consider all options, but would prefer to use PHP.

Warren Vail



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




RE: [PHP] Writing to files

2002-02-26 Thread Warren Vail

What you are describing is exactly how session management works, storing
things in a file in the /tmp directory.  Perhaps you could consider using
the session save handler functions to store the session data in your
protected database (MySQL?).

Warren Vail

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, February 26, 2002 11:19 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Writing to files


Question I have is, Anyway know of a better way to store temp
information?

I have a problem that a script I use, uses many pages and after each
page the information from the form
Is stored and the next page is shown ect

It uses more than 20 variables so I can not store the data in cookies.
I could store the data in a temp file created but problem is that the
webserver would need to create
The file which is a security risk (I would like to find another way
other than this).
I don't really want to use sessions but if it's the last resort I guess
I will have to.

Other than the above any one have a better soluition?

Running php 4.1.1 on RH7.2

---
Chris Kay, Eleet Internet Services
[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] Writing to files

2002-02-27 Thread Warren Vail

Not sure I understand how you concluded that web server should not create
files, it certainly should not be able to create files on client machines
without permission of user (which it cannot do).  Users should not be able
to upload files to the server without the permission of the web application,
but if a web application performs the upload and controls where the file
goes and what is in the file, that would be safe.  If the web application
completely controls where temporary files go and what goes in them
(variables) then how is that unsafe?

On the subject of using the database, check out which environment variables
that actually control session management (you can do this by running the
phpinfo() function.  There are two major configuration options which you
have full control over; 1. If the sys admin controls the "default"
configuration of where to write the session data (usually points to /tmp
directory), then the session_set_save_handler function is your way to
override those parameters.  2.  In fact if you read the routine that
performs garbage collection (deletes expired session data) session
management will pass to that routine the parameter that controls the default
lifetime from the sysadmin's setup data, which you as the writer of the
routine are free to ignore and use your own.  Only caveat is you need to
include these routines in every page that records data to a session (no big
deal).

I wish you luck on this, you seem to have been advised on some rules, by
people who didn't know what they were talking about, or perhaps you
understood their recommendations out of context, and that makes it hard for
you.  I really think session management is the way to resolve your problem.
It would be interesting for you to get a couple of opinions on the subject
of creating files on a server.  You could create routines that would write
to physical files in these save_handler functions and put them in your user
directory if you like, but I would not mix these files in the same directory
as your application code, perhaps a sub directory.  I would be willing to
bet there are log files that are updated on your server every time someone
accesses one of your web pages.

Good luck,

Warren Vail

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, February 27, 2002 12:36 AM
To: 'Warren Vail'
Cc: [EMAIL PROTECTED]
Subject:RE: [PHP] Writing to files


I know I can do this with sessions, reason I am asking is

webserver should not be able to create file (for security reasons),
I would of maybe thought php could create a file as a different user.
php is not always used by the box owner. I find it strange that such a
option
Is only available if you run the box or the webserver is run as that
user.

Sessions and such need configurations that need to be configured by the
server admin
Ect I was hoping there was a way that didn't rely on a special
configuration
And stayed in the users directory

---
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
---


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 February 2002 6:51 PM
To: Chris Kay
Subject: RE: [PHP] Writing to files


Suggest you understand how session management works.  Whether you store
in a file or database, the entries are removed if the user fails to
return after a limit amount of time, and are kept in a separate table in
the database. You can post the results to your actual data tables when
you are completed. If you don't want to store the data in files, or in a
database, what did you have in mind?  There is no rule that says you can
only store permanent data in a data base.

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, February 26, 2002 11:43 PM
To: 'Warren Vail'; [EMAIL PROTECTED]
Subject:RE: [PHP] Writing to files


The data will be stored in mysql, but I don't wish to store in sql
untill its completed. In case a user leave the application before
completing it.

---
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
---


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 February 2002 6:37 PM
To: Chris Kay; [EMAIL PROTECTED]
Subject: RE: [PHP] Writing to files


What you are describing is exactly how session management works, storing
things in a file in the /tmp directory.  Perhaps you could consider
using the session save handler functions to store the session data in
your protected database (MySQL?).

Warren Vail

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, February 26, 2002 11:19 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Writing to files


Question I have is, Anyway know of a better way to store temp
information?

I have a problem that a script I use, uses many pages and after each
page the information from the form Is stored a

RE: [PHP] Re: Empty form variables when uploading, Help please???

2001-11-13 Thread Warren Vail

Interesting because I have used multiple submit buttons on forms for years.
Each can have a different name, and even if I use the same name for all of
them, which I often do, each can have a separate value.  Each will cause all
other form fields to transmit their variables in their usual manner, but
obviously I will only receive one submit button( the one that was clicked).
If all are named "go" with different values (what displays on the button),
all I have to do is;

Switch($go) {
 Case "Add":  something; break;
 Case "Update":  something, break;
 Case "Delete":  something else, break;
}


-Original Message-
From:   The Big Roach [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, November 13, 2001 8:19 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Re: Empty form variables when uploading, Help please???

 << File: [PHP] Re Empty form variables when uploading, Help please.txt >>
In a form you can't really have 2 submit buttons.
Either a submit submits or it is just a button.
That's because the var name is already submit (check out your
http_post_vars).
And you have it twice!
Change one of them and make it just a button (HTML4).
Recheck your post-vars.
This should help.

Otherwise you're loosing your post vars somehwere in the fire-wall.
That's bad!


"Sandra Rascheli" <[EMAIL PROTECTED]> wrote in message
003601c16abd$3985ae70$c46223c8@srascheli">news:003601c16abd$3985ae70$c46223c8@srascheli...
Hi everybody,

I hope someone is able to help me with this, I've been having this problem
for  a couple of months now and I have not been able to find a solution. I
have a form to upload a file which submits to itself, and has two submit
buttons, one called "eliminarfoto" (deletephoto) and "salvar" (savephoto),
but for some weird and unexplainable reason (it only happens to some users,
not all of them) when they hit any of these two submit buttons, the form
returns empty variables.

This is part of my script, has anybody had a similar problem before??? Any
help would be greatly appreciated.

 
 
 
  Foto
  (opcional,tamaño máximo: 20k,formatos permitidos: JPEG,
GIF)
  
  ";
  }
  ?>
  
  
  
  
  
 
 
  
  
  

 
 
 







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] database question

2001-11-29 Thread Warren Vail

Try;

SELECT whatever FROM articles WHERE textlines LIKE "%searchword%"

Two warnings;

1) This will force a "table scan" (the contents of each row in the entire
table because there can be no index to support faster searching of contents
that float in the column) which will be very slow on a large database (even
a medium size one).
2) This will also find words that exist inside other words. (ie the word
"ward" exists inside "toward")  If you try to solve this by imbedding blanks
between the wildcard (%) and the text, you will probably not be able to find
the word at the end of a line, or just prior to a comma or period.

I also believe there may be a way to make the search case insensitive, look
for something like a " WHERE tolower(textlines) LIKE ..." to force the
column values to be all lower case and make sure your search values are all
lower case as well.

Good luck,

Warren Vail

-Original Message-
From:   Michael Hall [mailto:[EMAIL PROTECTED]]
Sent:   Thursday, November 29, 2001 2:21 PM
To: PHP List
Subject:[PHP] database question


How can I search a MySQL database field that contains sentences (VARCHAR
datatype) or entire texts (TEXT datatype) for single words?

Let's say I want to search 100 articles stored in a database field as TEXT
for the word "bingo", is there any SQL or PHP way of doing that?

Mick

--

Michael Hall
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://openlearningcommunity.org



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] "Talkback" or community type participation.....

2001-12-22 Thread Warren Vail

Deron,

By doing a Post to itself, this form will cause an error everytime someone
clicks the Back button on the browser (after the first post, of course).

What I do is have two forms, first invoked with a get via hot link or
redirect.

Form_1.php checks to see if variable $s has been passed (in the URL, of
course), if not it initializes and displays the form.  The Form action on
this displayed form indicates to "Post" to Form_2.php.

Form_2.php displays nothing, just processes variables on the form.  This one
would insert the row, and to avoid thread problems (multiple simultaneous
inserts, from multiple users) has a unique "autoincrement" variable as the
primary key to the table (MySQL will make the insert "thread safe").  When
the insert is successful this routine redirects the browser back to form_1
like so;

Header("Location: Form_1.php?s=$insertid");
Exit;

When control is passed to Form_1.php again, this time the variable $s is set
and the row is retrieved from the table (instead of using initialization
values) and displayed in the form giving confirmation of the updates that
were done.

Because Form_2 redirects to Form_1, Form_1 is the only one on the browser
history list(each separate instance is tracked, of course), and it is always
entered via a Get, meaning that the browser does include the passed variable
values in the history list (it doesn't do this with a Post). And the Back
button works.  In the Post error you are working toward, the browser
complains that it does not have a record of the "Post" variable values (the
Data Has Expired).

There may be other ways to deal with this, but this is one way that I have
found that works.

Good Luck,

Warren Vail

-Original Message-
From:   Deron [mailto:[EMAIL PROTECTED]]
Sent:   Friday, December 21, 2001 11:38 PM
To: [EMAIL PROTECTED]
Subject:[PHP] "Talkback" or community type participation.

Hi there!

I have this script I just made based on a tutorial I found online and was
wondering if there was a better way to do this or not. Everything works
great so far except for a couple little things. Once the $submit is clicked
and runs the INSERT data into the table... I am looking to be able to have
the page auto refresh and display the new entry as well as the form again.
Here's my current code: (I have this built into the main review page via an
include. The entire page can be viewed here:

http://www.metalages.com/2002/reviews/reviews-test.php?band=Evergrey&album=I
n%20Search%20of%20Truth

Feel free to post a dummy message, nothing is live yet, all in test mode :)

you'll notice once the entry is submitted also, if you try to refresh the
page it wants to readd the data again. any help or guidance appreciated, I
am a self professed "still learning this stuff"! kinda guy.


Unable to connect to the " .
   "database server at this time." );
 exit();
  }

$sql = "INSERT INTO talkback (band_id, album_id,
talkback_name,talkback_email,talkback_comments) VALUES
('$currentid[0]','$currentid[1]','$talkback_name','$talkback_email','$talkba
ck_comments')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
  } else {

  // display form

?>

  ">
  Name/Nickname:

Email (optional):

Comments:



  


  


Deron
www.metalages.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Saving to a file

2001-06-20 Thread Warren Vail

Rosen,

Depends on where you want to save the file.

To get the manual http://www.php.net/docs.php.

To Save to a file on the machine running the browser;

make a form that outputs absolutely nothing except;

header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=filename.txt");
while(list($key,$val) = each($prod)) {  // the echo below sends the file
contents
$id = $val[0];  // data was loaded to array $prod as follows;
$nm = $val[1];  // $prod[] = array($productNo, $productDescr);
echo("$id,$nm\r\n");// use \r\n if going to windows browser \n if going to
unix
}

To Save a file to the server machine hosting your website;

use normal fopen, fputs, etc (see the manual)

good luck,

Warren Vail

-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 1:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Saving to a file


Hi,
Sorry for the stupid question, but i don't have at me a PHP manual
and I want to save some string to file from PHP.

Can someone tell me how ( with what function to do this ) ?

Thanks
Rosen







RE: [PHP] Code check please

2001-06-21 Thread Warren Vail

Andreas,

I'm not sure about code that appears to be missing like an execute query
function or checking the number of affected rows to make sure that the
insert worked, but clearly your insert code is not properly formed.  The
query could also be impacted by whether the columns are defined with special
attributes like DATE, etc.  Assuming that all columns are defined as
character strings the query should look like;

$sql = "INSERT INTO tabell (fornamn, efternamn, email) " .
"VALUES(\"$fornamn\", \"$efternamn\", \"$email\")";

I've found that I often have problems trying to use "single quotes" in sql
queries so I avoid them.  I notice that you also included a semi-colon in
the query text, while this works when piping a file of queries into the
mysql command, it does not work from a program.  The semi-colon in a command
stream into the mysql command actually signifies a point to stop and execute
the preceding text as a query and after executing that query, continue on
from the next character.

hope you got it working,

Warren Vail

-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 9:00 AM
To: PHP General
Subject: [PHP] Code check please


I've tried to get this working for over an hour
now, and it still won't. I don't even get an error
message to help me find the problem so I was
hoping that someone could check my code for me.

I'm fooling around with a basic form that is
supposed to send one's name, surname and e-mail
address to "receive.php". "receive.php" is then
supposed to take the information and add it to a
table called "tabell" in a database called
"databas", but it doesn't work. I think there
might be something wrong with my MySQL query.

- - - - - - - - - - - FORM - - - - - - - - - - - -
- -


Förnamn:

Efternamn:

E-mailadress:




- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

- - - - - - - - - - - RECEIVE.PHP - - - - - - - -
- - -

Unable to connect to the database
server at this time." );
exit();
}

//select database
if (! @mysql_select_db("databas") ) {
echo ("Unable to locate the database at
this time.");
exit();
}

// MySQL query
$sql = "INSERT INTO tabell SET" .
"fornamn ='$fornamn'," .
"efternamn='$efternamn'," .
"email='$email';";
?>

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

Thanks in advance!

// Andreas


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Code check please

2001-06-21 Thread Warren Vail

It just occurred to me that one thing that will kill a query is special
query characters imbedded in your strings, like quotes (single or double).
This can be resolved by the

$resultstring = addslashes($sourcestring);

this should escape special characters normally used to signal key components
to the mysql query processor.

of course when you select the column you need to run it thru;

$resultstring = stripslashes($dbcolumnvalue);

to get back your original value.

good luck,

Warren Vail

-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 3:46 PM
To: PHP General
Subject: Re: [PHP] Code check please


I'm sorry guys, neither of the snippets work. I must have screwed something
else up
too. Is there any way I can provoke an error message from your code examples
below?
If anyone manages to find out what's wrong, please tell me. I'm not giving
up until
I smash this bug :-)

// Andreas

> Rich Cavanaugh wrote:
>
> > try:
> >
> > $sql = "INSERT INTO tabell (fornamn, efternamn, email) values
('{$fornamn}',
> > '{$efternamn}', '{$email}')";
>
> Sebastian Wenleder wrote:
>
> > I'd use this SQL-query:
> >
> > $sql = "INSERT INTO tabell \
> > (fornamn,efternamn,email) \
> > VALUES(".$fornamn.", \
> > ".$efternamn.", ".$email.")";




--
Andreas Skarin
Svenska Dream Theater-Sällskapet
http://www.sdts.nu - mailto:[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] newbie algorithm help!!!!!

2001-06-23 Thread Warren Vail

You'll probably get as many approaches as replies.  How about the following;
after you have connected to mysql and selected the database;

$query  = "SELECT * FROM table";

$result = mysql_query ($query)
or die ("Query $query failed. The error message was
".mysql_error ());

// The following wipes out any trace of a memory table in the working $table
element
$table = '';
while ($rows = mysql_fetch_row ($result)) {
$table[] = $rows[0];// add the row to a working table
}
mysql_free_result($result)  // always do this as soon as you can

$top = sizeof($table);
$halfway = ceil($top/2);// round up if odd
$col2 = $halfway;
echo "";
for($col1 = 0; $col1 < $halfway; $col1++) {
echo "$table[$col1]";
if($col2 < $top) echo "$table[$col2++]";
else echo " ";   // this avoids that hole in your grid
}
echo "";



-Original Message-
From: Zak Greant [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 23, 2001 1:22 PM
To: McShen
Cc: Php-General
Subject: Re: [PHP] newbie algorithm help!


McShen wrote:
> > hi
> > i have a mysql table with approx. 30 entries.
> >
> > I wanna get them(i know how to do that) and list them in a 2-column
table.
> I
> > have been trying to use a loop to do it. But it will only produce a
> 1-column
> > table. it's like
> >
> > entry 1
> > entey 2
> > entry 3
> > entry 4
> > etc
> >
> > Please help me so that i can get this :
> >
> > entry1 entry2
> > entry3 entry4


The code is easier to understand than the explanation! :)

$query  = "SELECT * FROM table";

$result = mysql_query ($query)
or die ("Query $query failed. The error message was " .
mysql_error ());

// Initialize a value to stored the table rows
$table = '';

// Initialize a counter for the column number
$column = 0;

// Loop through the query results
while ($rows = mysql_fetch_row ($result)) {

// Put the contents of the field into a cell
$cell = "$rows[0]";

// If we are in column 0
if (0 == $column) {
// Start the row
$table .= "$cell";
} else {
// End the row
$table .= "$cell\n";
}

// Make the column number equal to
// The whole number remainder left over
// from dividing the value of $column
// plus one by two

$column = ($column + 1) % 2;
}

// Handle dangling rows
if (1 == $column) {
$table .= "\n";
}

echo "$table";


Good Luck!

--zak


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Telnet and PHP

2001-06-30 Thread Warren Vail

By "active user input", I would assume that you mean every time the user
makes a keystroke, the keystroke is sent to the host machine.  This is not a
characteristic of html which only sends information to the host machine when
some form of submit is clicked.  The advantage of the applet for this sort
of thing is it runs on the browser client, and has the capability of sending
every keystroke directly to the host, bypassing the server side.

On the server side, once the (PHP) application is done sending the requested
files to the web browser for one user, it moves on to handling the requests
for other users.  Can you imagine the load on a server if it had to reload
your application every time, your user pressed a key.

You never really made it clear where you expected this client to run,
although PHP, at this point, can only run on the server.  Now if you are
looking for something that your PHP code could use to 1. signon to a host
somewhere, 2. execute some commands, 3. capture and process the results and
4. disconnect before completing a single page to a web browser client (it
will probably never do "active user input", because of the nature of PHP and
the web server), then I would suggest you consider "rexec", "rcp", "rsh" or
if what you want is in a file on the host machine, you could use the ftp
functions.  These are not telnet, and do require special deamons running on
the host machine, but may do the trick.

I have been looking for your telnet client for a long time as well, and if
you find one, please remember to post it here, but I would suspect that one
of the problems in doing a telnet client in php is that the telnet client
needs to be multi-threaded.  Perhaps someone will someday take open source
like Dave's Telnet and fashion an extension to PHP.

Til then, try the options above,

Warren Vail


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 10:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Telnet and PHP


I was doing some research on creating a webbased telnet client and I am
unsatisfied with Java applets. I would like to create a server side telnet
client, so the user side is only required to have a working web browser that
supports HTML.

Thus, I turned to PHP. I found one example, but it does not allow for active
user input. While I will sit down this evening and work with the code, I was
wondering if anyone had/knew of a good example of a PHP telnet client.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] reading records alphebetically

2001-06-30 Thread Warren Vail

If you are planning to have a lot of records, you may want to create a
column with just that letter and index it, followed by the full name.

SELECT name from Table
WHERE first_letter = "$letter"
ORDER by name

should produce pretty fast results if "first_letter, name" is indexed.

Warren Vail

-Original Message-
From: Jamie Saunders [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 10:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] reading records alphebetically


Hi,

I have a MySQL database set-up containing a few hundred records.  I'm trying
to make a script that reads the 'name' field of the records and displays
only the records of which the name field begins with a specific letter:

if ($letter = A) {
display all records of which field 'name' beings with A
} else if ($letter = B) {
...

I'm just starting out on this, so please excuse my ignorance :)

Jamie Saunders
[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Telnet and PHP

2001-07-01 Thread Warren Vail

Jon,

Looked like a nice solution, but couldn't get the code to work.  Kept going
into an endless loop or wait state somewhere.

still forced to use rexec.

Warren Vail

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 11:06 AM
To: Warren Vail
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Telnet and PHP


Instead of performing a send for each stroke, the user code type in a whole
string in a text box, and then submit that string. I have found this code at
http://www.phpbuilder.com/mail/php-general/2001051/1479.php:

sock = fsockopen($host,$port);
socket_set_timeout($this->sock,2,0);
}


function close() {
if ($this->sock)
fclose($this->sock);
$this->sock = NULL;
}


function write($buffer) {
$buffer = str_replace(chr(255),chr(255).chr(255),$buffer);
fwrite($this->sock,$buffer);
}


function getc() {
return fgetc($this->sock);
}


function read_till($what) {
$buf = '';
while (1) {
$IAC = chr(255);


$DONT = chr(254);
$DO = chr(253);


$WONT = chr(252);
$WILL = chr(251);


$theNULL = chr(0);


$c = $this->getc();


if ($c === false)
  return $buf;


if ($c == $theNULL) {
continue;
}


if ($c == "\021") {
continue;
}


if ($c != $IAC) {
$buf .= $c;


if ($what ==
(substr($buf,strlen($buf)-strlen($what {
return $buf;
} else {
continue;
}
}


$c = $this->getc();


if ($c == $IAC) {
$buf .= $c;
} else if (($c == $DO) || ($c == $DONT)) {
$opt = $this->getc();
// echo "we wont ".ord($opt)."\n";
fwrite($this->sock,$IAC.$WONT.$opt);
} elseif (($c == $WILL) || ($c == $WONT)) {
$opt = $this->getc();
// echo "we dont ".ord($opt)."\n";
fwrite($this->sock,$IAC.$DONT.$opt);
} else {
// echo "where are we? c=".ord($c)."\n";
}
}


}
}


$tn = new telnet("192.168.255.100",23);
echo $tn->read_till("ogin: ");
$tn->write("admin\r\n");
echo $tn->read_till("word: ");
$tn->write("thieso\r\n");
echo $tn->read_till(":> ");
$tn->write("ps\r\n");
echo $tn->read_till(":> ");
echo $tn->close();
?>





- Original Message -
From: "Warren Vail" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, June 30, 2001 2:01 PM
Subject: RE: [PHP] Telnet and PHP


> By "active user input", I would assume that you mean every time the user
> makes a keystroke, the keystroke is sent to the host machine.  This is not
a
> characteristic of html which only sends information to the host machine
when
> some form of submit is clicked.  The advantage of the applet for this sort
> of thing is it runs on the browser client, and has the capability of
sending
> every keystroke directly to the host, bypassing the server side.
>
> On the server side, once the (PHP) application is done sending the
requested
> files to the web browser for one user, it moves on to handling the
requests
> for other users.  Can you imagine the load on a server if it had to reload
> your application every time, your user pressed a key.
>
> You never really made it clear where you expected this client to run,
> although PHP, at this point, can only run on the server.  Now if you are
> looking for something that your PHP code could use to 1. signon to a host
> somewhere, 2. execute some commands, 3. capture and process the results
and
> 4. disconnect before completing a single page to a web browser client (it
> will probably never do "active user input", because of the nature of PHP
and
> the web server), then I would suggest you consider "rexec", "rcp", "rsh"
or

RE: [PHP] Can any one spot the Parse error Here

2001-07-02 Thread Warren Vail

I use indentation to check out the form; missing brace at end?  Check it
out.


 
  User : 
  Password : 
  
 

 Post News
 Edit News
 Delete News
 Add User Account
 Delete User

   
   
   
   Username : 
   Password : 
   

".$userline[0]."";
}
break;
case "post":
?>
   
   
   
   Title : 
   
   
   
read()) {
if(is_file("./news/".$file)) {
$name = str_replace(".txt", "", $file);
echo "".$name."";
}
}
$dir->close();
break;
case "delete":
$dir = dir("./news");
while($file=$dir->read()) {
if(is_file("./news/".$file)) {
$name = str_replace(".txt", "", $file);
echo "".$name."";
}
}
$dir->close();
break;
case "process":
switch($process) {
case "adduser":
$fp = fopen($usersfile, "w");
for($i = 0; $i < sizeof($userslist); $i++)
fwrite($fp, $userslist[$i]);
fwrite($fp, "\r\n".$uname."||".$pword);
fclose($fp);
echo "User Added!";
break;
case "deluser":
$fp = fopen($usersfile, "w");
for($i = 0; $i < sizeof($userslist); $i++) {
$userdetails = explode("||", $userslist[$i]);
if($userdetails[0] != $uname)
fwrite($fp, $userslist[$i]);
}
fclose($fp);
echo "User Deleted!";
break;
case "post":
$fp = fopen("./news".$title.".txt", "w");
fwrite($fp, $title."\r\n");
fwrite($fp, $text);
echo "News Posted!";
break;
case "view":
$newsdata = file("./news/".$news);
$title = rtrim($newsdata[0]);
echo "Title: ".$title.""
?>
   
   



   



   

   
  

  
 Are you Sure?
   
   
   
   
   


-Original Message-
From: scott [gts] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 10:38 AM
To: php
Subject: RE: [PHP] Can any one spot the Parse error Here


confucious say:

typing it up in 20 minutes and then spending 2 hours
debugging is much worse than taking an hour to type it
up and spending only 20 minutes debugging ;)

> -Original Message-
> From: ReDucTor [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 02, 2001 3:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Can any one spot the Parse error Here
>
>
> Only typed it up in like 20 min, i normaly do that after :)
> - Original Message -
> From: Andrew Halliday <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 02, 2001 5:26 PM
> Subject: Re: [PHP] Can any one spot the Parse error Here
>
>
> > Brace count mismatch.
> > You are missing a '}'.
> > God knows where it is...inconsistent spacing and code too lengthy.
> > Functionise/objectise your code!
> >
> > AndrewH
> >
> > - Original Message -
> > From: "ReDucTor" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, July 02, 2001 4:17 PM
> > Subject: [PHP] Can any one spot the Parse error Here
> >
> >
> > > Hey,
> > > Right at the end i get a prase error, which i figure i have missed
a
> > > break; or a }
> > > but i just can't seem to find it, can some one look thro it, tell me
if
> > they
> > > spot it?
> > >
> > > My Code:
> > > 
> > >  > >$usersfile = "users.php";
> > >session_start();
> > >session_register("user","pass");
> > >if(isset($user))
> > >$username = $user;
> > >if(isset($pass))
> > >$password = $pass;
> > >if(!$username)
> > >{
> > > ?>
> > > 
> > >  User : 
> > >  Password : 
> > >  
> > > 
> > >  > >}
> > >else
> > >{
> > > $user = $username;
> > > $pass = $password;
> > > $userslist = file($usersfile);
> > > for($i = 1; $i < sizeof($userslist); $i++)
> > > {
> > >  $userline = explode("||", $userslist[$i]);
> > >  if($usersline[0] == $username)
> > >  {
> > >   if($password != rtrim($usersline[1]))
> > >   {
> > >die("Incorrect Username");
> >

RE: [PHP] What the heck is this

2001-07-10 Thread Warren Vail

When all else fails, check the mainual;

http://www.php.net/manual/en/language.oop.php

appears to be an instance reference (not sure that is the term).

Warren Vail

-Original Message-
From: Adam [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 11:35 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] What the heck is this


I've done quite a bit of php coding in the past few months but never had the
need to use this and therefore never learned anything about it. It's hard to
ask about it because i have NO idea what it is at all. Is it to give
spanning values? I was woundering if anyone knew specifically what it did.

-Adam



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] File Download Mouse Behavior

2001-07-11 Thread Warren Vail


When using PHP to generate a download file, the PHP program generates the
headers and the actual text content of the file and this all works just
fine.  However, after the file download is complete, positioning the mouse
anywhere over the browser (still showing the previous page) it appears as an
hour glass, even though the mouse is active and still allows further clicks
on the page.

Has anyone come up with a method of cleaning up this behavior?

Browser is IE on NT.

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] File Download IE behavior

2001-07-11 Thread Warren Vail


When generating a download file from PHP to IE (Netscape is not used by my
client base) the browser prompts with an option to download the file or open
the file where it is.  Opening the file fails and I am forced to download
the file to my local drive before receiving another prompt to open the file
where the second Open works just fine.

Is there a way to allow this first open to work, or cause the open option on
the first download window to be removed?

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] NT Authentication

2001-07-18 Thread Warren Vail

I am running php4/mysql/apache in a large NT complex, behind a firewall.
How can I authenticate users to my site using NT authentication?  Has anyone
done this?

thanks,

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] can't get gd working at all

2001-07-25 Thread Warren Vail

If the gd extension is not loaded each time php is loaded you will need to
cause it to be loaded from your script.

http://www.php.net/manual/en/function.dl.php

I keep my extensions in a separate directory, off the php root directory, so
to load my gd I use the following;

dl("extensions/php_gd.dll");

good luck.

Warren Vail

-Original Message-
From:   Matt Greer [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, July 25, 2001 6:55 AM
To: php-gen
Subject:[PHP] can't get gd working at all

I'm trying to get a simple piece of code involving gd functions to work just
to ensure gd is working properly on my server. I took this straight from my
book. All that comes up is a broken image. I talked with my host and they
assured me gd is installed and working properly on the server. Any ideas?

Here's what I'm trying to do:



This is from chapter 16 of Beginning PHP4 from Wrox press.

Thanks,
Matt


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] search array for value

2001-07-30 Thread Warren Vail

How about;

$valuelist = explode(", ", $array);
$query = "select * from table where column in ($valuelist)";
etc.

Warren Vail 

-Original Message-
From:   Matthew Delmarter [mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 9:41 PM
To: PHP Mailing List
Subject:[PHP] search array for value

How do I search an array? 

For example if I want to know if $array contains "1"...

Regards,

Matthew Delmarter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] search array for value

2001-07-30 Thread Warren Vail

Sorry, mixed this up with your other query;

For this

If(in_array(1, $array))  {
}

Warren Vail

-Original Message-
From:   Warren Vail [mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 9:57 PM
To: Matthew Delmarter; PHP Mailing List
Subject:RE: [PHP] search array for value

How about;

$valuelist = explode(", ", $array);
$query = "select * from table where column in ($valuelist)";
etc.

Warren Vail 

-Original Message-
From:   Matthew Delmarter [mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 9:41 PM
To: PHP Mailing List
Subject:[PHP] search array for value

How do I search an array? 

For example if I want to know if $array contains "1"...

Regards,

Matthew Delmarter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: storing array in mysql

2001-07-31 Thread Warren Vail

What I have used to store an array in mysql is;

$value = addslashes(serialize($array));
$query = "INSERT INTO table (column) VALUES (\"$value\")"

and upon retrieval
$query = "SELECT column FROM table";
..
while($row = mysql_fetch_array($result)) {
$value = unserialize(stripslashes($row["column"]));
}

Note: serialize allows me to store the array in a single column and
addslashes makes the data mysql safe (i.e. allows me to store quotes in the
column, just in case they are in the array).

Warren Vail

-Original Message-
From:   elias [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, July 31, 2001 4:05 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Re: storing array in mysql

when you submit this form, PHP will give a array variable called $name

you can store in in MySql as:



now to reget the array, you can select it back from MySql and split it as:


//elias
"Matthew Delmarter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> I want to store the results of a multiple select input box in a mysql
> db. The box looks like this:
> 
> name
> 
>
> I cannot seem to store the array in a database and then output the
> result using foreach. Any tips?
>
> Regards,
>
> Matthew Delmarter
> Web Developer
>
> AdplusOnline.com Ltd
> www.adplusonline.com
>
> Phone: 06 8357684
> Cell: 025 2303630
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: storing array in mysql

2001-07-31 Thread Warren Vail

I never seem to be lucky enough to be sure of the type of data stored in a
php array, since php handles mixtures of types so forgivingly, and because
most of my data comes from forms, with users key in what they like,
including double and single quotes, parentheses (and especially commas, how
do you prevent breaking up your array and putting it back together with a
different row count because someone keyed in a comma?), etc.  I would think
you would have to go to a lot of trouble to make sure that an array contains
only numeric data, or only strings that did not contain problem causing
characters.

You are right about more space being required for serialize, I often have to
resort to TEXT data types to provide enough space in the column for data
(65k runs out fast), and that is a bit slower as well.

Warren

-Original Message-
From:   elias [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, July 31, 2001 8:09 AM
To: [EMAIL PROTECTED]
Subject:Re: [PHP] Re: storing array in mysql

Yes true, you can use serialize.

But since you know the format of your $array variable (which is simply
holding one data type) you can safely use split() and join()
better and smaller when stored in that field because they are comma
seperated.

"Warren Vail" <[EMAIL PROTECTED]> wrote in message
001701c119c8$562b0ca0$b5887ed8@nicker">news:001701c119c8$562b0ca0$b5887ed8@nicker...
> What I have used to store an array in mysql is;
>
> $value = addslashes(serialize($array));
> $query = "INSERT INTO table (column) VALUES (\"$value\")"
>
> and upon retrieval
> $query = "SELECT column FROM table";
> .
> while($row = mysql_fetch_array($result)) {
> $value = unserialize(stripslashes($row["column"]));
> }
>
> Note: serialize allows me to store the array in a single column and
> addslashes makes the data mysql safe (i.e. allows me to store quotes in
the
> column, just in case they are in the array).
>
> Warren Vail
>
> -Original Message-
> From: elias [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 31, 2001 4:05 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: storing array in mysql
>
> when you submit this form, PHP will give a array variable called $name
>
> you can store in in MySql as:
>
>  // will make the $name as a comma seperated string
> $str = join(",", $name);
> insert into tablename(id, value) VALUES(null, '$str');
> ?>
>
> now to reget the array, you can select it back from MySql and split it as:
>$name = split(",", $str);
> ?>
>
> //elias
> "Matthew Delmarter" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi all,
> >
> > I want to store the results of a multiple select input box in a mysql
> > db. The box looks like this:
> > 
> > name
> > 
> >
> > I cannot seem to store the array in a database and then output the
> > result using foreach. Any tips?
> >
> > Regards,
> >
> > Matthew Delmarter
> > Web Developer
> >
> > AdplusOnline.com Ltd
> > www.adplusonline.com
> >
> > Phone: 06 8357684
> > Cell: 025 2303630
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-14 Thread Warren Vail

The ability to select a set from a previously selected set is possible in
Sybase because the database supports creation of temporary tables and the
select insert.

PHP (which is often packaged with MySQL) does not attempt to mix database
(SQL) with it's own scripting language (unless someone is working on this).
ASP on the other hand will sell you anything that consumes resources thereby
encouraging you to buy the bigger software, requiring bigger hardware (An
old IBM marketing plan, and my personal opinion).  When you talk about a
result set in PHP you must be referring to what is returned by MySQL, not
PHP.  Perhaps someday MySQL will have temp tables and SELECT INSERT
capability.

On the other had PHP does a very nice job of looping thru the result set.

Warren Vail

-Original Message-
From:   Herouth Maoz [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, August 14, 2001 11:35 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Problem: Sybase, PHP and multiple result sets

I have started working with Sybase lately, and it has come to my
knowledge that a single query can return multiple result sets in
Sybase, especially when using stored procedures.

Now, in ASP (sorry...), there are calls that allow retrieving the
next result set from the current result set. So in effect the result
sets are a linked list and you can access all of them.

In PHP, however, the result set returned is the first one, and I
don't see any method for retrieving the next result set. Does anybody
know of such a method? Does anybody have a suggestion for workaround?

Basically, in most of these cases, the important result set is
actually the last one, not the first, as the intermediate result sets
are mostly temporary results.

Herouth


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-16 Thread Warren Vail

I appreciate the clearer, more detailed description.  Unfortunately, I
probably cannot help as much with this one.  If it were my problem, I would
try finding and downloading the source for the Sybase modules, then look for
someone to contact in the notes.  I would also exhaust any contacts I have
with Sybase, mostly because much of the original code for the interface
modules probably came from them originally (derived from their old C
interface modules).

Another approach would be to try to unload the source for the Stored
Procedure, and try to split up the queries (I believe the results you are
seeing are produced by a UNION, but I'm not certain).  Sybase can compile
its query procedures on the fly, with only slightly longer run times, or you
could create a new procedure from what you find and store that one.

Good Luck,

Warren Vail

-Original Message-
From:   Herouth Maoz [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, August 15, 2001 12:19 AM
To: Warren Vail; [EMAIL PROTECTED]
Subject:Re: [PHP] Problem: Sybase, PHP and multiple result sets

On Wednesday 15 August 2001 10:07, Warren Vail wrote:
> The ability to select a set from a previously selected set is
> possible in Sybase because the database supports creation of
> temporary tables and the select insert.

No, you seem to have missed my point entirely. So I'll explain in a
little more detail.

I run a stored procedure. Let's assume I run it from the interactive
utility and not from PHP for the moment.

> SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3

The database returns:

foo   bar
===   ===
1020
3040

field1   field2   field3
==   ==   ==
string   bla  15
nothing  bla  12

As you can see, it returns TWO result sets. One with two numeric
columns. The next with three columns, the first two string and the
last numeric.

This is, of course, just an example.

Now back to the web interface.

If I use PHP, I get only the first result set. That is, I write
something along the lines of:

$rs = sybase_query( "SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3",
$conn );

while ( $row = sybase_fetch_row( $rs ) ) {

   echo $row[0]; // and so on

}

This will only display the results of the first result set - the one
with the two fields, foo and bar.

There is no way for me to reach the second table generated by the
query. This is supposed to be the significant table.

Now, in ASP, there is something like

set rs = rs.NextResultSet

Which sets the rs to the second result set, the one with the three
fields of mixed types, at which point you loop, just like above, and
retrieve the new information. This method or an equivalent of it is
not in the PHP documented set of Sybase functions.

I hope I made myself clearer. And by the way, you don't have to sell
me on the uselessness of ASP, the general uselessness of Microsoft
etc. - I don't use any Microsoft products, even at work.

Herouth


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Dissapearing Session Variables (long post)

2001-09-05 Thread Warren Vail

Jason,

I had a similar problem using a php session table in MySQL to store session
data, turns out my  data item was too small to contain all my registered
session variables, I changed the definition of the data column to TEXT and
that seemed to do it.  I also found that I needed to run addslashes() before
updating the column and stripslashes() retrieving it (turns out some of my
variables contained characters that MySQL was sensitive to, and others that
caused serialize/unserialize problems).

Not sure this is your problem, but it's worth checking.

Warren Vail

-Original Message-
From:   Jason Bell [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, September 05, 2001 4:54 PM
To: PHP Users
Subject:[PHP] Dissapearing Session Variables (long post)

Hello! I'm trying to figure out why my session variables keep hiding

Background:

On my site, I have a login box, which allows you to login. This login box
works as expected. It authenticates the provided credentials against my
database, and then sets some pre-registered session variables to values
pulled from the DB. What I am experiencing, is that my session variables
will be defined, and then lose their values when the first link is followed.
I've placed a reference to $PHPSESSID into the title of the page, and note
that the $PHPSESSID remains constant. Is there something in my code that is
causing this? Is there a way that I can rewrite my code to help avoid this?

Here is my index.php, other relevent code to follow:

Login Incorrect!";
  };
};
   break;
  case logout:
   break;
 }
};
if (!$action) { $action = tba; };
if (!$title) { $title = "$PHPSESSID"; };
if (!$headline) { $headline = "An E-Haven for Displaced
Northpointers"; };
include("Themes/".$theme."/".$theme.".theme");
?>

Here is user.conf:




Shouldn't this work?  I reference the session variables within functions,
but that shouldn't effect anything. I always make sure to call global for
each variable before I use itany ideas?

Thanks in advance!

Jason Bell


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] thumbnail of webpage

2004-09-21 Thread Warren Vail
I may have found something, a perl script that with all the appropriate
pieces turns a page into a jpg image.

http://marginalhacks.com/Hacks/html2jpg/

from there resizing using GD is a snap.

Warren Vail

-Original Message-
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:48 PM
To: 'Jason Davidson'; Michael Mao; [EMAIL PROTECTED]
Subject: RE: [PHP] thumbnail of webpage

I have been looking into this over the last week and have come up blank as
well.  Doing this manually is simple, point your browser to your URL, and in
windows use  to copy an image of the rendering in the
browser to the scratch-pad, then paste the image into a tool like paint to
cut out the part of the image you want, and use the skew/stretch tool in
paint to create the thumbnail (GD is a good solution as well) saving the
file as a jpg image.

The difficulties with php is that opening the URL with fopen or using CURL
allows getting the content of a page in html form, but provides no bitmap
rendering of all that, let alone allowing JavaScript to alter the
presentation as it would in a browser.

What would be useful, if there were a way to open the URL in an IFRAME, and
with JavaScript somehow capture a bitmap of the rendering of the web page,
perhaps encoding the bitmap as mod64 characters and placing the result in a
textarea for posting as input to a php script.  This was the best solution
that I could come up with but I don't have the skills to make this happen,
yet.  Question for anyone here, is does this sound like a path that might
work?  Can JavaScript access the rendered content of a webpage in window
bitmap form?

In my travels, someone had suggested coding something using mozilla and
invoking it from a php script, but no one has done this yet that I can
determine.

Warren Vail


-Original Message-
From: Jason Davidson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:08 PM
To: Michael Mao; [EMAIL PROTECTED]
Subject: Re: [PHP] thumbnail of webpage


First, im not sure how you would capture a snapshot of the page, sinse the
page is rendered by the browser, and php is completely server side.
Possibly there is a way to fopen a page or something, but... i dunno..

as for making thumbnail, using the gd extension, is quite easy. check the
manual for GD.

Jason


"Michael Mao" <[EMAIL PROTECTED]> wrote:
>
> Is there a way to capture a snapshot of a html page and save it as a
> jpg
> using php?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

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

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



RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-11 Thread Warren Vail
If it throws out garbage, you should be able to execute the "who" command on
the remote system, which should show users that are currently signed on to a
Unix or Linux system and if you do it all in the perl script, you can format
the output to look pretty much the same (in case you haven't figured it out
the @users_list is an array, very similar to PHP arrays actually [IMHO]).
If you modified the perl script to detect the garbage, it could simply do a
telnet connection and execute the "who" command.  There are probably ways
that use privileged commands similar to the one used for your windows
solution on remote Linux Unix, but I don't know them, and I'm not sure it's
a good idea to use them in a PHP script, but you can get opinions the other
way as well.  If all your machines are behind the same firewall, away from
the internet, the risk could be less if you have a good firewall.  For your
telnet connection from perl look for the net:telnet perl module at
http://www.cpan.org/modules/by-module/Net/ , if you know PHP you will find
perl quite easy I think.

Good luck.

Warren Vail

-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 9:54 PM
To: Vail, Warren; Mulley, Nikhil; [EMAIL PROTECTED]
Subject: RE: [PHP] Is there any way of knowing User Currently Logged On?

Hi Vail,

My Worry is that If a remote OS is not Windows, then this would throw out
garbage,
Where as this Perl Script would work well at a Windows Side ,Bcoz I am using
the 'Win32'  Module ,is there any other module such that .
We cannot even predict ( or I believe there is no exact way ) what the
remote OS could be :(



Nikhil.

-Original Message-
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 11:33 PM
To: 'Mulley, Nikhil'; [EMAIL PROTECTED]
Subject: RE: [PHP] Is there any way of knowing User Currently Logged On?


If you code in php something like the following, you just might be able to
use the perl script;

$ok = exec("path/to/Perl myperscriptname.pl server", $result);   // you may
have to straighten out syntax
Foreach($result as $line) {
echo $line;   // or you could process the results
}

Hope this helps,

Warren Vail


-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 9:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Is there any way of knowing User Currently Logged On?


Hi Guys,

Is there any way of finding the current user logged on the remote system

I have a perl script which gets the user name who is currently logged on a
remote Windows Machine





#LoggedOnUsers(server, userRef).pl
use Win32::NetAdmin;
use strict;
use vars qw($server @users_list);
if(@ARGV>0){
$server=$ARGV[0];
}
else{
print "\n\nEnter a valid Hostname  or IP Address : ";
chomp($server=); }
Win32::NetAdmin::LoggedOnUsers($server,[EMAIL PROTECTED]);
foreach(@users_list) {
print "\n$server-- $_";
}


This one gets the users logged in on a remote Windows machine , Is there a
similar way of finding / doing the same regardless of an OS, Can it be done
through a Web Browser 

Any Clues ??

--Nikhil.

--
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] Best and easy html text area replacement tool?

2004-10-04 Thread Warren Vail
I guess I have no patience with the "topic police" since it's difficult to
develop a good PHP "user interface" without the use of JavaScript, and I
consider anything that involves getting the most out of PHP "on topic", but
since I'm in charge of absolutely nothing, all I can do is provide a little
information.

I've actually used a couple of these JavaScript add-on's and like the
structure and reliability of HTMLAREA.

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

It provides a nice plug-in interface that other developers have used to make
JavaScript extensions available that includes;
* Image Upload Manager
* Spell Checking (On a Unix/Linux host)
* Enhanced Table Formatting
* Multiple Language Capability (haven't look too close at this one)
* Even something for Audio (haven't looked at this, either)
* And probably some that I haven't mentioned (doing this from memory).

And the price is the same as PHP (free).

Good luck,

Warren Vail

-Original Message-
From: Bosky, Dave [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 1:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Best and easy html text area replacement tool?

I'm looking for an easy to use html textarea replacement script and figured
this was the place to locate the most popular.



Thanks,

Dave









HTC Disclaimer:  The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error, please notify us immediately by replying to the
message and deleting it from your computer.  Thank you.

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



RE: [PHP] Help needed Postgresql and PHP

2004-10-05 Thread Warren Vail
Extracting name and addresses from postgres as a comma separated values
"CSV" file should be doable with postgress utilities or scripts.  Assuming
you have access to a word processor like Microsoft Word, that has a "Mail
Merge" capability, where your letter can be merged and printed with names
and addresses from your CSV file.

Factors affecting the wisdom of this approach are;
* The volume of letters you expect to print and the printers you expect to
use (bubble jet ink cartridges are expensive).
* If name and address are the only substitutions in the letter.  Greetings,
additional content may require more that a CSV solution.
* Special bulk mail requirements like zip code sort and selections should be
doable in postgres.
* For really large volumes you will need to break down the workload for
multiple printers in a fashion that makes sense.

If you want to reinvent the wheel by developing your own mail merge process,
I would recommend against it, unless there is some significant gain by doing
that.  I'm guessing that your have already considered this, but are looking
for some other solution for some reason that is not apparent to me.

Good Luck,

Warren Vail


-Original Message-
From: suma parakala [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 11:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help needed Postgresql and PHP

Hi
I am developing an application using php and postgresql . My problem is I
need to retrieve name and addresses from table(postgres sql table)  and
print letter (body of letter will be same). Kindly help /Suggest how i can
do this
Thanks
Suma

_
Looking for a soulmate?  http://www.shaadi.com/ptnr.php?ptnr=hmltag Log onto
Shaadi.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



RE: [PHP] Am I being hacked?

2009-04-08 Thread Warren Vail
Looks like an attempt to get your SQL server to execute a command, Microsoft
SQL server will do that(among others), and if not properly set up can do it
with root access.  If you don't properly escape and store this comment in a
database, it could execute (called SQL injection, no?).

Warren Vail

> -Original Message-
> From: Yannick Mortier [mailto:mvmort...@googlemail.com] 
> Sent: Wednesday, April 08, 2009 8:07 AM
> To: 9el
> Cc: Bob McConnell; Richard Heyes; julian haffegee; PHP Mailing List
> Subject: Re: [PHP] Am I being hacked?
> 
> 2009/4/8 9el :
> > On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell  wrote:
> >
> >> On Behalf Of Richard Heyes
> >> >> I set up a simple form to save comments on my webpage, 
> and after 
> >> >> just
> >> one
> >> >> day of going live, i'm getting weird comments up like this
> >> >>
> >> >> declare @q varchar(8000) select @q =
> >> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
> >> >>
> >> >>
> >> >> I don't recognise this code - is this an attempt to do something
> >> nefarious,
> >> >> or nothing I should worry about?
> >> >
> >> > Looks like it may be. As long as you escape you SQL 
> correctly using
> >> > mysql_real_escape_string() or the equivalent, you should be OK.
> >>
> >> Let me see if I got this right. The data you got from the 
> form tries 
> >> to set up a local variable, assigns it a hex string as a 
> value, then 
> >> tries to execute it. That definitely looks like an attempt 
> to crack 
> >> your server. It looks like the semi-colons were removed 
> somewhere, so 
> >> none of it actually runs. But you would probably need a set of 
> >> dis-assemblers to find out what CPU that code was written 
> for and what it actually does.
> >>
> >> Next question: You said there are multiple comments like 
> this. How do 
> >> they differ, if they do? Possibly they are trying code for 
> different 
> >> CPUs.
> >>
> >> Did you trace these back to the logs to see if they all 
> come from one 
> >> IP or subnet? Is there anywhere to report these attempts 
> that would 
> >> actually do any good, or should you just ban that IP.
> >>
> >> But this one goes into my journal as something to be prepared for.
> >>
> >> I think the danger these codes have should be discussed 
> well. And how 
> >> to
> > resist such attacks in your server and apps should also be 
> discussed 
> > in greater depth.
> >
> > regards
> >
> > Lenin
> >
> > www.twitter.com/nine_L
> >
> 
> 
> I just googled for that string. Seems like you are not the 
> only victim. Sadly, I can't give you any more advice.
> 
> 
> --
> Currently developing a browsergame...
> http://www.p-game.de
> Trade - Expand - Fight
> 
> Follow me on twitter!
> http://twitter.com/moortier
> 
> --
> 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 Error

2009-04-21 Thread Warren Vail
Isn't mail a function and not a class?

Warren 

> -Original Message-
> From: ramesh.marimu...@wipro.com [mailto:ramesh.marimu...@wipro.com] 
> Sent: Tuesday, April 21, 2009 12:29 AM
> To: php-general@lists.php.net
> Subject: [PHP] MAIL Error
> 
> Hi All,
> 
> While using $m=new MAIL; I get an error "Fatal error: Class 
> 'MAIL' not found in...".
> 
> Can anyone help on this?
> 
> regards,
> -ramesh
> 
> P Save a tree...please don't print this e-mail unless you 
> really need to
> 
> 
> Please do not print this email unless it is absolutely necessary. 
> 
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive 
> use of the addressee(s) and may contain proprietary, 
> confidential or privileged information. If you are not the 
> intended recipient, you should not disseminate, distribute or 
> copy this e-mail. Please notify the sender immediately and 
> destroy all copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The 
> recipient should check this email and any attachments for the 
> presence of viruses. The company accepts no liability for any 
> damage caused by any virus transmitted by this email. 
> 
> www.wipro.com
> 


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



RE: [PHP] Formating Numbers

2009-04-25 Thread Warren Vail
As an alternative you might consider;

$number = sprintf("%01.2f",$number);  

There was a time many years ago you had to be careful doing math with
floats. Test, test and test some more.

Warren 

> -Original Message-
> From: kranthi [mailto:kranthi...@gmail.com] 
> Sent: Saturday, April 25, 2009 8:38 PM
> To: Gary
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Formating Numbers
> 
> pl post the desired result, the functions
> 
> if u r trying to get $ 34,567.25
> i dont understand y this is not working for u...
> http://php.net/manual/en/function.number-format.php#88486
> 
> --
> 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] Re: A form and an array

2009-07-23 Thread Warren Vail
Did you correct the missing double quote in your sending form first?

Warren Vail

-Original Message-
From: Jason Carson [mailto:ja...@jasoncarson.ca] 
Sent: Thursday, July 23, 2009 9:33 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: A form and an array

> Jason Carson wrote:
>
>>> Jason Carson wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> Lets say I have a file called form.php with the following form on it
>>>> that
>>>> redirects to index.php when submitted. I would like to take the values
>>>> of
>>>> the text fields in the form and put them into an array, then be able
>>>> to
>>>> display the values in that array on index.php Does anyone know how I
>>>> would
>>>> do that?
>>>>
>>>> Here is my form...
>>>>
>>>> 
>>>> 
>>>>   
>>>> Option1
>>>> 
>>>>   
>>>>   
>>>> Option2
>>>> 
>>>>   
>>>>   
>>>> 
>>>> 
>>>>   
>>>> 
>>>> 
>>>
>>> You'll find they are already in an array which you can access as
>>> $_POST['option'] - from there foreach() should be the next step.
>>>
>>>
>>> Cheers
>>> --
>>> David Robley
>>>
>>> Polls show that 9 out of 6 schizophrenics agree.
>>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> I am new to programming. How would I use foreach()to display the entries
>> in the array?
>
> You could read TFM which has an example -
> http://php.net/manual/en/control-structures.foreach.php
>
>
> Cheers
> --
> David Robley
>
> Why are you wasting time reading taglines?
> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What I currently have is...

foreach ($_POST['option'] as $value) {
echo "Value: $value\n";
}

...but that doesn't work. TFM didn't help me :-(


-- 
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] What if this code is right ? It worked perfectly for years!!

2009-08-24 Thread Warren Vail

You are absolutely right, more information is needed.  Many ISP's are
changing port number assignments on their SMTP outgoing email to prevent
abuse.  A simple change like that could cause the email to not go out, and
it has nothing to do with PHP.

Warren Vail
Vail Systems Technology
-Original Message-
From: Lars Torben Wilson [mailto:larstor...@gmail.com] 
Sent: Monday, August 24, 2009 9:21 AM
To: Chris Carter
Cc: php-general@lists.php.net
Subject: Re: [PHP] What if this code is right ? It worked perfectly for
years!!

2009/8/24 Chris Carter :
>
> Hi,
>
> The code below actually takes input from a web form and sends the fields
> captured in an email. It used to work quite well since past few years. It
> has stopped now. I used Google's mail servers (google.com/a/website.com)
>
>   $fName = $_REQUEST['fName'] ;
>  $emailid = $_REQUEST['emailid'] ;
>    $number = $_REQUEST['number'] ;
>  $message = $_REQUEST['message'] ;
>
>  mail( "ch...@gmail.com", $number, $message, "From: $emailid" );
>  header( "Location: http://www.thankyou.com/thankYouContact.php"; );
> ?>
>
> This is the simplest one, how could it simply stop? Any help would be
> appreciated, I have already lost 148 queries that came through this form.
>
> Thanks in advance,
>
> Chris

Hi Chris,

More information would be very helpful. In exactly what way is it
failing? Blank page? Apparently normal operation, except the email
isn't being sent? Error messages? Log messages? etc. . .

One possibility is that the server config has changed to no longer
allow short open tags. This is easy to check for by simply replacing
'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] Exclusive File Access

2009-08-26 Thread Warren Vail
I have two processes running on the same server, one is creating a file,
loading it with data, and this process runs real slow.

 

The second process processes a directory, finds the new file and begins
reading the file contents.

 

How do I make the reading process detect that the file is still being filled
with data in PHP?

 

Warren Vail

Vail Systems Technology

 



RE: [PHP] Text Editor for Windows?

2007-02-07 Thread Warren Vail
I've Been using htmlkit for quite a few years now.  I don't like it
correcting my text on the fly (interrupts my train of thought), but it will
highlight in color what type of text it thinks it is.  For example when I
start typing in a function name, it will change the color when what I have
typed matches a standard function.  This feature also works pretty well for
letting me know when I'm inside a string value and forgot to escape an
imbedded quote, the color is wrong.  And the price is right.

Try;

http://www.chami.com/html-kit/download/

good luck,

Warren Vail

-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 07, 2007 5:49 PM
To: php-general@lists.php.net
Subject: [PHP] Text Editor for Windows?

I am finding that notepad is lacking when correcting syntax errors in my php
code. No line numbers.

What can people recommend for use under Windows?

Thanks
Stephen

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



RE: [PHP] Job Opportunity

2007-03-21 Thread Warren Vail
Too bad we have to constrain our messages to fit the threading algorithm of
your list server.  Another case of where man becomes servant to the machine?
8-)

Warren Vail

-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 11:57 AM
To: Chris Ditty
Cc: php-general@lists.php.net
Subject: Re: [PHP] Job Opportunity

Sorry, replied to the wrong post...

well, I hate to correct you, but I think you need to be checking those 
headers.

here is a snapshot of my threaded view

http://www.cmsws.com/images/threads.jpg

With the re-written subject line, it didn't add Re:  to it, but it was a 
reply to another thread


Chris Ditty wrote:
> Hate to be a PITA, but going back 2 years, I only see Efrain posting 3
> times.  Each time he created a new thread.
> 
> On 3/21/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
>> you have done this a few different times over the past few weeks, it is
>> really annoying!!!
>>
>> for that matter, it is annoying for anybody to hi-jack a thread and
>> start something new with it.
>>
>> Just start your own/new thread...  PLEASE
>>
>>
>> Efrain Sarmiento wrote:
>> > I need people
>> > Willing to pay referral fees...
>> >
>> > LAMP Developer (Linux, Apache, MySQL, and PHP/Perl or Python):  Dealing
>> > with website-content management, security.  For a prestigious online 
>> New
>> > York newspaper.  NYC, 6+  months on going $65/hr (negotiable).
>> >
>> >
>> > _
>> >
>> > Efrain Sarmiento
>> > Technical Recruiter
>> > MISI company
>> >
>> > p: 212.355.5585 x332
>> > f: 212.751.5964
>> > c: 917.365.5656
>> > [EMAIL PROTECTED]
>> >
>> > Informed Usability  |  Innovative Solutions   |  Reliable Sourcing
>> > www.misicompany.com
>> > _
>> >
>> > The information contained in this message is sent in the strictest
>> > confidence for the addressee only. It is intended only for the use of
>> > the addressee and may contain legally
>> > privileged/confidential/proprietary information. If you have received
>> > this email in error you are requested to preserve its confidentiality
>> > and advise the sender.
>> >
>>
>>
>> -- 
>> Enjoy,
>>
>> Jim Lucas
>>
>> Different eyes see different things. Different hearts beat on different
>> strings. But there are times for you and me when all such things agree.
>>
>> - Rush
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 


-- 
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.

- Rush

-- 
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] Job Opportunity

2007-03-21 Thread Warren Vail
While Jim does have a point and is limited by the threading algorithm of
this list manager, someone can successfully argue that "this standard" has
it's drawbacks.

It is somewhat intuitive to pick up a message all pre addressed and reply to
all, especially when your intention is to send a message that will "reach
all".  

It is also somewhat intuitive to think that changing the subject means
starting a new thread, however with thread id's hidden in the headers, this
doesn't work.  You CAN argue that standards that don't work are a bad thing,
or at least, not a GOOD thing.  

I don't, however, have a good solution, since basing threads on subject
lines has a different set of drawbacks like lots of broken or disjointed
threads that have a beginning in another thread.  These hidden ID's keep
things together but they also generate lots of off topic discussion within a
thread, like we are doing here ;-), pretty soon we should hear from those
police.

Warren Vail

-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 12:58 PM
To: Warren Vail
Cc: 'Jim Lucas'; 'Chris Ditty'; php-general@lists.php.net
Subject: Re: [PHP] Job Opportunity

Warren Vail wrote:
> Too bad we have to constrain our messages to fit the threading algorithm
of
> your list server.  Another case of where man becomes servant to the
machine?
> 8-)

Jim has a point. Hi-jacking a thread by hitting reply to all and 
changing the subject line messes with the *standard* threading 
mechanism, and nobody can successfully argue that standards are a bad 
thing. It has nothing to do with Jim's setup.

-Stut

-- 
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] Idea/Suggestion for PHP App

2007-04-05 Thread Warren Vail
I would also encourage plagiarism (something that you can do with open
source, well, within reason).  Download and install other peoples solutions,
look at their code, and figure out what worked for them and what didn't.
You not only get new ideas, but will pick up on techniques that the author
had learned the hard way and now employs regularly(no sense reinventing the
wheel).  One place I look for OPS (Other People's Solutions) is
http://www.hotscripts.com. (Google is also your friend :-)).  Look for code
and modules that you can employ in your solutions
(http://www.sourceforge.net).

For example if you are planning to do graphics or charting take a look at
jpgraph (http://www.aditus.nu/jpgraph/).

Or if you want a integrated editor that can handle multiple fonts and such,
check out devedit (http://www.interspire.com/devedit) or TinyMCE
(http://wiki.moxiecode.com/examples/tinymce/installation_example_12.php).

Remember that an application in the hand is worth a dozen that were started
over because you may have been trying to reinvent a wheel that could be
found for free on the internet.  You can learn how to leverage your time a
lot with PHP and the PHP community.

Warren Vail

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 05, 2007 1:07 PM
To: php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Idea/Suggestion for PHP App

I think you're probably doing what almost all of us have done.  Get an idea,
see PHP as a potential solution and decided to just dive right in.  I don't
think many people start out in a classroom style "Hello World" situation and
build slowly onto that.

I'm sure other people have better starter sites to point you to than I do,
so I'll leave that to someon else.  Just know that php.net and the examples
in the online manual are your friend.  Same with MySQL, but databases are a
little trickier than PHP concept-wise (I believe at least).

First thing.. dive right in.  You're going to do some really goofy stuff in
the beginning and you're going to learn how to do things better the longer
you work with it all.

Second.. if you get the inclination to write a function to perform some task
in PHP, dredge through the online manual for a bit.  I can't tell you how
many times I did something "the hard way" only to find that PHP already had
a function to do what I was trying to do.

Third.. when designing your site and database, try to keep things modular.
Try not to create the same set of data or same page functionality over and
over again so it'll have to be updated in 10 different places if you decide
to change it.

Example(s):

Menus that appear on many (all?) pages can be put into a file and either
include() or require() (also see the "once" versions of those) as
appropriate.

In your database, say you had a human resources table that had employee
data.  You'd want a column for each piece of data that all employees are
going to have.  If there are data items that are only going to pertain to
one or two employees, or maybe there's an unknown quantity of extra items,
then you might consider putting that information in another table and
linking it to your user table using the unique ID from the user table.

The company I work for deals with mortgage data and part of that is credit
information.  On credit reports, you have a list of liabilities that are
factored in.  Maybe you only have one, maybe you have 20.  In our current
database, there's a table with stuff like "Liability1", "Liability2",
"Liability3"..etc..  as columns.  This is amazingly poor database design.
It limits the number of liabilities we can store and also bloats our
database with extra information for people who only have a couple
liabilities listed.  It would have been better designed if Liabilities were
in their own table as rows, not separate columns in the main loan
information table.

Once you get waist deep in the project, make a few silly mistakes and learn
how to structure your code and data, you'll get it all working the way you
want.  Just don't be afraid to dive in and make a mess..hah.  Planning is
great if you know what you're doing, but when you're still learning then
expect to do some silly stuff for a bit.

And, as always, feel free to ask questions on the list here..  after
consulting the manual and Google/Yahoo/MarthaStewart of course :)

Welcome and good luck!

-TG

= = = Original message = = =

Hey... I am new to the list so please forgive me if I say anything that
might have already been discussed.  So here we go...

OK I am attempting to start a new application using PHP.  I have started and
stoped this application now 2 times cause I get moving then I stop realizing
I should have done this work before hand and in a differant way.  I was
wondering does anyone have any places I can read on how d

RE: [PHP] Re: Best way to test for form submission?

2009-08-29 Thread Warren Vail
To test a form I usually send the form contents to a php file that contains
the following;

foreach($_POST as $nm => $val) echo "_POST[".$nm."] [".$val."]";
foreach($_GET as $nm => $val) echo "_GET[".$nm."] [".$val."]";

Checkboxes and radio buttons only send their value if the control is
"checked".

You can have multiple submit buttons (type="submit") on a form, but you
should assign them different name parameters to recognize which one is
clicked (any one of them will cause the form to be submitted, but the only
one that will establish a $_POST entry named "submit" is the submit control
that is named "submit" (name="submit"). 

Pressing enter is not sensed by most controls.
Most browsers will look at the field the cursor is positioned on when enter
is pressed, and if it is not one of the controls that response to an enter,
it scans the DOM (list of controls), and will apply the enter to the first
control that responds to an enter, most common is the type="submit" control.


If a select control is between the text box and the submit button (in the
DOM list) the current entry for the select list will be selected and the
form will not be submitted unless the list includes a
onChange="this.form.submit(); " javascript entry.

Be careful designing forms that are dependent on some of these behaviors,
like positioning a submit button to the right of a text box to intentionally
receive the "enter", because different browsers will probably behave
differently.

Hope this helps a bit.

Warren Vail
Vail Systems Technology

-Original Message-
From: Keith [mailto:survivor_...@hotmail.com] 
Sent: Friday, August 28, 2009 9:51 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Best way to test for form submission?

I've encountered issue with checking $_POST['submit']
if(isset($_POST['submit'])) {}

If the form consists of checkbox/radio and text field, some of my forms can 
be submitted by just press [ENTER] at the end of one of the text field. In 
this case, the $_POST['submit'] is set even the  submit button was not 
clicked.
However, in some of my forms, $_POST['submit'] will not be set if I submit 
the form by pressing [ENTER] in one of the text field.
So, if the later case happen, I need to remind the user to explicitly click 
the [Submit] button.
I don't know why or in what condition that pressing [ENTER] will not submit 
the whole form include the $_POST['submit'].

Keith


"Ashley Sheridan"  wrote in message 
news:1251467419.27899.106.ca...@localhost...
> On Thu, 2009-08-27 at 23:21 -0400, Adam Jimerson wrote:
>> On 08/27/2009 11:09 PM, Adam Jimerson wrote:
>> > This question might give away the fact that I am a php noob, but I am
>> > looking for the best way to test for form submission in PHP.  I know in
>> > Perl this can be done with
>> >
>> > if (param)
>> >
>> > but I don't know if that will work with PHP.  I have read the Learning
>> > PHP 5 book and the only thing that was mentioned in the book was the 
>> > use
>> > of something like this
>> >
>> > print "Hello ".$_POST['username']."";
>>
>> Sorry copied and pasted the wrong line (long day)
>>
>> if (array_key_exists('username',$_POST))
>> >
>> > I'm sure that this is not the best/recommended way to do this but I'm
>> > hoping someone here will point me in the right direction.
>>
>>
>
> The best way I've found is to do something like this:
>
> if(isset($_POST['submit']))
> {}
>
> Note that in-place of submit you can put the name of any form element. I
> chose submit here, because every form should have a submit button. Note
> also that this will only work if you have given your submit button a
> name:
>
> 
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
> 

-- 
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 String convention

2009-10-28 Thread Warren Vail
The curly braces look like something from the smarty template engine.

Warren Vail
-Original Message-
From: Kim Madsen [mailto:php@emax.dk] 
Sent: Wednesday, October 28, 2009 10:18 AM
To: Nick Cooper
Cc: Jim Lucas; php-general@lists.php.net
Subject: Re: [PHP] PHP String convention

Hi Nick

Nick Cooper wrote on 2009-10-28 17:29:

> Thank you for the quick replies. I thought method 2 must be faster
> because it doesn't have to search for variables in the string.
> 
> So what is the advantages then of method 1 over 3, do the curly braces
> mean anything?
> 
> 1) $string = "foo{$bar}";
> 
> 2) $string = 'foo'.$bar;
> 
> 3) $string = "foo$bar";
> 
> I must admit reading method 1 is easier, but writing method 2 is
> quicker, is that the only purpose the curly braces serve?

Yes, you're right about that. 10 years ago I went to a seminar were 
Rasmus Lerforf was speaking and asked him exactly that question. The 
single qoutes are preferred and are way faster because it doesn´t have 
to parse the string, only the glued variables.

Also we discussed that if you´re doing a bunch of HTML code it's 
considerably faster to do:


   


Than
print "
\n\t
   \n\t\t$data
\n\t";

or
print '

   '.$data.'
';

I remember benchmark testing it afterwards back then and there was 
clearly a difference.

-- 
Kind regards
Kim Emax - masterminds.dk

-- 
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] [NEWBIE] Trying to combine array into one string

2005-02-15 Thread Warren Vail
Try loading he email address to an array from your query;

$addressarray[] = $address;

and when done extracting the rows from your database, parse them into a comma 
separated string using

$listofaddresses = implode(", ",$addressarray);

HTH,

Warren Vail

> -Original Message-
> From: Dave [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 15, 2005 7:37 AM
> To: php-general
> Subject: [PHP] [NEWBIE] Trying to combine array into one string
> 
> 
> PHP General,
> 
> The Situation:
> I'm retrieving some email addresses from a database. I want to be 
> able assemble all the addresses into one string that I can use in the 
> mail() command. At no time should there ever be more than about 5 email 
> addresses collected from the database. I want all addresses to appear in 
> the "To:" field so everyone receiving the email will know who else has a 
> copy.
> 
> The Problem:
> I can't quite figure out how to take the results of the 
> mysql_query() and assemble them into a string. In my experiments so far, 
> I either get a "mysql_data_seek(): Offset 0 is invalid for MySQL result 
> index" error, or my mail function sends to a blank address.
> 
> What I've Tried So Far:
> My own code is obviously flawed in syntax in logic, so I searched 
> the manual and this list's archives under the terms "array", 
> "concatenate", "convert", "append" and "string" in various combinations. 
> However, while I learned some interesting tips on a variety of topics, I 
> suspect I'm missing some essential description that will lead me to the 
> command I need.
> 
> The Question:
> How do I take the contents of an array and turn them into a single 
> string?
> 
> For Reference:
> Here is the code I have. I know it's flawed, but hopefully it will 
> give an indication of what I'm trying to achieve:
> --code--
> $tantoQuery = "SELECT forum_members.emailAddress AS email FROM 
> forum_members, event_tanto WHERE forum_members.ID_MEMBER = 
> event_tanto.tanto AND event_tanto.event ='" . $show . "'";
> 
> $tantoResult = mysql_query($tantoQuery);
> 
> while ($tantoData = mysql_fetch_array($tantoResult))
> {
> $tantoEmail = $tantoEmail . "," . $tantoData;
> }
> 
> mail($tantoEmail, $subject, $mailcontent, $addHeaders);
> --code--
> 
> Any help would be much appreciated.
> 
> -- 
> Dave Gutteridge
> [EMAIL PROTECTED]
> Tokyo Comedy Store
> http://www.tokyocomedy.com/english/
> 
> -- 
> 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] Re: mediator between PHP and Perl (with sessions)

2005-02-15 Thread Warren Vail
Eli,

Sessions work just fine with CLI (Command Line Interpreter), although there is 
little need for them as a CLI script, since once started the script does not 
wait on user clicks of a browser for it's next set of input, therefore no need 
to use sessions for passing information.  Most CLI scripts are started via a 
cron process, and if started from a webpage, the items passed to the script can 
be passed via command line parameters, or if passed as session variables, the 
session key needs to be passed to the CLI script, since CLI scripts don't have 
access to cookies.  One advantage of using session variables when starting a 
CLI script, is that the session may be able to pass bigger values than can be 
contained in a command line. (Command line variables can be accessed in the 
argc/argv array like in "c") and once passed this way the sessions are no 
longer needed since your CLI script will run to completion.

If your server is a NIX box, you may have access to the "&" character after the 
command name that will cause it to run as a separate shell script, but you will 
need to set the timeout to allow it to run long enough, and if you do not use 
the "&" separate shell character, the script will be interruptible by the user 
who started it by clicking a button like "stop" on his browser.

The unserialize function is indeed used for sessions, but with most newer 
releases of PHP "register variables" is turned off, which means the variables 
are not restored automatically (you will find them in the $_SESSION array).  
Sections of the manual you may want to reread are as follows;

http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/function.session-set-save-handler.php (good 
illustrations of what happens in sessions)
http://www.php.net/manual/en/function.session-register.php (notice the notes on 
register variables).
http://www.php.net/manual/en/function.session-id.php
http://us3.php.net/manual/en/function.set-time-limit.php to allow script to run 
longer.
http://us3.php.net/manual/en/function.shell-exec.php for starting a cli script 
(don't forget to start php).

hope this helps,

Warren Vail

> -Original Message-
> From: Eli [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 15, 2005 7:07 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: mediator between PHP and Perl (with sessions)
> 
> 
> It's quite easy to pass the session variables to the script. The problem 
> with sessions and shell PHP scripts, is that PHP doesn't support 
> sessions on that mode (CLI mode it is called). So, I would have to 
> manualy read the session file and parse it. If anyone knows what is the 
> exact function that is used to unserialize the session file, please 
> tell.. and it's not the unserialize() function in PHP.
> 
> I guess that using a shell PHP script with sessions is not the solution. 
> Is anybody familiar with another way to use sessions??? but not through 
> web, since the script returns sensitive data.
> 
> 
> -thanks, Eli
> 
> -- 
> 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] Crontab for Windows

2005-02-17 Thread Warren Vail
> On my live server I use Linux, so am fully familiar with Crontab. I am
> not that familiar with running scripts using the scheduler in
> Win2K though.

I use nncronlite which is a cron implementation for windoz (familiar
crot.tab file);

http://www.batchconverter.com/nnCronLITE-download-16062.shtml

One problem I encountered with the MS scheduler, is it needed to be running
as a process, and in an implementation of windows that had Microsoft SQL
Server running on NT, seems this SQL server has the ability to schedule some
batch processes, but it implemented a replacement for the batch scheduler
that would not process my "AT" commands.  In windoz the "AT" command is used
to add processes to the schedule.

hope this helps,

Warren Vail

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



RE: [PHP] Re: Crawlers (was parsing large files - PHP or Perl)

2005-02-17 Thread Warren Vail
Check out PHPdig;

http://www.phpdig.net/

Warren

> -Original Message-
> From: Jamie Alessio [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 17, 2005 9:22 AM
> To: John Cage
> Cc: php-general@lists.php.net
> Subject: [PHP] Re: Crawlers (was parsing large files - PHP or Perl)
> 
> 
> > Is there anyone on this list who has written fast and decent 
> > crawlers in PHP who would be willing to share their experiences?
> > 
> My first inclination would be to use an existing crawler to grab the 
> pages and store all the files locally (even if only temporarily). Then, 
> you can use PHP to do whatever type of processing you want on those 
> files and can even have PHP crawl deeper based on links in those files 
> if necessary. I'd have a hard time coming up with a reason to think I 
> would implement a better web crawler on my own than is already available 
> from other projects that focus on that. What about existing search 
> systems like:
> 
> Nutch - http://www.nutch.org
> mnoGoSearch - http://mnogosearch.org/
> htdig - http://www.htdig.org/
> or maybe even a "wget -r" - http://www.gnu.org/software/wget/wget.html
> (I'm sure I missed a bunch of great options)
> 
> Just an idea - I'd also like to hear if someone has written nice 
> crawling code in PHP.
> 
> - Jamie
> 
> -- 
> 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] fopen and redirects

2005-02-24 Thread Warren Vail
I am using fopen with a url to open a remote file (read only of course).
The url I am providing results in a redirect and the fopen seems to be smart
enough to follow the redirect to return the actual file contents.  How can I
get at the redirected filename?

The problem is the file contains html and relative references in href's
buried in the html are relative to the redirected location and not my
original location, and I would like to subsequently open some of those files
(like a crawler does).

thanks in advance,

Warren Vail


RE: [PHP] fopen and http://

2005-02-25 Thread Warren Vail
Just a wild guess, but try url;

http://localhost/zed/htdocs/rgfindingaids/series594.html

or

file://zed/htdocs/rgfindingaids/series594.html to bypass your web server

I am struggling with the section of the manual that deals with this as well.

http://us3.php.net/manual/en/ref.stream.php

hope this helps,

Warren Vail

> -Original Message-
> From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 08, 2004 6:58 AM
> To: Adam Williams; php-general@lists.php.net
> Subject: RE: [PHP] fopen and http://
>
>
> May be the path is not the correct ,just check with the Web
> Directory you configured to be and if its htdocs then I would say
> that its better to remove the htdocs from the path in fopen statement.
>
> -Original Message-
> From: Adam Williams [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 08, 2004 6:22 PM
> To: php-general@lists.php.net
> Subject: [PHP] fopen and http://
>
>
> Hi, I'm having a problem with fopen and http files.  I keep getting the
> error:
>
> Warning: fopen(http://zed/htdocs/rgfindingaids/series594.html )
> [function.fopen]: failed to open stream: HTTP request failed!
> HTTP/1.1 404
> Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
> http://zed/htdocs/rgfindingaids/series594.html does not exist
>
> Warning: fopen(http://zed/htdocs/rgfindingaids/ser391.html )
> [function.fopen]: failed to open stream: HTTP request failed!
> HTTP/1.1 404
> Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
> http://zed/htdocs/rgfindingaids/ser391.html does not exist
>
> Warning: fopen(http://zed/htdocs/rgfindingaids/ser392.html )
> [function.fopen]: failed to open stream: HTTP request failed!
> HTTP/1.1 404
> Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
> http://zed/htdocs/rgfindingaids/ser392.html does not exist
>
>
>
> I have a text file /home/awilliam/public_html/rgfaids containing
> URLs such
> as:
>
> http://zed/htdocs/rgfindingaids/series594.html
> http://zed/htdocs/rgfindingaids/ser391.html
> http://zed/htdocs/rgfindingaids/ser392.html
>
> and I can bring up these URLs fine in a browser on the PC i'm running the
> script on.
>
> The following is my code:
>
> 
> $filelist = fopen("/home/awilliam/public_html/rgfaids", "r");
>
> if (!$filelist)
> {
> echo "error opening rgfaids";
> exit;
> }
>
> while ( !feof($filelist))
> {
> $line = fgets($filelist, 9);
>
> $filetotest = fopen("$line", "r");
>
> if (!$filetotest)
> {
> echo "$line does not exist";
> }
> elseif ($filetotest)
> {
> echo "$line does exist";
> }
> }
>
> ?>
>
>
>
> But I don't understand why I am getting that error about failed to open
> strem: HTTP request failed, when I can bring up the links fine in a
> browser on the server running the php script.  So can anyone help
> me out?
> 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
>
>
>
>

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



RE: [PHP] Open source portal systems???

2005-02-25 Thread Warren Vail
Where did you hear that PHP Nuke required a powerful server?  I personally
implemented PHP Nuke on a Windoz box (one strike there), that ran on a 166
mmx box (a big second strike), and benchmarked it handling 90 concurrent
users, with no noticeable delays.  If I were you, I'd dig deeper into what
you heard and you may find that someone had another agenda in mind when they
passed along that info.  It's unfortunate, but there are lots of people in
the IT field that distort results to justify an already conceived opinion.

go figure,
Warren Vail

> -Original Message-
> From: Kostyantyn Shakhov [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 25, 2005 9:34 AM
> To: php-general@lists.php.net
> Subject: [PHP] Open source portal systems???
>
>
> I've got an order for the media portal. Thus, I'm looking for an open
> source portal systems. First that comes to my mind is PHP-Nuke, but I
> heared that it requires a powerful server and i'll have just a
> middle-level one. So, could someone knows another PHP-based open
> source portal systems? Thank you in advance.
>
> --
> Best regards,
>  Kostyantyn  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] Re: FTP info in a variable

2005-02-25 Thread Warren Vail
Good stuff Jamie.

Steve, I believe it may even be possible to compress the file on the fly, or
send it using SSL if that is desirable;

http://www.php.net/manual/en/ref.stream.php describes how to use stream
wrappers.

good luck,

Warren Vail

> -Original Message-
> From: Jamie Alessio [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 25, 2005 9:13 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: FTP info in a variable
>
>
> > I have to write a little program that pulls information from a
> > database, formats it into csv format for importing into excel and ftps
> > it to another server.  I have everything worked out except for the
> > ftping.  I have read through http://us4.php.net/manual/en/ref.ftp.php
> > and I know I can get the data from the database, save it to a file and
> > ftp it.  Does anybody know if I can skip the step of saving it
> to a file
> > and ftp/stream it directly to a filename on another server?
> >
> Steve,
> You should be able to skip the step of writing the CSV file out to disk
> by using PHP's Filsystem functions along with FTP wrappers. I think
> something like this will work:
>
> $handle = fopen("ftp://user:[EMAIL PROTECTED]/somefile.csv", "w");
> fwrite($handle, $yourCSVdata);
>
> The FTP wrappers allow you to (almost) treat the file as though it were
> on your local filesystem.
>
> Check the man pages for details on how to do this properly and check for
> errors:
> http://us4.php.net/manual/en/function.fopen.php
> http://us4.php.net/manual/en/function.fwrite.php
> http://us4.php.net/manual/en/wrappers.ftp.php
>
> - Jamie
>
> --
> 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] [noob] can't submit simple form, need help

2005-03-03 Thread Warren Vail
> $submit_post=$_REQUEST['submit']; 
>  
> if ($submit_post=='yes') { 
 
looks like the value in your form is not 'yes' but 'submit'

>
>
>
if this is not it, perhaps we should see more.

Warren Vail

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



RE: [PHP] php compiler

2005-03-14 Thread Warren Vail
I could be wrong, but I believe that all the Java apps out there are not
native binary machine code either?  unless you count the JRE (Java Runtime
Environment).  Seems to me that is the way things are today, with JRE's all
having "run time configuration".  I would prefer to PHP to Java any day.

Have you checked out the Road Send compiler?  http://www.roadsend.com/  I
don't believe it produces pure native binary either, but I could be wrong
here as well.

good luck,

Warren Vail

> -Original Message-
> From: Davy Durham [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 14, 2005 9:22 PM
> To: php-general@lists.php.net
> Subject: [PHP] php compiler
>
>
> Sooo.. I'm assuming there's no stable project for compiling php code to
> native binary machine code huh?  (I've done some searching)  Even
> anything commercial? (I didn't care for Zend's optimizer so much.. still
> has *RUN*time configuration)
>
> Thanks,
>   Davy
>
> --
> 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] Printing

2005-04-02 Thread Warren Vail
That is because Windoz, for all it's faults, provides a bit of an
interface for applications to exercise some control over printed output,
and even attempts to make it device independent.  Don't know if Gnome,
or other GUI's provide something, but if you write the output intended
for a printer to a physical file and then post that file to your print
spooler using a exec() function that should do the trick.

http://us4.php.net/manual/en/function.exec.php

I suspect you would use the unix command to cause the file to be spooled
to the printer as you would manually (I seem to recall an lpr command
being involved, but don't trust my memory).

This carries with it all the caviates about whether or not you know who
your website visitors are, and what happens when multiple users try to
trigger printing (who loads paper in the printer?).  Another potential
snag is, will you website user (usually "nobody") have permission to
print (execute the lpr command)?

Unless gnome or kde is involved, don't know how you could detect your
printer types, since your program will need to know which pcl (printer
control language) is required.

Good luck,
Anyone have other solutions?

Warren Vail


> -Original Message-
> From: Niels Riis Kristensen [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, April 02, 2005 8:03 AM
> To: php-general@lists.php.net
> Subject: [PHP] Printing
> 
> 
> Hi
> 
> I am using a Unix machine (Mac) but can't find ways to print to my 
> local printer. Plenty of information about printing from a 
> PC, but none 
> from a mac. Can that be, that you can't print from php to mac?
> 
> 
> Niels Riis Kristensen
> ([EMAIL PROTECTED])
> 
> NRK Group
> - Electronic Music Engraving
> - Webhosting
> - Dynamic Web design
> - E-Lists hosting
> 

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



RE: [PHP] Amazon/eBay API

2005-04-15 Thread Warren Vail
There is a PHPNuke (web portal application) module that will allow you
to open an Amazon Store on your website.

NukeAmazon http://www.PrecioGasolina.com/

I'm still looking for an eBay feed, I think the barrier there is that I
heard eBay charges some big bucks to be able to access the interface.
Amazon on the other hand recognized the power of having a proliferation
of front-ends promoting and selling their products and provides access
pretty much for free (there are features you can pay extra for if you
are inclined).  

Don't know if eBay will ever come along.  Apple, even today, doesn't
recognize that IBM gained it's dominance by giving away its bios listing
and hardware specs (and some of its business) in the very beginning,
while apple looked at that type of move as giving away income it was
intitled to receive and jealously guarded it's monopoly, even sueing
vendors in some cases.  eBay probably feels they already have a monopoly
on auction sites and don't need to give their stuff away.

Warren Vail
[EMAIL PROTECTED]

> -Original Message-
> From: Brian Dunning [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 15, 2005 9:57 AM
> To: php-general@lists.php.net
> Subject: [PHP] Amazon/eBay API
> 
> 
> Does anyone know of any PHP classes for processing the Amazon or eBay 
> XML feeds?
> 
> - Brian
> 
> -- 
> 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] Are sessions unreliable?

2005-04-15 Thread Warren Vail
I have had similar things happen but in every case it turned out to be a
program bug in my code.  It was usually something I looked at over and
over and I saw the way it was supposed to work, but because I missed a
detail it was not working that way.  I would suggest you find someone to
look over your code and help you with the debug process.  I found many
bugs just trying to explain to someone clearly how it worked.

I suppose it could be a browser problem, but you need to solve those as
well, or at least handle them gracefully.  Do you make it a practice of
having multiple browser instances open at the same time.  I believe they
will each normally get their own session key, and if you get your hands
crossed, you will be looking at the symptoms in the wrong browser,
bottom line, test, test, and test, then get a second set of eyes to look
at your code, show them how it works, they don't need to really know a
lot about PHP, or even programming for that matter, they will ask
questions that as you try to answer them, you will find your problems.

I have never found a legitimate bug in PHP Sessions, I have on the other
hand found I was inconsistently using session handler routines, and
before register globals was turned off, I was finding form variables
that clobbered my session variables (or maybe it was the other way).

Good Luck,

Warren Vail
[EMAIL PROTECTED]

> -Original Message-
> From: Dasmeet Singh [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 15, 2005 11:04 PM
> To: php-general@lists.php.net
> Subject: [PHP] Are sessions unreliable?
> 
> 
> Hi!
> 
> I store some user info in sessions.. it works fine but sometimes what 
> happens is that the user id stored in session get changed.. and it 
> happens only sometimes..
> 
> Can it be browser problem? or this is common?
> 
> Thanks
> 
> 
> 
> -
> Free cPanel Web Hosting 
> http://hostwindow.info/web-hosting/2/free-> cpanel-web-hosting/
> 
> 
> -- 
> 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] I need do paging in php, I use ODBC Access

2005-04-21 Thread Warren Vail
> Somebody did paging in php for data origin in ODBC Access?
> 
> I need an algorithm for doing this, please Help me!

I assume by "paging" you are referring to a scrolling algorithm that
allows you to view only a small portion of your query result set.  The
algorithm that comes to mind is dependent on the database that ODBC is
connected to.

If the database is MySQL, the query that would allow do this is the SQL
LIMIT clause, where executing and re-executing the query will return
only a portion of the sequence set produced by the query;

$query = "SELECT ".$columnlist
." from my_table where col1 = \"sold\" order by order_date "
."LIMIT ".sprintf("%01d",$rowno).", 10 ";

If $rowno = 0 the query will return the first 10 rows
If you add 10 to $rowno and re-execute the query, it will return the
second set of 10 rows
And so on.

I have used ODBC to access Microsoft SQL Server and DB2 Databases, and I
believe neither support the SQL LIMIT clause, although I am not as
certain about my memory of MSS as DB2.  Someone will correct me if I am
wrong.

The only approach left that I could come up with is to transfer the
entire sequence set to your application, and count the rows, perhaps
only displaying the rows you want to show.  This is obviously not very
efficient (in fact, with enough rows it may prove impossible because of
memory limitations), but it will produce what appears to be a paged
result.

HTH,

Warren Vail

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



RE: [PHP] Re:Re: [PHP] help for me about session

2005-04-24 Thread Warren Vail
Looks like you are mixing JavaScript syntax with PHP, and that doesn't
work since JavaScript runs on the browser machine, and PHP on the server
(document.form.NextCourse.value is a syntax you will find in JavaScript,
not PHP).

Try something like this;



Make sure sessions are enabled on your server, you can confirm this by
executing php_info();

HTH,

Warren Vail


> -Original Message-
> From: Josephson Tracy [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, April 24, 2005 8:27 AM
> To: Steve Buehler
> Cc: php-mailing-lists
> Subject: Re: [PHP] Re:Re: [PHP] help for me about session
> 
> 
> I want to get the value of document.form1.NextCourse.value
> But I got the  value of $NextCourse in last page.
> 
> Steve Buehler <[EMAIL PROTECTED]> wrote:
> 
> At 10:29 PM 4/23/2005, Josephson Tracy wrote:
> > > At 09:35 PM 4/23/2005, Josephson Tracy wrote:
> > > >hi everyone,
> > > >when i study php, i have a problem as following:
> > > >-
> > > >file1.php
> > > >> > >if($NextCourse == 1){ do something;}
> > > >else($NextCourse ==""){do something other }
> > > >?>
> > > >-
> > > >but when the 2ed access the file1.php
> > > >the value of $NextCourse is the $NextCourse in the , Not 
> the value 
> > > >of document.form1.NextCourse.value.
> > > >
> > > >could someone tell me why?thanks
> > >
> > > I believe it should be:
> > > > > if($NextCourse == 1){ do something; }
> > > elseif(!$NextCourse){ do something other; }
> > > > >
> > > By the way you have your statement, I think you are only 
> looking for 
> > > the "1". You might try the following instead.
> > > > > if($NextCourse == 1){
> > > do something;
> > > }else{
> > > do something else;
> > > }
> > > ?>
> > >
> >ok. the key problem is when I click the button to submit.
> >the value of $NextCourse is not the value of value
> > of document.form1.NextCourse.value.
> >just is the pre page's $NextCourse,that's say "null";
> >how can i get document.form1.NextCourse.value?
> 
> How are you passing the variable $NextCourse to this script?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 

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



RE: [PHP] handling a user pressing browser's back button

2005-04-26 Thread Warren Vail

> 
> I changed everything to GET and it's behaving better!  Thanks.
> 
> I guess when the user clicks the back button they should just get 
> back the last state of the browser...no if, and or but's.

This is because when you click the back button on the browser it pulls
up the URL from it's history list and attempts to render the page.
Note: that the browser only saves the URL in it's history list.  When it
attempts to render pages that were entered via a GET reference, all the
data is available, and when it attempts to render a page that was
entered via a POST, it is complaining that it no longer has the "post"
data to complete rendering of the page (it only saved the URL).  Does
that make sense?

Warren Vail

Solution in PHP for forms that use POST, is to have the PHP routine
perform whatever updating is necessary, or what ever, then redirect the
browser (header function) to a page that will fetch the data from your
database and present the page.  The browser thinks that it has uncovered
a new URL for the one it found in the link and replaces the URL in the
history list which should be a GET type URL.  One advantage of this
structure is the update will only be posted once in response to a POST
and the back button will skip over the update logic (no multiple updates
from stepping backward).

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



RE: [PHP] html editor written in PHP

2005-05-19 Thread Warren Vail
> PHP is server side.  

I know this is conventional wisdom, but your answer ignores the fine
work being done with PHP-GTK.

In this case the PHP executes on the client machine (although not
imbedded in a browser), as an application.  However I don't know of any
Editors that work with PHP-GTK, stay tuned, however.

http://gtk.php.net/

Warren Vail

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



RE: [PHP] FW: Resizing Pictures

2004-04-19 Thread Warren Vail
If you don't mind doing them by hand, Window Paint can, use
Image->Stretch/Skew and Stretch by the same percentage for horizontal and
vertical dimensions to keep the same perspective (less than 100% will reduce
the picture and more than 100% will stretch, but clarity of the image will
suffer from enlarging the image).  I would also suggest save a .bmp in the
original size for future resizing and adjusting, and save as jpg for
transferring to your website (your visitors will appreciate the smaller jpg
format).

good luck

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Ryan Schefke [mailto:[EMAIL PROTECTED]
Sent: Monday, April 19, 2004 8:06 PM
To: Php-General-Help
Cc: 'Ryan Schefke'
Subject: [PHP] FW: Resizing Pictures




How do you resize pictures once they're in a certain directory?  I have the
script to upload a picture, that's working fine.  I just need some help with
resizing it.  Can someone help?



Thanks!

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



RE: [PHP] Hierarchies and MySQL with PHP

2004-06-27 Thread Warren Vail
I did one once where the key to the table was a string, and the string
contained 1 to n Node Numbers separated by a separator character.

"1"
"1.1"
"1.1.1"
"1.2"

select data from table where node between (1 and 2)

resulted in an entire limb of the tree being retrieved.  Limitations were
the size of the string, depth of the tree (the string was truncated), and
the number of digits in each node number.  Problem also with ordering node
numbers, node number 1 tended to be followed by node number 10, 11, 12, etc,
then number 2, until I pre-determined the number of leading zeros for each
node.

Not pretty, but it works well for small trees.

Warren Vail

-Original Message-
From: Mattias Thorslund [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 27, 2004 9:59 AM
To: PHP General Mail List
Subject: [PHP] Hierarchies and MySQL with PHP


Hi,

I wonder what you think are the best (or "least worst") strategies to
store and retrieve hierarchial data (such as a "threaded" discussion or
a multi-level menu tree) in MySQL using PHP?

I have been using table structures where each row contains a parent
reference, such as:

Table Example:

Field namedata type/db flagsComents
=
RowID int unsigned auto_increment not null  (primary key)
ParentRowID   int unsigned  0 (or NULL if at top
level)
Name  varchar(50)


... which is OK for *defining* the hierarchy.  However, it's a pain to
retrieve the data so that it can be displayed in a nice threaded/sorted
way, where children are sorted directly below their parents.  I also
want the items to be nicely sorted within their own branch, of course.

On MS SQL, I successfully used stored procedures that employ temporary
tables and while statements and the like.  That method is not available
in MySQL (yet), so I'll have to do a lot of the manipulation on the web
server instead, using PHP.

Any suggestions?

/Mattias

--
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] Re: PHP doesnt work!

2004-07-04 Thread Warren Vail
PHP relies on a server side interpreter that normally runs under an apache
web server and you reference those files by having your browser fetch those
files through a URL that maps to your PHP files, beginning with something
like http://hostname.com/program.php.  If you opened the files directly with
your browser, you have bypassed the apache server and PHP interpreter, which
of course, would not allow the PHP code to actually be executed.  Not real
sure this is what you might have done, but it's a common mistake.

good luck,

Warren Vail
[EMAIL PROTECTED]

-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 03, 2004 9:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP doesnt work!


Gmo Baez wrote:
> Hello, I have a Freebsd server 5.2.1 with Apache 2.0.48 and PHP 4.3.4.
>
> After the installation everything looks normal, but after i created some
PHP
> web files to test it, I found that  PHP is not working.
> When i open de PHP document with the browser i only receive a blank page.
> But if i check the source code, all the PHP code is in there.

What kind of code are you using to test the script?  Not every script
outputs html... have you tried phpinfo()?  It is unclear what your
problem may be from what you've given us.

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] Re: PHP Sessions Question

2004-07-08 Thread Warren Vail
I have a suggestion that would allow you to take charge of what is going on
with your sessions.  Install your own session handler routines, storing your
own session data in your own database table.  These functions would need to
be loaded on each page before you execute the session_start() function on
each page.

http://www.php.net/manual/en/function.session-set-save-handler.php

Since the Garbage Cleanup and session read function is now under your
control, you can establish the session expiration that is appropriate for
your application, independent from the PHP default for the site.  Be
careful, however for the parameters that control the life of the cookie in
the browser, they can also cause the session to be lost if not set properly.

http://www.php.net/manual/en/function.session-set-cookie-params.php

This may sometimes seem intermittent, since the cookie will expire from the
time first established in the browser, and if you are only aware of the time
from the last page, and the cookie goes away, the session will appear to
have been destroyed.

good luck,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 08, 2004 11:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: PHP Sessions Question


> On garbage collection, it happens sometimes within seconds and sometimes
> within minutes.  It tends to occur in batches with lulls of 20 to 30
> minutes.  So, for example, I can login, navigate through 11 different
pages
> to generate the problem, navigate 2 pages to generate the problem, and
then
> not see the problem again for another 5 minutes.  Does that fall in line
> with what you're thinking?
>

Actually, no.  Garbage collection would destroy the sessions, so if
they're only "temporarily" disappearing then load balancing seems even
more likely.

I'm going to assume not, but are you using a non-default session
handler?  If for instance you were storing sessions in another database,
or simply on a different machine then connections can fail.  This would
most likely only be set up through the set_session_handler directive I
mentioned before... but you should also check your php.ini values for
session.save_handler and session.save_path

--
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] About Session And Cookies

2007-08-17 Thread Warren Vail
Kelvin,

Sessions is just one of the items recommended for an e-commerce website.  I
seem to recall that if cookies were not enabled that there was a way of
passing the session id in the URL as a "Get" parameter.

Basically you will store the items to be purchased in a special table and a
shopper ID or cart ID number will be assigned with the first selected item
and needs to be retained to be able to recall the selected items when the
shopper is ready to check out.  A session variable is a good place to store
this id, but it could also be passed in the form as a hidden field.  A
session is also a convenient way of providing a generic storage of the items
to be purchased, separate table is possibly more common.  You don't have to
be too concerned about security up to the point where someone begins to
check out when you begin gathering personal information from the buyer.
Give it some thought, but I suspect in most cases that if someone were to
capture a session at this point, the worse that could happen is they would
both order and pay for the same items.

When you gather personal information it becomes a different matter, and at
this point I would first recomment you consider passing your order items to
a resource like paypal and let them collect the personal information.  If
that is not possible you will want to switch to SSL communication with the
browser before when you present your form for the personal information, and
even in this mode I would recommend that if you detect errors on the forma
and need to represent the form for the buyer to correct info, toss away the
credit card info and have them reenter it.  You do not want to store this in
your session, or anywhere on your system without really secure incryption
(I'm talking about the DB side here, not the SSL channel to the browser).

Once you begin collecting personal information (and this is not limited to
the obvious like social security numbers), you should make sure the session
cannot be hijacked, to prevent identity theft, this is where cookies work so
well.  Anyone who doesn't allow cookies is forcing you into a situation
where you must expose their session information in the URL or a hidden field
on the form where it can be hijacked, in which case I would refuse to have
them as a customer, it's not worth the risk.

Hope this helps,

Warren
 

-Original Message-
From: Kelvin Park [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 17, 2007 3:02 PM
To: php-general@lists.php.net
Subject: [PHP] About Session And Cookies

I am trying to setup a secure login system.
I've heard that if I use just cookies for login, members without cookie
turned out won't be able to see the member pages.

Is using session recommended for e-commerce websites with shopping carts?
Or, using both of them might be more effective in some way.

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



RE: [PHP] About MYSQL/PHP Shopping Cart's Product Quantity Change Input Forms

2007-09-14 Thread Warren Vail

> *The question: "How would you have multiple text input forms (on
> shopping cart page) with different inputted data (product quantities)
> submitted for querying the database (for changing the quantity of
> multiple products in the shopping cart at the same time)?**"*

easy, you can cause multiple text fields on the form with php compatible
array names.  Say you have a list of line items from your cart table and
the record ids (artificial keys of the cart table could be used in the
index).  Here is a sample couple of text fields;





the number 5, 14, and 8 represent the keys of the rows from your cart
table and when you pull the value from the post array after the user
submits the form, of course in addition to the quantities you should
show things like product descriptions and such on the same line as the
quantity text box.

$qtyupdates = $_POST["quantity"];

$qtyupdates above becomes an array with 3 rows in it and the recordd ids
are stored in the index.

A simple foreach loop

Foreach($qtyupdates as $idx => $qty) {
$query = "update cart_table set itemqty = ".$qty
." where cart_lineid = ".$idx;
mysql_query you get the rest
}

your form now becomes a list of line items with quantities in text boxes
for each item, and a single submit button allows you to apply all
changes at once.

Hope this is clear enough,

Warren Vail
Vail Systems Technology
http://www.vailtech.net

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



RE: [PHP] inserting ´ in a db

2007-10-04 Thread Warren Vail
You need to escape the single quote, an easy way to do this is to run the
text thru the addslashes() filter.  Obviously you can't run your entire
query thru the filter thru the filter because most of your quotes need to be
identified by the db.  Here is what I do.

$query = "insert table1(col1, col2, col3) values("
.sprintf("%01d",$intval).", \"".addslashes($stringvalue)."\", "
  ._CONSTANTINTVALUE.") ";

Addslashes makes other troublesome values become harmless as well and can be
used to prevent SQL injection hacks.  If someone injects a SQL query into
your data it will not be processed, but will be stored in the DB string
variable.  Course in this case you need to be careful that if you copy the
table contents you don't then execute the imbedded query.

Hope this helps,

Warren Vail

-Original Message-
From: Yamil Ortega [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 03, 2007 7:45 PM
To: php-general@lists.php.net
Subject: [PHP] inserting ´ in a db

Hi list, good day.

 

I have a simple script that inserts text on a mysql table, that has a field
named description and the type is text.

Everting works fine, except when I try to insert a text that includes a
simple quote. 

For example 

 

Yamil´s car

 

I send the character string to a variable and then insert into a query. But
the mysql says that something is wrong with the query because the quote
after the l looks like the end of the string, and “s car” doesn`t look like
a valid part of the query.

 

Can anyone help me out, how to handle this error?

 

Thanks

Yamil

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



RE: [PHP] inserting ´ in a db

2007-10-04 Thread Warren Vail
Rob,

Your opinion would have meant more had you offered a solution.  The only
hole that I am aware of is the likelihood that the imbedded query could get
executed accidentally later.

If the database is mysql, there is finally a mysql function for filtering
and mysql_real_escape_string(), if I am not mistaken, should render attempts
to store SQL in the database harmless.  For other databases, you should look
for something specific, but for the problem you described, addslashes()
should work just fine.

http://dev.mysql.com/tech-resources/articles/guide-to-php-security-ch3.pdf

Warren 

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 04, 2007 10:28 AM
To: Warren Vail
Cc: 'Yamil Ortega'; php-general@lists.php.net
Subject: RE: [PHP] inserting ´ in a db

On Thu, 2007-10-04 at 10:18 -0700, Warren Vail wrote:
> You need to escape the single quote, an easy way to do this is to run the
> text thru the addslashes() filter.  Obviously you can't run your entire
> query thru the filter thru the filter because most of your quotes need to
be
> identified by the db.  Here is what I do.
> 
> $query = "insert table1(col1, col2, col3) values("
> .sprintf("%01d",$intval).", \"".addslashes($stringvalue)."\", "
> ._CONSTANTINTVALUE.") ";
> 
> Addslashes makes other troublesome values become harmless as well and can
be
> used to prevent SQL injection hacks.  If someone injects a SQL query into
> your data it will not be processed, but will be stored in the DB string
> variable.  Course in this case you need to be careful that if you copy the
> table contents you don't then execute the imbedded query.

AddSlashes() is crap. You have a security hole due to using the improper
escape mechanism for your database.

USE THE CORRECT ESCAPE MECHANISM FOR YOU DATABASE!

Do not ever advocate use of the addSlashes() function for database
queries unless it is the ONLY option available.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
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] file_exists

2007-11-14 Thread Warren Vail
> >>> if (file_exists('/srv/www/../images/pic412.jpg') {

Two left parens, one right, surprised you don't get a syntax error?

Warren Vail

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



RE: [PHP] Can I create flash via php?

2007-11-27 Thread Warren Vail
Have you checked out ming?

http://ming.sourceforge.net/

Warren Vail 

-Original Message-
From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 27, 2007 7:50 PM
To: PHP General list
Subject: [PHP] Can I create flash via php?

I want to create flash animations via a web page. Is it possible? What do I
need. I do not want to use Windows 

bye

Ronald

--
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@lists.php.net

2007-11-30 Thread Warren Vail
I think the risk is that the path shows lots of information about how your
system is configured that is not necessary to transfer the file, so, for
example if uploading something from you My Documents folder on windoz, why
reveal what username you use for system signon, no sense leaving the door
open.

I would suggest you use something like a signed on user name to your site to
organize uploads, and not depend on where a given user stores things on his
system.

Warren Vail

> -Original Message-
> From: Dan [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 30, 2007 4:40 PM
> To: php-general@lists.php.net
> Subject: [PHP] Re: PHP/AJAX File Drag&Drop
> 
> Unfortunatly javascript can't access the filesystem so it can't get
> filenames.  The closest way you could do something like this would be to
> use
> Java (not javascript, totally different).  It's a permissions thing, just
> the way JS and everything else is designed.
> 
> - Dan
> 
> ""Andrei Verovski (aka MacGuru)"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi !
> >
> > Anyone knows PHP/AJAX library which allows to get full path of file
> > dropped
> > into web browser's window area?
> >
> > It is required for document archiving system in order to avoid multiple
> > (or to
> > be more precise, almost endless) usage of "open file" dialogs from the
> > browser.
> >
> > Library should be compatible with Firefox (Lin, Win, Mac), IE and
> Safary.
> >
> >
> > Thanks in advance for any suggestion(s).
> >
> > Andrei
> 
> --
> 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] including parenthesis, space and dashes in a phone number

2007-11-30 Thread Warren Vail

> 
> quite, quite, I was just jesting :-)
> 

Oh good, I'll call back the troups,,

Warren

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



RE: [PHP] including parenthesis, space and dashes in a phone number

2007-11-30 Thread Warren Vail
Not to mention that syntax works in the US, but not large portions of the
rest of the world.  (even with the 1 country code in front).

Warren vail

> -Original Message-
> From: afan pasalic [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 30, 2007 12:03 PM
> To: Daevid Vincent
> Cc: 'php-general'
> Subject: Re: [PHP] including parenthesis, space and dashes in a phone
> number
> 
> It's ok to store it this way, but it could be a little PITA when search.
> E.g., you store (123) 456-7890 and somebody search for 123-456-7890?
> Right?
> 
> -afan
> 
> 
> 
> Daevid Vincent wrote:
> > The kind of opposite of this, is what I use, in that it ADDs the () and
> -
> >
> > if ((strlen($phone)) <= 14) $phone =
> > preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/",
> >   "(\\1) \\2-\\3", $phone);
> >
> >> -Original Message-
> >> From: afan pasalic [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, November 30, 2007 5:45 AM
> >> To: php-general
> >> Subject: [PHP] excluding parenthesis, space and dashes from
> >> phone number
> >>
> >> hi,
> >> I store phone number in mysql as integer, e.g. (123) 456-7890
> >> is stored
> >> as 1234567890.
> >> though, in search form they usually type in a phone number with
> >> parenthesis/space/dashes. I have to extract numbers before I search
> >> through mysql.
> >>
> >> currently, I use eregi_replace() function, several times, to
> >> do the job:
> >> eregi_replace(' ', '', $phone);
> >> eregi_replace('(', '', $phone);
> >> eregi_replace(')', '', $phone);
> >> eregi_replace('-', '', $phone);
> >> and it works fine.
> >>
> >> but, is there any better way? more "fancy"? :)
> >>
> >> thanks for any help.
> >>
> >> -afan
> >>
> >> --
> >> 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] Calling a stored procedure

2007-11-30 Thread Warren Vail
I believe you need to send the call to the stored procedure to the database
as if it were a query, instead of asking PHP to execute it.

HTH,

Warren Vail

> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 30, 2007 10:57 AM
> To: Daniel Brown
> Cc: php-general
> Subject: Re: [PHP] Calling a stored procedure
> 
> I'm not sure if we're on the same page.
> 
> I have a stored procedure on my Informix server. All I am trying to do is
> create a simple form that when submitted will pass several parameters to
> the
> stored procedure and execute it.
> 
> I shouldn't have to pass the head/body/content to the Informix server to
> execute the procedure, right?
> 
> 
> On 11/30/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
> >
> > On Nov 30, 2007 1:39 PM, Dan Shirah <[EMAIL PROTECTED]> wrote:
> > > Hello all,
> > >
> > > I am having soem difficulty when trying to call an INFORMIX stored
> > procedure
> > > with PHP.
> > >
> > > I have verified that the if() condition is true and all of the
> > parameters I
> > > am passing are valid. However, when I run the following:
> > >
> > > if ($num_rows > 0 && $barcode_id == "") {
> > >  echo "The query found ".$num_rows." row(s)";
> > >  $call_procedure = "CALL informix.updt_brcd_id_req('$case',
> > '$event_date',
> > > '$event_sequence', '$event_code')";
> > >  $call_result = $connect_id->query($call_procedure);
> > >  }
> > >
> > > I get this error message: PHP Fatal error: Call to a member function
> > query()
> > > on a non-object
> > >
> > > I have never tried to call a stored procedure in PHP before so I'm not
> > even
> > > sure if I am on the right track.
> > >
> > > Any help is greatly appreciated.
> > >
> > > Dan
> > >
> >
> >You have to first instantiate the class.
> >
> >For example:
> >
> >  > include_once("classes/layout.class.php");
> > $H = new Head();
> > $B = new Body();
> > $P = new Page($H, $B);
> > $H->title("A Sample PHP Page");
> > $H->css("sample.css");
> > $B->content("This is where Dan Shirah's content would go.");
> > $P->render();
> > ?>
> >
> > --
> > Daniel P. Brown
> > [office] (570-) 587-7080 Ext. 272
> > [mobile] (570-) 766-8107
> >
> > If at first you don't succeed, stick to what you know best so that you
> > can make enough money to pay someone else to do it for you.
> >

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



RE: [PHP] including parenthesis, space and dashes in a phone number

2007-11-30 Thread Warren Vail
I did not know that about Windows Letter formatting, well, not all Americans
think everything revolves around the way Americans do things.  Knowing a
little about Microsoft marketing strategy, they probably feel they should
charge extra for providing more flexible formatting.

I do believe a good site designer, will plan for a global market, instead of
a local US one, even if others fail to share his vision.

Warren

> -Original Message-
> From: Jochem Maas [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 30, 2007 1:57 PM
> To: Warren Vail
> Cc: 'afan pasalic'; 'Daevid Vincent'; 'php-general'
> Subject: Re: [PHP] including parenthesis, space and dashes in a phone
> number
> 
> Warren Vail wrote:
> > Not to mention that syntax works in the US, but not large portions of
> the
> > rest of the world.  (even with the 1 country code in front).
> 
> can't remember when that ever stopped an american.
> 
> e.g. Windows print subsystem that shoves 'Letter' format down
> your throat as the default even though the OS knows damn well I'm
> using a european locale.
> 
> >
> > Warren vail
> >
> >> -Original Message-
> >> From: afan pasalic [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, November 30, 2007 12:03 PM
> >> To: Daevid Vincent
> >> Cc: 'php-general'
> >> Subject: Re: [PHP] including parenthesis, space and dashes in a phone
> >> number
> >>
> >> It's ok to store it this way, but it could be a little PITA when
> search.
> >> E.g., you store (123) 456-7890 and somebody search for 123-456-7890?
> >> Right?
> >>
> >> -afan
> >>
> >>
> >>
> >> Daevid Vincent wrote:
> >>> The kind of opposite of this, is what I use, in that it ADDs the ()
> and
> >> -
> >>> if ((strlen($phone)) <= 14) $phone =
> >>> preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-
> 9]{4}).*/",
> >>> "(\\1) \\2-\\3", $phone);
> >>>
> >>>> -Original Message-
> >>>> From: afan pasalic [mailto:[EMAIL PROTECTED]
> >>>> Sent: Friday, November 30, 2007 5:45 AM
> >>>> To: php-general
> >>>> Subject: [PHP] excluding parenthesis, space and dashes from
> >>>> phone number
> >>>>
> >>>> hi,
> >>>> I store phone number in mysql as integer, e.g. (123) 456-7890
> >>>> is stored
> >>>> as 1234567890.
> >>>> though, in search form they usually type in a phone number with
> >>>> parenthesis/space/dashes. I have to extract numbers before I search
> >>>> through mysql.
> >>>>
> >>>> currently, I use eregi_replace() function, several times, to
> >>>> do the job:
> >>>> eregi_replace(' ', '', $phone);
> >>>> eregi_replace('(', '', $phone);
> >>>> eregi_replace(')', '', $phone);
> >>>> eregi_replace('-', '', $phone);
> >>>> and it works fine.
> >>>>
> >>>> but, is there any better way? more "fancy"? :)
> >>>>
> >>>> thanks for any help.
> >>>>
> >>>> -afan
> >>>>
> >>>> --
> >>>> PHP General Mailing List (http://www.php.net/)
> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>
> >>>>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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



RE: [PHP] Banned from #php

2007-12-03 Thread Warren Vail
I always love a good flame war.  A bunch of disrespected patriots running
around trying to prove who has a bigger flame, and punish the persons who
they feel did the disrespecting.  At least no one is calling for the death
of the offender, at least not yet ;-)

Warren

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



RE: [PHP] control browser with tag

2007-12-18 Thread Warren Vail
> i have two pages: list.php and update.php
> 
> list.php will have a hyper link that when click on, it will open a new
> window for user to update info.  once user clicks update button on
> update.php page, i want to close update.php and return to list.php.
> however if user doesn't click update button, i don't want user to go back
> to list.php.  in other word, freeze up list.php until user closes or
> clicks update button on update.php.
> 
> is this possible to do with php?

Yes and no, don't think you intend to, but you may be mixing technologies.
You refer to hyperlinks, etc, which is web technologies and windows, which
is not unless you use javascript or ajax.  With PHP you can cause your
browser to open a new browser by adding target="_blank" to the hyperlink,
but you cannot easily disable functionality of the old browser (It's still
open, just usually covered up by the new browser), and if the user clicks
your hyperlink again a 3rd browser will be opened.  You could name your
target (target=mypage) which means if the user clicks it a new browser will
be opened, and if the user clicks the same link again, a 3rd window will not
be opened, but the page in the "mypage" target will be refreshed. 

HTH,

Warren Vail

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



RE: [PHP] First stupid post of the year.

2008-01-02 Thread Warren Vail
I often identify each of my submit buttons with different names and identify
which one was pressed by;

If(isset($_POST["submit1"]))

Only one will ever be pressed at a time, and that allows me to use the same
page with multiple languages (substituting different values for different
languages).  As you can see I can ignore the value, and submit buttons are
not sent in the form if they are not clicked.

Another option,

Warren Vail

> -Original Message-
> From: Nathan Nobbe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 02, 2008 10:46 AM
> To: tedd
> Cc: PHP General list
> Subject: Re: [PHP] First stupid post of the year.
> 
> On Jan 2, 2008 1:34 PM, tedd <[EMAIL PROTECTED]> wrote:
> 
> > Hi gang:
> >
> > I have a
> >
> > $submit = $_POST['submit'];
> >
> > The string contains:
> >
> >        A       
> >
> > (it's there to make a submit button wider)
> >
> > How can I strip out the " " from the $submit string leaving "A"?
> >
> > I've tried
> >
> >trim($submit);
> >
> > but, that don't work.
> >
> > Neither does:
> >
> >$submit = str_replace(' ','',$submit);
> >
> > or this:
> >
> >$submit = str_replace(' ';','',$submit);
> >
> > I should know what to do, but in this case I don't.
> >
> > Help is always appreciated.
> 
> 
> why dont you just style the button w/ css?
> 
> style="width:200px"
> 
> -nathan

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



RE: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net

2008-01-04 Thread Warren Vail
Hey Dan,

Are you trying to win the prize, below?

warren

> -Original Message-
> From: PostTrack [Dan Brown] [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 04, 2008 2:55 PM
> To: php-general@lists.php.net
> Subject: [PHP] Posting Summary for Week Ending 4 January, 2008: php-
> [EMAIL PROTECTED]
> 
> 
>   Posting Summary for PHP-General List
>   Week Ending: Friday, 4 January, 2008
> 
>   Messages| Bytes   | Sender
>   +-+--
>   4 (100%) 4305 (100%)  EVERYONE
>   2(0.5%)  1100(0.26%)  "Daniel Brown"
> <[EMAIL PROTECTED]>
>   1(0.25%)  1532(0.36%)  "TG"  [EMAIL PROTECTED]>
>   1(0.25%)  1673(0.39%)  "Miren Urkixo"
> <[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] Dependant listboxes

2008-01-10 Thread Warren Vail
There are several ways of doing it and all involve javascript, some more
than others.  Here are some of the problems;
. without javascript the only thing that will cause a form to be submitted
to the server for rebuilding, is clicking a submit button.
. with a minimal amount of javascript you can cause the form to be submitted
to the server when an item is selected from the first pulldown box.
. with javascript and javascript arrays, you can cause one list to "cascade"
to the next without going to the server (maybe).

On your first list if you code something like the following;


Note: the code inside the onChange quotes is actually javascript, but it is
rather minimal, don't you think.

When your form is submitted form variable "firstsel" will have a value, base
on that you can send back to the browser the same form, with the firstsel
list with one item selected, and the filled in second dependent list.
This technique requires a round trip to the server and back for each
selection and is not the best of user experiences, but sometimes it is all
you can do.

Javascript is not too painful, and I would encourage plagerism while you are
learning it.  You can eventually avoid sending the entire form to the server
and retrieving an entire refresh of the page by using AJAX, but even there a
round trip to the server is required (just not the entire form).

You can find lots of useful scripts at http://www.hotscripts.com in their
javascript section, a good place to see different techniques.  Also Google
can be your friend.

HTH,

Warren Vail

> -Original Message-
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 10, 2008 8:48 AM
> To: Humani Power
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Dependant listboxes
> 
> On Jan 10, 2008 11:43 AM, Humani Power <[EMAIL PROTECTED]> wrote:
> > Hi everybody.
> > I have a page with 3 combo box that contains rows from an oracle
> database.
> > What I want to do, is to make those list dependant one from another.
> >
> > Let say that I have the combo boxes on a page1.php, then on change the
> first
> > list box, reload the page1.php and make the selection of the second
> listbox,
> > on change on the second
> > box, the third listbox will be filled. Then, pressing the submit
> > button, I want to go to the
> > page2.php
> >
> > I dont want to use javascript. Does anyone knows where can I find an
> example
> > to implement the dependant lists?
> 
> There's no way to do that without JavaScript (or some other
> client-side scripting - such as WSH, VBSH, AS, or whatever else may be
> available).  In fact, onChange is a client-side command.
> 
> --
> 
> 
> Daniel P. Brown
> Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since 1979.
> 
> --
> 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] Calling All Opinionated ******** ....

2008-02-01 Thread Warren Vail
These things are all on the bleeding edge, and if I'm not mistaken, Zend may
be one of the newest, no?  Extrapolate (Bleeding Edge = painful development)

Warren Vail

> -Original Message-
> From: Jochem Maas [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 01, 2008 1:18 PM
> To: [php] PHP General List
> Subject: [PHP] Calling All Opinionated  
> 
> hi people,
> 
> I'm in the market for a new framework/toolkit/whatever-you-want-to-call-
> it.
> I've been taking a good hard look at the Zend Framework - if nothing else
> the docs
> are very impressive.
> 
> I'd like to hear from people who have or are using ZF with regard to their
> experiences, dislikes, likes, problems, new found fame and fortune, etc
> ... but
> only if it concerns ZF.
> 
> I don't need to hear stuff like 'use XYZ it's great' - finding php
> frameworks/CMS/etc
> is easy ... figuring out which are best of breed is another matter, if
> only because
> it involves reading zillions of lines of code and documentation. besides I
> find that
> you only ever get bitten in the ass by short-comings and bugs when your
> 80% into the
> project that needs to be online yesterday and you knee deep in a nightmare
> requirements
> change or tackling some PITA performance issue.
> 
> so people, roll out your ZF love stories and nightmares - spare no details
> - share the
> knowledge. or something :-)
> 
> tia,
> Jochem
> 
> --
> 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



  1   2   >