Re: [PHP] Can PHP do this? -- w/o using event handler

2008-03-03 Thread Brice
On Mon, Mar 3, 2008 at 8:57 AM, Louie Miranda [EMAIL PROTECTED] wrote:
 Could PHP do..

  1. Connect and send a parameter to a remote host
  2. Wait for the host to reply -- not using event handler
  3. Send XML data to the host

Probably with a socket :
http://php.net/manual/en/ref.sockets.php

  --
  Louie Miranda ([EMAIL PROTECTED])
  http://www.axishift.com

  Security Is A Series Of Well-Defined Steps
  chmod -R 0 / ; and smile :)


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



RE: [PHP] Can PHP do this? -- w/o using event handler

2008-03-03 Thread Bastien Koert

sure, user curl (www.php.net/curl)
 
bastien
 
 
 Date: Mon, 3 Mar 2008 15:57:19 +0800 From: [EMAIL PROTECTED] To: 
 php-general@lists.php.net Subject: [PHP] Can PHP do this? -- w/o using event 
 handler  Could PHP do..  1. Connect and send a parameter to a remote 
 host 2. Wait for the host to reply -- not using event handler 3. Send XML 
 data to the host  --  Louie Miranda ([EMAIL PROTECTED]) 
 http://www.axishift.com  Security Is A Series Of Well-Defined Steps chmod 
 -R 0 / ; and smile :)
_



Re: [PHP] Can PHP do this? -- w/o using event handler

2008-03-03 Thread Richard Lynch
On Mon, March 3, 2008 1:57 am, Louie Miranda wrote:
 Could PHP do..

 1. Connect and send a parameter to a remote host
 2. Wait for the host to reply -- not using event handler
 3. Send XML data to the host

?php
$xml = file_get_contents(/path/to/file.xml);
$s = fsockopen(remote host here);
$reply = fgets($s, 100);
$bytes = fputs($s, $xml);
if ($bytes != ($len = strlen($xml))){
  error_log(Only sent $bytes of $len bytes!);
}
?

You'll need about 3X as much code for proper error checking, but
that's about it, really...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


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



Re: [PHP] Can PHP do this? -- w/o using event handler

2008-03-03 Thread Louie Miranda
Thanks everyone.

I think, I will go with the sockets.

Louie

On Tue, Mar 4, 2008 at 12:36 AM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Mon, March 3, 2008 1:57 am, Louie Miranda wrote:
  Could PHP do..
 
  1. Connect and send a parameter to a remote host
  2. Wait for the host to reply -- not using event handler
  3. Send XML data to the host

 ?php
 $xml = file_get_contents(/path/to/file.xml);
 $s = fsockopen(remote host here);
 $reply = fgets($s, 100);
 $bytes = fputs($s, $xml);
 if ($bytes != ($len = strlen($xml))){
  error_log(Only sent $bytes of $len bytes!);
 }
 ?

 You'll need about 3X as much code for proper error checking, but
 that's about it, really...

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?




-- 
Louie Miranda ([EMAIL PROTECTED])
http://www.axishift.com

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)


Re: [PHP] can PHP do what tie does in Perl?

2005-12-02 Thread Jochem Maas

Bing Du wrote:

Hi,

In Perl, hash can be stored in a file like this:

tie(%contact,'SDBM_File',$tmp_file,O_RDWR|O_CREAT,0666);

How the function should be implemented in PHP if it's possible?


file_put_contents('/path/to/your/file', $someFingArray)



Thanks,

Bing



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



Re: [PHP] can PHP do what tie does in Perl?

2005-12-02 Thread Robert Cummings
On Fri, 2005-12-02 at 09:42, Jochem Maas wrote:
 Bing Du wrote:
  Hi,
  
  In Perl, hash can be stored in a file like this:
  
  tie(%contact,'SDBM_File',$tmp_file,O_RDWR|O_CREAT,0666);
  
  How the function should be implemented in PHP if it's possible?
 
 file_put_contents('/path/to/your/file', $someFingArray)

Shouldn't that be:

file_put_contents('/path/to/your/file', serialize($someFingArray));

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



Re: [PHP] can PHP do what tie does in Perl?

2005-12-02 Thread Jochem Maas

Robert Cummings wrote:

On Fri, 2005-12-02 at 09:42, Jochem Maas wrote:


Bing Du wrote:


