php-general Digest 9 Oct 2006 12:30:31 -0000 Issue 4391

Topics (messages 242831 through 242839):

Re: Apply the hyper link ( javascript functon ) with php
        242831 by: J R
        242838 by: edwardspl.ita.org.mo

Re: guess documentroot
        242832 by: Ivo F.A.C. Fokkema

Re: FTP
        242833 by: Chris

ereg_replace with unser defined function?
        242834 by: Frank Arensmeier
        242839 by: Roman Neuhauser

POPUP window in PHP
        242835 by: Captain
        242836 by: Max Belushkin
        242837 by: Captain

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
echo '<a href="javascript:popup(\'index.htm\')"> Test </a>';

On 10/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Dear All,

How to apply the following function with php ?
<a href=javascript:popup('index.htm')> Test </a>

Edward.

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




--
GMail Rocks!!!

--- End Message ---
--- Begin Message ---
Hello,

Sorry...

If the hyper link is :
<a href=javascript:popup('/$dir/index.htm')> Test </a>

So, how to apply the echo tag for it ?

Remark:
$dir is php variable...

Edward.


J R wrote:

> echo '<a href="javascript:popup(\'index.htm\')"> Test </a>';
>
> On 10/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>>
>> Dear All,
>>
>> How to apply the following function with php ?
>> <a href=javascript:popup('index.htm')> Test </a>
>>
>> Edward.
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>

--- End Message ---
--- Begin Message ---
On Thu, 05 Oct 2006 16:35:04 +0200, Javier Ruiz wrote:

> Perfect!
> 
> got it using the following:
> 
> /* 1 - remove the query string just in case it contains a '/' in it
>    2 - like Clive said, substr() and strrpos() 'clean' the path to provide
> the directories only */
> 
> $aPath = str_replace($_REQUEST['QUERY_STRING'], '',
> $_SERVER['SCRIPT_NAME']);
> $aPath = substr($aRuta, 0, (strrpos($aRuta, '/') + 1));
> 
> Thanks a lot guys :)

Why make your life harder than it needs to be:

$sPath = dirname($_SERVER['PHP_SELF']);

Ivo

--- End Message ---
--- Begin Message ---
Stut wrote:
Raphael Martins wrote:
I will be sending files over my php script... One client asked me for a
project where he allow clients to send some large files (like 50mb)...I
thought that FTP (via PHP)  will allow that.

Today he just give the FTP server user and password to his clients, but he
is worried about the security (of course!). Is there a better way? I was
thinking in split the files in several .RAR volumes... (actually, the client will send his .RAR files instead of a 50mb file), and use remote scripting
to upload each file separatly.

Eww, nasty.

Any Ideas?

Set the upload_max_filesize value for the directory where the upload script lives. That would be the cleanest way to allow this to happen.

However, HTTP was not designed for uploading files of that size so you are better off using an FTP server - this would almost certainly not involve PHP at all. If security is a concern you could generate a temporary FTP user from a PHP script that will get removed after, say, 24 hours. How you would do this will vary depending on the FTP server you are using.

You could also set the ftp account up to be locked into a particular folder.. so if anyone got access to it, they would only see the .rar files and nothing else.

Easily done depending on which ftp server you are using but that's way out of scope for this mailing list.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hello all.

Is it possible to have a user defined function for the replacement within an ereg_replace (like preg_replace_callback)? I am working on a script that converts html pages with metric data into imperial data. My script takes text strings containing one or more instances of e.g. "123 mm", "321 mm", "123 kg", "123 cm2" and so on. The script searches the string with a pattern like:
"([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm)"

When the script finds an instance, it stores the matches into an array - ereg ( $pattern, $textstring, $matches )

The replacement (for mm) looks like:
round ( ( $matches[1] * 0.039370079 ), 1 ) . $matches[2]  . "in"

Everything is working great accept when the string contains more than one instance for example of the metric unit mm. In that case, all instances of "xy mm" will be replaced with the first occurrence.

So, a text like:

"The product is 230 mm tall, 120 mm thick and 340 mm wide" will output as "The product is 9.1 in tall, 9.1 in thick and 9.1 in wide" - because the replacement string is based / calculated on the first occurrence 230 mm.

Alternatively, is there a way to limit ereg_replace to only replace one instance at a time?

Hopefully I am not too confusing...

regards,

/frank

ps. of course I have searched the manual and asked Google - no luck ds.


--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-10-09 09:46:01 +0200:
> Is it possible to have a user defined function for the replacement  
> within an ereg_replace (like preg_replace_callback)? I am working on  
> a script that converts html pages with metric data into imperial  
> data. My script takes text strings containing one or more instances  
> of e.g. "123 mm", "321 mm", "123 kg", "123 cm2" and so on. The script  
> searches the string with a pattern like:
> "([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm)"

    your pattern is valid PCRE AFAICS. why don't you just use
    preg_replace_callback? it's faster, more capable...

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.

--- End Message ---

Reply via email to