[PHP] POPUP window in PHP

2006-10-09 Thread Captain

hi,
i want to do YES/NO confirmation (like POPUP). If YES, it will upload a file
into server. Otherwise, it won't do anything.
In JavaScript, i can get using confirm(); But i am not able to do
manipulation from that javascript variable.

My Code(partial):

?
if (file_exists($fullPath)) {
echo ;
   $decide=??php;

# It is Printing either 0 or 1. But I can't able to manipulate further. For
eg, i can't do like the following,   

   if ($decide) {
   // Upload
   } else {
   // Don't Upload
   }
}

Please help me reg this..Please provide some solution for this..Thanks in
advance.

---Prabhakaran
-- 
View this message in context: 
http://www.nabble.com/POPUP-window-in-PHP-tf2408946.html#a6714594
Sent from the PHP - General mailing list archive at Nabble.com.


Re: [PHP] POPUP window in PHP

2006-10-09 Thread Max Belushkin

Captain wrote:

hi,
i want to do YES/NO confirmation (like POPUP). If YES, it will upload a file


PHP is server-side, not client-side. You can have the confirmation 
passed as a GET variable in a two-step process for example, i.e. first 
show a confirmation form if $_GET[confirm] is not set, else check 
$_GET[confirm] and process the uploaded file.


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



Re: [PHP] POPUP window in PHP

2006-10-09 Thread Captain

hi dude,
actually, i am new to php. i am not understanding clearly. plz explain it
clearly. 
My requirement is, i want to upload one file. i am checking whether it
exists or not in Server side.
If it exists, i am popping up a window that Do u want to have Duplication
of this file?.If YES, i sud upload. otherwise i sud giveup.
In script update part if once u uploaded one script from your PC (client)
and after some time u r editing or making change to the file(client). and
wish to put into that then it will ask for duplicate. that part you need to
think. 

Please reply to me.
Thanks again.
Prabhakaran



Max Belushkin wrote:
 
 Captain wrote:
 hi,
 i want to do YES/NO confirmation (like POPUP). If YES, it will upload a
 file
 
 PHP is server-side, not client-side. You can have the confirmation 
 passed as a GET variable in a two-step process for example, i.e. first 
 show a confirmation form if $_GET[confirm] is not set, else check 
 $_GET[confirm] and process the uploaded file.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/POPUP-window-in-PHP-tf2408946.html#a6715723
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] POPUP window in PHP

2006-10-09 Thread Max Belushkin

Captain wrote:

My requirement is, i want to upload one file. i am checking whether it
exists or not in Server side.


Your script will have to work in stages, generating a page and sending 
to the browser on each stage:
1. Make a form to upload a file for the user to submit - this is just 
ordinary HTML.
2. Once the form is submitted to your script, process the file: check if 
it already exists. If it does not, just move the file to a permanent 
location and go to step 4. If it does, move it a temporary location on 
the server, and generate a page with a second form, asking the user 
whether they want the file replaced.
3. Once the form from step 2 is submitted, if the file is to be 
replaced, move the file from its temporary location to the permanent 
location.

4. Generate a page saying the operation went through fine.

  For a reference on file uploads, check the online documentation:
http://www.php.net/manual/en/features.file-upload.php

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



Re: [PHP] POPUP window in PHP

2006-10-09 Thread Richard Lynch
On Mon, October 9, 2006 6:22 am, Captain wrote:
 hi dude,
 actually, i am new to php. i am not understanding clearly. plz explain
 it
 clearly.

You can't do what you want.

More importantly, you should not even WANT to do what you want!

There are several reasons for this, and they are rather subtle, and
require a mind-shift in your thinking.

The first thing you MUST get used to is that the SERVER where your PHP
script lives is VERY far away, in all respects, from the CLIENT where
your user sits and the POPUP appears.

PHP can't be involved in the POPUP because it's nowhere near that
popup -- PHP spits out the HTML and Javascript and then PHP is *gone*

The second reason you do NOT want to do this is this:
Suppose you could even make it work -- Throw in some AJAX-y Web2.0
thingie that checked back to the server every 2 seconds to make sure I
put in a different filename.  Fine.

You *still* have a BIG PROBLEM in that you are, almost for sure,
dealing with a web application where ANOTHER user can upload the same
file name in between your check and when the upload is actually done:

Imagine 2 users working at the same time:
User 1 User 2
Check A.txt: OKCheck A.txt: OK
Upload A.txt   Upload A.txt