Hi,

In Perl, hash can be stored in a file like this:

tie(%contact,'SDBM_File',$tmp_file,O_RDWR|O_CREAT,0666);

How the function should be implemented in PHP if it's possible?


file_put_contents('/path/to/your/file', $someFingArray)



Shouldn't that be:

file_put_contents('/path/to/your/file', serialize($someFingArray));


brain_fart
well I thought so too (its what I wrote originally) but then I reread
the manual and apparently its not necessary - you can shove an array
into file_put_contents() I have no idea what that has as a result but
then I have not idea what tie() does in Perl ... actually I figured
either the OP would notice and go 'er, hows that work?' or not and
do it blindly (and then suffer the potential consequences - which
would hopefully teach him to RTFM)

if some one can write a line like that in Perl, they should be
smart enough to make some kind of attempt in PHP no? I found the OPs
question annoying but couldn't resist answering something so easy ...
then I thought that a short/incomplete answer was probably better than
writing a great big monologue (so I deleted it ;-)
/brain_fart



Cheers,
Rob


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



Re: [PHP] Can PHP do this...?

2002-12-12 Thread @ Edwin
Hello,

1LT John W. Holmes [EMAIL PROTECTED] wrote:

  OK. I think I understand this, but let me ask just to be sure.
 
  So if I setup in my page something to this effect:
  if ($_SERVER['!HTTPS']) {
  echo Switching over to SSL...;
  echo META redirect to SSL;
  } else {
  echo **Rest of Page**;
  }
 
  Would this work? I am about to add a secind site to my site using an
alias
  in Apache. Example is http://www.mysite.com for first site and
  http://www.mysite.com/2ndsite. Except I want everything for the second
 site
  to be https. Make sense?

 if(!isset($_SERVER['HTTPS']))
 { header(Location: https://www.mysite.com/2ndsite;); }

 That should work. Or you could echo the META redirect if you wanted to
 display a page, but this should do it transparently. There is probably a
way
 to do it with just Apache, too, that wouldn't involve PHP.

I think there's some useful info here (about doing it with just Apache):

  http://httpd.apache.org/docs-2.0/ssl/ssl_howto.html

Just in case...

- E

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




RE: [PHP] Can PHP do this...?

2002-12-11 Thread John W. Holmes
 Hello all. I have a question that I hope someone can answer. Is it
 possible
 to determine is someone is hitting your site over SSL or plain http
using
 PHP? If so, is it part of getenv()?

I think it's $_SERVER['HTTPS']. If that is set, then the connection is
over SSL.

---John W. Holmes...

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




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




RE: [PHP] Can PHP do this...?

2002-12-11 Thread Ronald Clark
John, PHP-general,

OK. I think I understand this, but let me ask just to be sure.

So if I setup in my page something to this effect:
if ($_SERVER['!HTTPS']) {
echo Switching over to SSL...;
echo META redirect to SSL;
} else {
echo **Rest of Page**;
}

Would this work? I am about to add a secind site to my site using an alias
in Apache. Example is http://www.mysite.com for first site and
http://www.mysite.com/2ndsite. Except I want everything for the second site
to be https. Make sense?

Thanks again,
Ron Clark


-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, December 11, 2002 11:45 AM
To: Ronald Clark; [EMAIL PROTECTED]
Subject: RE: [PHP] Can PHP do this...?


 Hello all. I have a question that I hope someone can answer. Is it 
 possible to determine is someone is hitting your site over SSL or 
 plain http
using
 PHP? If so, is it part of getenv()?

I think it's $_SERVER['HTTPS']. If that is set, then the connection is over
SSL.

---John W. Holmes...

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




CONFIDENTIALITY NOTICE:



The information contained in this ELECTRONIC MAIL transmission
is confidential.  It may also be privileged work product or proprietary
information. This information is intended for the exclusive use of the
addressee(s).  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution [other
than to the addressee(s)], copying or taking of any action because
of this information is strictly prohibited.





Re: [PHP] Can PHP do this...?

2002-12-11 Thread 1LT John W. Holmes
 OK. I think I understand this, but let me ask just to be sure.

 So if I setup in my page something to this effect:
 if ($_SERVER['!HTTPS']) {
 echo Switching over to SSL...;
 echo META redirect to SSL;
 } else {
 echo **Rest of Page**;
 }

 Would this work? I am about to add a secind site to my site using an alias
 in Apache. Example is http://www.mysite.com for first site and
 http://www.mysite.com/2ndsite. Except I want everything for the second
site
 to be https. Make sense?

if(!isset($_SERVER['HTTPS']))
{ header(Location: https://www.mysite.com/2ndsite;); }

That should work. Or you could echo the META redirect if you wanted to
display a page, but this should do it transparently. There is probably a way
to do it with just Apache, too, that wouldn't involve PHP.

---John Holmes...


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




Re: [PHP] Can PHP do this...?

2002-12-11 Thread Johannes Schlueter
On Wednesday 11 December 2002 19:19, Ronald Clark wrote:
Hi Ronald, hi List,

it isn't

 if ($_SERVER['!HTTPS']) {

but 

if (!isset($_SERVER['HTTPS']) {
  // unsecure
} else {
  //secure
}

You want to check wether the server variable HTTPS is set or not.

johannes

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




RE: [PHP] Can PHP do this...?

2002-12-11 Thread Dave [Hawk-Systems]
John, PHP-general,

OK. I think I understand this, but let me ask just to be sure.

So if I setup in my page something to this effect:
if ($_SERVER['!HTTPS']) {
   echo Switching over to SSL...;
   echo META redirect to SSL;

yuck

recommend insuring this is at the top of your page and using header() instead

appears seamless to the client

   } else {
   echo **Rest of Page**;
   }

and would eliminate that as well

-Start of file--
?PHP
if ($_SERVER['HTTPS']!='on') {
header(Location: https://www.example.com/page.ext;);
exit;
}
# rest of page here since if it isn't secure the page stops at the exit after
the header has been sent to the browser to redirect.
?
-end of file--

Check your particular server response for the match, you may be able to just do;
if (!$_SERVER['HTTPS']) {

Cheers,

Dave










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




Re: [PHP] Can php do this?

2001-11-25 Thread Miles Thompson

I've followed this with interest, but unless you specifically need some 
properties of PHP to do this, use an easier tool.

Python has modules for both MySQL and PHP. They are easily invoked and 
don't involve calling Lynx  feeding it the script.
Here's some code, you might want to think about it as an alternative. I 
hope the indents preserve, as Python reliese on indentation and a CR ends 
it's line.

Miles Thompson


#! /usr/bin/python
Mails Passwords from sub_list, a MySQL database 
import sys, MySQLdb, traceback
import rfc822, string, sys
import smtplib

# MySQLdb allows connection to the MySQL database
# This connects to the database, all parameters must be explicitly named
try:
db = MySQLdb.connect( db='sub_list' )
except:
traceback.print_exc()
sys.exit()
# create connection to the database object
try:
pcursor = db.cursor()
except:
traceback.print_exc()
sys.exit()
#let's display some information
print db.get_host_info()
print db.stat()

#let's fetch our data, mailing to everyone who has not been emailed a password
try:
 pcursor.execute(select * from subscriber where lpasswd_mailed = 0 
and email !='';)
 resultset = pcursor.fetchall()
except:
 traceback.print_exc()
 sys.exit()

#let's build the message
fromaddr = '[EMAIL PROTECTED]'
toaddr = '[EMAIL PROTECTED]'
username = 
password = 

msgFirstPart = Thanks for subscribing. Passwords have been\n\
updated as part of our security schedule to protect your subscription. \n\
Your name and new password are: \n\n

msgEndPart = Please contact us at (555) 555- or 555-5556 for help with 
your subscription, \n\
or email us at [EMAIL PROTECTED]\n\
\n\
Best regards, \n\
John Doe

# we've gotten this far, so let's open the SMTP connection
server = smtplib.SMTP('smtp.domain.com',25)
server.set_debuglevel(2)

# for each record in the cursor
# set toaddr, username and password
# then send the message

# here in the for loop we send the mail message 
#server.sendmail( fromaddr, toaddr, msg, Subject: Your new password )[D

for cursorRecord in resultset:
 toaddr = cursorRecord[ 3 ]
 first_name =First name:  + cursorRecord[ 2 ] + \n
 last_name =Last name:  + cursorRecord[ 1 ] + \n
 password =Password :  + cursorRecord[ 4 ] + \n\n
 msgMail = msgFirstPart + first_name + last_name + password + 
msgEndPart
 print msgMail
 server.sendmail( fromaddr, toaddr, msgMail, Subject: Password for 
ALLnovascotia.com )

 # build the update query
 upd_query = update subscriber set lpasswd_mailed = 1 where email 
=' + cursorRecord[ 3 ] + ';
 try:
 #pcursor.execute( update subscriber set lpasswd_mailed = 
1 where email = c_email;)
 pcursor.execute( upd_query )
 except:
 traceback.print_exc()
 sys.exit()
print \n\n
print All records printed

#close the smpt connection
#server.quit()

# close the database
try:
db.close()
except:
traceback.print_exc()
sys.exit()

# All done
print **30
print 
print mailpass.py completed
print 
print **30


At 02:58 AM 11/25/2001 -0500, you wrote:
Thanks guys

I just want to confirm one last thing, as it's been a while since I needed
cron

After I create this file (cron.file) for ex
and use
crontab cronfile (I do this as root, if it matters)
do permissions need to be set? I really can't recall
I would think that would do it as I am not uploading it
and do it as root

Thanks for the help, GREAT help and it's appreciated

Now I just need to get freetype 2 installed right on my raq 3
and I can live like a king

Joel


-- 
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 php do this?

2001-11-25 Thread Michael Sims

At 09:22 AM 11/25/2001 -0400, Miles Thompson wrote:
I've followed this with interest, but unless you specifically need some 
properties of PHP to do this, use an easier tool.

Python has modules for both MySQL and PHP. They are easily invoked and 
don't involve calling Lynx  feeding it the script.
Here's some code, you might want to think about it as an alternative. I 
hope the indents preserve, as Python reliese on indentation and a CR 
ends it's line.

Thanks for the code!  The easiest way for me personally to learn a new 
language is to think of a task that needs to be done then look at some 
sample code.  I'm not quite ready to learn Python (yet) but I'm saving this 
into the archive for when I'm ready. :)


-- 
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 php do this?

2001-11-24 Thread Michael Sims

At 10:04 PM 11/24/2001 -0500, [EMAIL PROTECTED] wrote:
[snip]
Sort of like cron doing what you would do if you visited
page.php and once it's hit, it emails specified users in a database
Would I need path to php in the cron script to do this?
Or am I just living a dream?

It sure can.  There's a couple of ways to accomplish this.  I personally 
think the easiest way is to code your page like normal, then call it in a 
cron job via lynx.  Let's say you have a page called page.php that 
connects to your database, retrieves the email addresses, and sends the 
emails.  To call it from a cron job add the following to your crontab:

0 8 * * * /usr/bin/lynx -dump http://localhost/page.php  
/path/to/logfile/or/dev/null

Of course this means your script is in your public web space, so 
theoretically could be called by anyone who knew the name of the page.  You 
could put the page in a subdirectory and add an .htaccess file that 
restricts access to only 127.0.0.1 to take care of that if it concerns you.

If you have PHP installed as a CGI then you could also write your page as a 
shell script.  As the first line of your script put the line:

#!path to php -q

I haven't personally used this method because I have PHP installed as an 
apache module and I was too lazy to compile the CGI version.  Using lynx in 
the above configuration works fine for me...


-- 
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 php do this?

2001-11-24 Thread Michael A. Peters

If you have built the php standalone binary then its easy-

#!/usr/local/bin/php
?php
// your php code here
?

What I do when I build php is build it twice. First I build it with all my
options EXCEPT for with-apxs=/blah
That builds the standalone binary, and I install that in /usr/local/bin

Then, I build the apache module and install that where my apache modules
go.
This allows me to use php as a regular unix scripting language, so I can
do stuff from the crontab.

btw- I'm actually doing a very similar thing-
I have some customer support software that pops my support e-mail address
and puts the message in a MySQL database.

I have a cron job that calls a php shell script that pops the e-mail for
me every 15 minutes.
That way I don't have to log on to the support application as often, and
the customers get an automated response fairly quickly, giving them a
unique case ID etc.

On Sat, 24 Nov 2001 22:04:21 EST
[EMAIL PROTECTED] mentioned:

 Thanks for your time . *This* = create follow up autoresponders
 Or at least have php run with cron, so I can daily hit a mysql
 db and use php to email those people at a specified time, like
 every 3 days. Just so when I have users to the site who register
 and their name/email is in a table users in db data, 
 php/cron can be used to pull the name/email from mysql
 and (with unsubscribe message at bottom) email them when I 
 say to do so in cron. Getting cron by itself to work is fine
 but with php script that connects to mysql and emails users?
 Can that be done?
 
 Sort of like cron doing what you would do if you visited
 page.php and once it's hit, it emails specified users in a database
 Would I need path to php in the cron script to do this?
 Or am I just living a dream?
 
 The idea of emailing users in a mysql db with php script
 every day is very appealing to me. (Yes, with unsubscribe feature)
 ;)
 
 Thanks, I hope to goodness this made sense and you
 enjoyed your holiday
 
 Joel
 


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
http://24.5.29.77:10080/

-- 
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 php do this?

2001-11-24 Thread Casey Allen Shobe

On 24 November 2001 23:45, Michael Sims spaketh unto ye recipient:
 It sure can.  There's a couple of ways to accomplish this.  I personally
 think the easiest way is to code your page like normal, then call it in a
 cron job via lynx.  Let's say you have a page called page.php that
 connects to your database, retrieves the email addresses, and sends the
 emails.  To call it from a cron job add the following to your crontab:

 0 8 * * * /usr/bin/lynx -dump http://localhost/page.php 
 /path/to/logfile/or/dev/null

Nice tip!  Another alternative is using wget on the URL, or links -dump if 
you have that instead.

Or if your script has #!/usr/bin/php or whatever path at the top and is made 
executable, you can just call that script without relying on the webserver.

I think, even if it's just a normal php file you could cron it as 
/usr/bin/php scriptpath/name.

-- 
Casey Allen Shobe
[EMAIL PROTECTED]
GCS/CM d+ s+:-+: a-- C++() ULU$ P- L+++ E- W++ N++ !o K- w-- !O
M V- PS++ PE Y+ PGP++ t+ 5+ X R+ tv-- b++ DI+ D G++ e h-(*) r--- z--


-- 
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 php do this?

2001-11-24 Thread Joelmon2001

Thanks guys

I just want to confirm one last thing, as it's been a while since I needed 
cron

After I create this file (cron.file) for ex
and use 
crontab cronfile (I do this as root, if it matters)
do permissions need to be set? I really can't recall
I would think that would do it as I am not uploading it
and do it as root 

Thanks for the help, GREAT help and it's appreciated

Now I just need to get freetype 2 installed right on my raq 3
and I can live like a king

Joel



Re: [PHP] Can PHP do what this javascript does...

2001-10-24 Thread Duncan Hill

On Wed, 24 Oct 2001 [EMAIL PROTECTED] wrote:

 iTo print/i: a href=javascript:if (window.print != null) {
 window.print(); }
  else { alert('Unfortunately, your browser does not support this shortcut.
 Please select Print from the File menu.'); }
 bClick here/b/a ior/i Select bFile/b
 and then bPrint/b from your browser's menu.

 Is there an equivelant bit of code to do this printer shortcut with
 php?

PHP - _server_ side
Javascript - _client_ side

PHP cannot affect your client like Javascript can.

-- 

Sapere aude
My mind not only wanders, it sometimes leaves completely.


-- 
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 PHP do what this javascript does...

2001-10-24 Thread Richard S. Crawford

Unfortunately, since PHP lives on the server and JavaScript lives on the 
browser, there really is no way to get PHP to do what you want.

Stick with JavaScript.  There's really no reason not to when you're doing 
client-side programming.


At 11:14 AM 10/24/2001, [EMAIL PROTECTED] wrote:
iTo print/i: a href=javascript:if (window.print != null) {
window.print(); }
  else { alert('Unfortunately, your browser does not support this shortcut.
Please select Print from the File menu.'); }
bClick here/b/a ior/i Select bFile/b
and then bPrint/b from your browser's menu.

Is there an equivelant bit of code to do this printer shortcut with php?

--
Chip Wiegand
Computer Services
www.simradusa.com
[EMAIL PROTECTED]
Simrad, Inc
Lynnwood, WA
425-712-1138

There is no reason anyone would want a computer in their home.
  --Ken Olson, president, chairman and founder of Digital Equipment Corp.,
1977
   (-- Then why do I have nine? Somebody help me!)


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


Sliante,
Richard S. Crawford

http://www.mossroot.com
mailto:[EMAIL PROTECTED]
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
It is only with the heart that we see rightly; what is essential is 
invisible to the eye.  --Antoine de Saint Exupéry

Push the button, Max!


--
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 PHP do what this javascript does...

2001-10-24 Thread Mike Frazer

Javascript can be embedded in PHP files anyway.  I do a lot of database
management interfaces in PHP and one thing I want to do is protect items
from being accidentally deleted.  I use Javascript to verify that they
intended to click on the link to delete the information.

Remember, PHP files are enhanced HTML files, which means the browser will
parse them exactly the same as a standard HTML file.

Mike Frazer





Richard S. Crawford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Unfortunately, since PHP lives on the server and JavaScript lives on the
browser, there really is no way to get PHP to do what you want.

Stick with JavaScript.  There's really no reason not to when you're doing
client-side programming.


At 11:14 AM 10/24/2001, [EMAIL PROTECTED] wrote:
iTo print/i: a href=javascript:if (window.print != null) {
window.print(); }
  else { alert('Unfortunately, your browser does not support this shortcut.
Please select Print from the File menu.'); }
bClick here/b/a ior/i Select bFile/b
and then bPrint/b from your browser's menu.

Is there an equivelant bit of code to do this printer shortcut with php?

--
Chip Wiegand
Computer Services
www.simradusa.com
[EMAIL PROTECTED]
Simrad, Inc
Lynnwood, WA
425-712-1138

There is no reason anyone would want a computer in their home.
  --Ken Olson, president, chairman and founder of Digital Equipment Corp.,
1977
   (-- Then why do I have nine? Somebody help me!)


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


Sliante,
Richard S. Crawford

http://www.mossroot.com
mailto:[EMAIL PROTECTED]
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
It is only with the heart that we see rightly; what is essential is
invisible to the eye.  --Antoine de Saint Exupéry

Push the button, Max!




-- 
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 PHP do what this javascript does...

2001-10-24 Thread Mike Eheler

There's a really long method of doing it that would work, but would 
involve server-side browser detection, and a database containing a list 
of browsers that support print shortcuts.

Stick with the JS.

Mike

[EMAIL PROTECTED] wrote:

iTo print/i: a href=javascript:if (window.print != null) {
window.print(); }
 else { alert('Unfortunately, your browser does not support this shortcut.
Please select Print from the File menu.'); }
bClick here/b/a ior/i Select bFile/b
and then bPrint/b from your browser's menu.

Is there an equivelant bit of code to do this printer shortcut with php?

--
Chip Wiegand
Computer Services
www.simradusa.com
[EMAIL PROTECTED]
Simrad, Inc
Lynnwood, WA
425-712-1138

There is no reason anyone would want a computer in their home.
 --Ken Olson, president, chairman and founder of Digital Equipment Corp.,
1977
  (-- Then why do I have nine? Somebody help me!)





-- 
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 PHP do what this javascript does...

2001-10-24 Thread chip . wiegand

Thanks for all the reponses. I know that php is server-side only, and that
certain things
like mouse-overs, are client-side, wasn't sure about the printer function
though. I could
have assumed it was, but I try not to assume anything, but always ask to
make sure.

Regards,
Chip





Mike Eheler [EMAIL PROTECTED] on 10/24/2001 10:31:30 PM
Internet mail from:
To:   [EMAIL PROTECTED]
cc:   [EMAIL PROTECTED]

Subject:  Re: [PHP] Can PHP do what this javascript does...


There's a really long method of doing it that would work, but would
involve server-side browser detection, and a database containing a list
of browsers that support print shortcuts.

Stick with the JS.

Mike

[EMAIL PROTECTED] wrote:

iTo print/i: a href=javascript:if (window.print != null) {
window.print(); }
 else { alert('Unfortunately, your browser does not support this shortcut.
Please select Print from the File menu.'); }
bClick here/b/a ior/i Select bFile/b
and then bPrint/b from your browser's menu.

Is there an equivelant bit of code to do this printer shortcut with php?

--
Chip Wiegand
Computer Services
www.simradusa.com
[EMAIL PROTECTED]
Simrad, Inc
Lynnwood, WA
425-712-1138

There is no reason anyone would want a computer in their home.
 --Ken Olson, president, chairman and founder of Digital Equipment Corp.,
1977
  (-- Then why do I have nine? Somebody help me!)











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