As you can see, only one of the users is going to win this race --
when they each checked if the name was already taken, everything was
fine.  But once they upload, one of them will be first and get the
name, and the second will either overwrite the first, or it will get
rejected anyway.

So you might as well not try to do any of this until the user actually
uploads -- And you do NOT need to store their filename exactly as they
used it.  You can just add a digit to make it unique.  Or you can put
each user's files in their own directory to reduce conflicts.

There are many ways to solve this, but, ultimately, you have to
check the filename in such a way that you do NOT introduce a Race
Condition.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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



[PHP] popup window from php page

2006-06-08 Thread William Stokes
Hello,

How do I open a popup window from php code when a web page is loaded? Does 
it require javascript usage?

Thanks
-Will 

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



Re: [PHP] popup window from php page

2006-06-08 Thread Rabin Vincent

On 6/8/06, William Stokes [EMAIL PROTECTED] wrote:

How do I open a popup window from php code when a web page is loaded? Does
it require javascript usage?


Yes, this needs to be done with Javascript. Google will
help you on this.

Rabin

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



Re: [PHP] popup window from php page

2006-06-08 Thread Andrei


	What PHP does is it outputs HTML code as result. Any other 
functionality regarding browser commands (such as opening popups) are 
done using javascript.


Andy

William Stokes wrote:

Hello,

How do I open a popup window from php code when a web page is loaded? Does 
it require javascript usage?


Thanks
-Will 



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



[PHP] popup window under php

2001-10-04 Thread Tim Sawyer

I want to open a popup window under php control. So lets say I have an 
if statement which if true opens the window.

if ($something) {
JavaScript:window.open(test.php,blah...);
}

Guess I'm saying that I want to call a Javascript function without the 
user clicking on anything.


-- 
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] popup window under php

2001-10-04 Thread Naintara Jain

You have the same requirement

Put this wherever you want in your script.

?php
 if (true)  // whatever the condition
 {
 echo script language=JavaScript
alert('Message!') /script;
 }
 ?


- Original Message -
From: Eduardo Kokubo [EMAIL PROTECTED]
To: Naintara Jain [EMAIL PROTECTED]
Sent: Thursday, October 04, 2001 4:56 PM
Subject: Re: [PHP] something like alert (javascript)


This is probably the best solution. I'll try something like this. Thanks.

- Original Message -
From: Naintara Jain [EMAIL PROTECTED]
To: Eduardo Kokubo [EMAIL PROTECTED]
Sent: Thursday, October 04, 2001 8:19 AM
Subject: Re: [PHP] something like alert (javascript)


 You could try:
 ?php
 if (files  4)  // whatever the condition
 {
 echo script language=JavaScript
alert('Unfinished business!') /script;
 }
 ?
 -Naintara

 - Original Message -
 From: Eduardo Kokubo [EMAIL PROTECTED]
 To: Maxim Maletsky (PHPBeginner.com) [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, October 04, 2001 4:45 PM
 Subject: Re: [PHP] something like alert (javascript)


 I'm implementing a system that allows the users create pages on-line. They
 can create several different pages to complete a site. What I want to do
is
 alert them that there are still pages to be created before they finish.
I'm
 trying to do it checking the files they create and alerting a message, but
I
 think javascript can not check the files and php can not alert the user
with
 a function like alert(). I'm using a simple print() (PHP) but alert()
would
 be much better.

 - Original Message -
 From: Maxim Maletsky (PHPBeginner.com) [EMAIL PROTECTED]
 To: 'Eduardo Kokubo' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Wednesday, October 03, 2001 11:38 AM
 Subject: RE: [PHP] something like alert (javascript)


  Then what do you need?
 
  We are not any sure on what your question is ...
 
  Maxim Maletsky
  www.PHPBeginner.com
 
 
  -Original Message-
  From: Eduardo Kokubo [mailto:[EMAIL PROTECTED]]
  Sent: mercoledì 3 ottobre 2001 16.31
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: [PHP] something like alert (javascript)
 
 
  Is there any function in PHP that is similar to alert() or confirm() of
  javascript ? I tried die() but that's not what I need.


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




- Original Message -
From: Tim Sawyer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 05, 2001 12:46 AM
Subject: [PHP] popup window under php


I want to open a popup window under php control. So lets say I have an
if statement which if true opens the window.

if ($something) {
JavaScript:window.open(test.php,blah...);
}

Guess I'm saying that I want to call a Javascript function without the
user clicking on anything.


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