php-general Digest 25 Oct 2007 01:44:01 -0000 Issue 5090

Topics (messages 263595 through 263627):

FINDER
        263595 by: Emiliano Boragina
        263597 by: David Giragosian

Re: EMPTY??
        263596 by: Chen Lei

file_exists, is_readable & effective UID/GID
        263598 by: Manuel Vacelet
        263599 by: Daniel Brown
        263618 by: Jim Lucas

help with code not wrking
        263600 by: Joey
        263601 by: Instruct ICC

Question about time...
        263602 by: Jason Pruim
        263604 by: Daniel Brown
        263605 by: Jason Pruim
        263606 by: Richard Heyes
        263607 by: Daniel Brown
        263610 by: Jason Pruim
        263620 by: Instruct ICC
        263621 by: Daniel Brown
        263623 by: Bastien Koert
        263625 by: tedd

Can a PHP script process a file on a remote computer?
        263603 by: Jon Westcot
        263608 by: Andrew Ballard
        263609 by: Wolf
        263611 by: Jon Westcot
        263612 by: Jon Westcot
        263613 by: Vo, Lance
        263614 by: Jon Westcot
        263617 by: Andrew Ballard
        263622 by: Edward Vermillion

Multiple asynchronous requests (ajax)
        263615 by: Philip Thompson

output-buffer and memory-issue
        263616 by: Werner Schneider

Multiple asynchronous requests (ajax) [SOLVED]
        263619 by: Philip Thompson

register globals not working
        263624 by: Rodney Courtis
        263626 by: Chris

system command
        263627 by: Ronald Wiplinger

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 ---
Hi everyone.

 

I need to know how do I do a FINDER of clinics for zones.

I am new in PHP, so my knowloge is not much.

The user of this finder select the zone from the list, and click in the
button, and them show a list of clinic with its data info (name, address,
phones, etc)

 

Thanks a lot!

Emiliano

 

 

 


--- End Message ---
--- Begin Message ---
On 10/24/07, Emiliano Boragina <[EMAIL PROTECTED]> wrote:
>
> Hi everyone.
>
>
>
> I need to know how do I do a FINDER of clinics for zones.
>
> I am new in PHP, so my knowloge is not much.
>
> The user of this finder select the zone from the list, and click in the
> button, and them show a list of clinic with its data info (name, address,
> phones, etc)
>
>
>
> Thanks a lot!
>
> Emiliano


Emiliano,

Some questions to begin:

1. Do you already have the clinic data?
2. If yes, in what form is it stored ( flat file? database? )
3. How much knowledge of html/javascript, etc... do you have?

David

--- End Message ---
--- Begin Message ---
Can you show us the form tag of your php file(html code)?

Dan Shirah 写道:
doing a var_dump($_POST['comments'];

returns  string(0) ""

So the value of $comments in $comments = $_POST['comments']; SHOULD be equal
to 0 or "", right?

In which case when I do my original:

if (!empty($comments)) {
  echo "Do Something";
}

It SHOULD just bypass that and continue with my code, but instead it gives
me the error, "Changed database context to Database."


On 10/23/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
On 10/23/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
I made two variables for the same posted value because I believe empty()
does not work with strtoupper in front of the value. It only works with
a
standalone variable, correct?
no; strtoupper modifies its argument, that is all.
empty evaluates the argument it is given that is all.
therefore, if empty is passed an string with no contents that has been
passed through
strtoupper, it will still be regarded as empty.

<?php
    $var = strtoupper('');
     if(empty($var)) { echo 'var is empty'; }
?>



When comments is left blank and I echo out the value for $check_comments
it
returns nothing at all which is why I think empty() or "" should work,
but
they don't.
try using var_dump(); you will see that it is a string that has no
contents, or perhaps some
whitespace characters.


-nathan





--- End Message ---
--- Begin Message ---
Hi all,

file_exists and is_readable perfom there test with real UID/GID.
Is there any functions that tests file existance with effective UID/GID ?

Note: stat is not an option because it raises an E_WARNING if the file
is not readable.

Thanks,
Manuel

--- End Message ---
--- Begin Message ---
On 10/24/07, Manuel Vacelet <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> file_exists and is_readable perfom there test with real UID/GID.
> Is there any functions that tests file existance with effective UID/GID ?
>
> Note: stat is not an option because it raises an E_WARNING if the file
> is not readable.
>
> Thanks,
> Manuel
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    That's what you have things like <? ini_set("display_errors", "off"); ?>

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished....

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
On 10/24/07, Manuel Vacelet <[EMAIL PROTECTED]> wrote:
Hi all,

file_exists and is_readable perfom there test with real UID/GID.
Is there any functions that tests file existance with effective UID/GID ?

Note: stat is not an option because it raises an E_WARNING if the file
is not readable.

Thanks,
Manuel

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



    That's what you have things like <? ini_set("display_errors", "off"); ?>


what about doing it like this?

<?php

$filename = __FILE__;

$stat_info = @stat($filename);

if ( $stat_info ) {
        // do something...
}

The '@' will suppress the E_WARNING notice
if stat fails the condition will fail.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
Hi all,

 

I have inherited a problem script from a client, and it's a simple upload
function.

The problem is that while the image is being uploaded and saved as the same
name it was uploaded as, it's not writing to the table the file name for
display reference so it's like there is no picture.

 

I appreciate any help you can provide.

 

Thanks!


Joey

 

 

 

include ("sesion_admin.php");

include("../contentdb.php");

 

$res_state=mysql_query("select * from states where 1 order by state");

$id = $_GET["id"];

 

echo "ID: " . $id . "IDL: " . $local_id . "   Photo: " . $userfile . " [B4
Upload]<br>";

 

$p_proceso = $_POST["p_proceso"];

 

if($p_proceso=="borrar"){

 

$query_editar ="update Basic_Info set photo='' where Id=$id ";

mysql_query($query_editar);

}

 

if($p_proceso=="upload"){

 

 

$UPLOAD = fopen($userfile, "r" );

$contents = fread($UPLOAD,$userfile_size);

fclose($UPLOAD);

$SAVEFILE = fopen("../photos/".$userfile, "wb" );

fwrite( $SAVEFILE, $contents,$userfile_size);

fclose( $SAVEFILE );

 

 

#$query_editar ="update Basic_Info set photo='$userfile' where Id=$id ";

mysql_query($query_editar);

}

--- End Message ---
--- Begin Message ---
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Date: Wed, 24 Oct 2007 15:27:28 -0400
> Subject: [PHP] help with code not wrking 
> 
> Hi all,
> 
>  
> 
> I have inherited a problem script from a client, and it's a simple upload
> function.
> 
> The problem is that while the image is being uploaded and saved as the same
> name it was uploaded as, it's not writing to the table the file name for
> display reference so it's like there is no picture.
> 
>  
> 
> I appreciate any help you can provide.
> 
>  
> 
> Thanks!
> 
> 
> Joey
> 
>  
> 
>  
> 
>  
> 
> include ("sesion_admin.php");
> 
> include("../contentdb.php");
> 
>  
> 
> $res_state=mysql_query("select * from states where 1 order by state");
> 
> $id = $_GET["id"];
> 
>  
> 
> echo "ID: " . $id . "IDL: " . $local_id . "   Photo: " . $userfile . " [B4
> Upload]<br>";
> 
>  
> 
> $p_proceso = $_POST["p_proceso"];
> 
>  
> 
> if($p_proceso=="borrar"){
> 
>  
> 
> $query_editar ="update Basic_Info set photo='' where Id=$id ";
> 
> mysql_query($query_editar);
> 
> }
> 
>  
> 
> if($p_proceso=="upload"){
> 
>  
> 
>  
> 
> $UPLOAD = fopen($userfile, "r" );
> 
> $contents = fread($UPLOAD,$userfile_size);
> 
> fclose($UPLOAD);
> 
> $SAVEFILE = fopen("../photos/".$userfile, "wb" );
> 
> fwrite( $SAVEFILE, $contents,$userfile_size);
> 
> fclose( $SAVEFILE );
> 
>  
> 
>  
> 
> #$query_editar ="update Basic_Info set photo='$userfile' where Id=$id ";
> 
> mysql_query($query_editar);
> 
> }

What is "$userfile"?
Are you using "$_FILES"? http://php.he.net/manual/en/features.file-upload.php
$_FILES['userfile']['name']
        The original name of the file on the client machine.
       $_FILES['userfile']['tmp_name']
        The temporary filename of the file in which the uploaded file
        was stored on the server.
       
And don't forget to set the HTML form tag's enctype="multipart/form-data"
_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last.  Get it 
now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033

--- End Message ---
--- Begin Message ---
Hi Everyone,

I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :)

I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic?

I'm attempting to be able to make small changes to my website without having to remember to do them or change them :)

I hope I've made enough sense that someone can point me in the right direction :)

Thanks for looking!

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
On 10/24/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I am attempting to get the logic of something figured out and I
> thought someone might be able to confirm what I'm thinking :)
>
> I want to be able to display something like an image of a turkey
> during the month of november from now until I'm dead. I was playing
> around with mktime and it showed very different time stamps for
> 11/1/07 and 11/1/08 so I can't set it to compare specifically to the
> timestamp.. But, would I be able to have it evaluate the string
> stored in php as 11/1/07 and create a timestamp to compare todays
> date to, and if it matches within the month, have it display the
> turkey? and if not, have it display a different graphic?
>
> I'm attempting to be able to make small changes to my website without
> having to remember to do them or change them :)
>
> I hope I've made enough sense that someone can point me in the right
> direction :)
>
> Thanks for looking!
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
>
>


<?
if(date("M") == "11") {
    // Display turkey
}
?>

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished....

--- End Message ---
--- Begin Message --- Errr... Never mind... Soon as I hit send I got a brain storm... I just do this:

<?PHP

$month = date('m');
if ($month == "11"){
        echo "turkey";
}else{
        echo "No turkey";
        
}
?>

Or something similar, I'll try and feather it out and see how it works for multiple holidays :) (IE: Thanksgiving, Christmas, New Years, Halloween etc. etc.)



On Oct 24, 2007, at 3:57 PM, Jason Pruim wrote:

Hi Everyone,

I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :)

I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic?

I'm attempting to be able to make small changes to my website without having to remember to do them or change them :)

I hope I've made enough sense that someone can point me in the right direction :)

Thanks for looking!

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :)

I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic?

I'm attempting to be able to make small changes to my website without having to remember to do them or change them :)

I hope I've made enough sense that someone can point me in the right direction :)

Well, I hope this makes sense:

<?php
    if (date('m') == 11) {
        echo '<img src="turkey.png" />';
    }
?>

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

--- End Message ---
--- Begin Message ---
On 10/24/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On 10/24/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> > Hi Everyone,
> >
> > I am attempting to get the logic of something figured out and I
> > thought someone might be able to confirm what I'm thinking :)
> >
> > I want to be able to display something like an image of a turkey
> > during the month of november from now until I'm dead. I was playing
> > around with mktime and it showed very different time stamps for
> > 11/1/07 and 11/1/08 so I can't set it to compare specifically to the
> > timestamp.. But, would I be able to have it evaluate the string
> > stored in php as 11/1/07 and create a timestamp to compare todays
> > date to, and if it matches within the month, have it display the
> > turkey? and if not, have it display a different graphic?
> >
> > I'm attempting to be able to make small changes to my website without
> > having to remember to do them or change them :)
> >
> > I hope I've made enough sense that someone can point me in the right
> > direction :)
> >
> > Thanks for looking!
> >
> > --
> >
> > Jason Pruim
> > Raoset Inc.
> > Technology Manager
> > MQC Specialist
> > 3251 132nd ave
> > Holland, MI, 49424
> > www.raoset.com
> > [EMAIL PROTECTED]
> >
> >
> >
>
>
> <?
> if(date("M") == "11") {
>     // Display turkey
> }
> ?>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
> Give a man a fish, he'll eat for a day.  Then you'll find out he was
> allergic and is hospitalized.  See?  No good deed goes unpunished....
>

    Sorry, that should've been a lower-case M.

<?
if(date("m") == "11") {
    // Display turkey
}
?>

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished....

--- End Message ---
--- Begin Message ---

On Oct 24, 2007, at 4:09 PM, Richard Heyes wrote:

I am attempting to get the logic of something figured out and I thought someone might be able to confirm what I'm thinking :) I want to be able to display something like an image of a turkey during the month of november from now until I'm dead. I was playing around with mktime and it showed very different time stamps for 11/1/07 and 11/1/08 so I can't set it to compare specifically to the timestamp.. But, would I be able to have it evaluate the string stored in php as 11/1/07 and create a timestamp to compare todays date to, and if it matches within the month, have it display the turkey? and if not, have it display a different graphic? I'm attempting to be able to make small changes to my website without having to remember to do them or change them :) I hope I've made enough sense that someone can point me in the right direction :)

Well, I hope this makes sense:

<?php
    if (date('m') == 11) {
        echo '<img src="turkey.png" />';
    }
?>
Yeah... The joys of dealing with a cold that makes your head feel like it wants to explode and you just wish it would so it would feel better :)

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> I want to be able to display something like an image of a turkey  
> during the month of november from now until I'm dead.

And how will the application know when you are dead?

_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last.  Get it 
now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033

--- End Message ---
--- Begin Message ---
On 10/24/07, Instruct ICC <[EMAIL PROTECTED]> wrote:
>
> > I want to be able to display something like an image of a turkey
> > during the month of november from now until I'm dead.
>
> And how will the application know when you are dead?
>
> _________________________________________________________________
> Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it 
> now.
> http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033


<?
    echo "</LIFE>\n";
    die($jason);
?>

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished....

--- End Message ---
--- Begin Message ---
what about 

if (date("m") == 11){ 
  echo "";
}



bastien





----------------------------------------> To: [EMAIL PROTECTED]> From: [EMAIL 
PROTECTED]> Date: Wed, 24 Oct 2007 15:57:38 -0400> Subject: [PHP] Question 
about time...>> Hi Everyone,>> I am attempting to get the logic of something 
figured out and I> thought someone might be able to confirm what I'm thinking 
:)>> I want to be able to display something like an image of a turkey> during 
the month of november from now until I'm dead. I was playing> around with 
mktime and it showed very different time stamps for> 11/1/07 and 11/1/08 so I 
can't set it to compare specifically to the> timestamp.. But, would I be able 
to have it evaluate the string> stored in php as 11/1/07 and create a timestamp 
to compare todays> date to, and if it matches within the month, have it display 
the> turkey? and if not, have it display a different graphic?>> I'm attempting 
to be able to make small changes to my website without> having to remember to 
do them or change them :)>> I hope I've made enough sense that someone can 
point me in the right> direction :)>> Thanks for looking!>> -->> Jason Pruim> 
Raoset Inc.> Technology Manager> MQC Specialist> 3251 132nd ave> Holland, MI, 
49424> www.raoset.com> [EMAIL PROTECTED]>>

_________________________________________________________________
Have fun while connecting on Messenger! Click here to learn more.
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger

--- End Message ---
--- Begin Message ---
At 3:10 PM -0700 10/24/07, Instruct ICC wrote:
> I want to be able to display something like an image of a turkey
 during the month of november from now until I'm dead.

And how will the application know when you are dead?

When you stop paying for hosting, the application get's the idea when it's bits go poof!

If anyone ever noticed, my web site (http://sperling.com) has a tree on it that changes with the seasons. I use:

$dates = getdate();
$month = $dates['mon'];
$w = "http://www.sperling.com/css/seasons/";;
switch( $month )
        {
        case "03": case "04": case "05":
                $var = $w . "spring.jpg";
                break;
        case "06": case "07": case "08" :
                $var = $w . "summer.jpg";
                break;
        case "09": case "10": case "11":
                $var = $w . "fall.jpg";
                break;
        case "12": case "01": case "02":
                $var = $w . "winter.jpg";
                $break;
        }
echo($var);

And this code is called from within my css file for a background image. Yes, I use variables in css.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Hi all:

    I'm working on a project that requires frequent updating of a large amount 
of data to a MySQL database.  Currently, I'm trying to transfer a CSV file to 
the server, have it process the file, and then delete it once the processing is 
complete.  Rather than waste the up-front time of having to upload the file 
(which is currently timing out without fully uploading the file and I have no 
idea how to resolve this!), is it possible to have the server open the 
specified file remotely and read it using the fgetcsv() function?  If so, how?

    Any help you can give me will be GREATLY appreciated!

    Thanks,

        Jon

--- End Message ---
--- Begin Message ---
How big is the file? fgetcsv() will read any file that you can get a
handle to using fopen() or fsockopen(),  including remote files.
However, if allow_url_fopen is not enabled, you can't use fopen().
Also if the file is so large that your script is timing out while
waiting for it to be uploaded, it could also timeout just trying to
read the file remotely as well.

Andrew

--- End Message ---
--- Begin Message ---
Go into your php.ini file and increase the script timeout length, which should 
allow the upload to finish.


---- Jon Westcot <[EMAIL PROTECTED]> wrote: 
> Hi all:
> 
>     I'm working on a project that requires frequent updating of a large 
> amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV 
> file to the server, have it process the file, and then delete it once the 
> processing is complete.  Rather than waste the up-front time of having to 
> upload the file (which is currently timing out without fully uploading the 
> file and I have no idea how to resolve this!), is it possible to have the 
> server open the specified file remotely and read it using the fgetcsv() 
> function?  If so, how?
> 
>     Any help you can give me will be GREATLY appreciated!
> 
>     Thanks,
> 
>         Jon

--- End Message ---
--- Begin Message ---
Thanks, Wolf.  I'm going to have to do a lot of long processes -- uploads,
queries, and the like -- and I appreciate knowing that I can adjust that.
Now if I can just find the PHP.INI file....  (Stupid GoDaddy-shared-domains;
can't find anything on 'em.)

    Jon

----- Original Message -----
From: "Wolf" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> Go into your php.ini file and increase the script timeout length, which
should allow the upload to finish.
>
>
> ---- Jon Westcot <[EMAIL PROTECTED]> wrote:
> > Hi all:
> >
> >     I'm working on a project that requires frequent updating of a large
amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV
file to the server, have it process the file, and then delete it once the
processing is complete.  Rather than waste the up-front time of having to
upload the file (which is currently timing out without fully uploading the
file and I have no idea how to resolve this!), is it possible to have the
server open the specified file remotely and read it using the fgetcsv()
function?  If so, how?
> >
> >     Any help you can give me will be GREATLY appreciated!
> >
> >     Thanks,
> >
> >         Jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi Andrew:

    Thanks for the reply.

    If I use fopen() to open the remote file, how do I specify its location?
Isn't it going to need to know not only the address of the computer I'm
using but the path on that computer to the file?  Does it get all that from
the name I pass over to it?

    Also, can I adjust the allow_url_fopen setting from within a PHP script,
or do I need to manually set it in the PHP.INI file?  The server I'm
using -- not my own; this is for a friend -- is a shared server with GoDaddy
and they make it so incredibly hard to find anything.

    Thanks!

        Jon


----- Original Message -----
From: "Andrew Ballard" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2007 1:15 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> How big is the file? fgetcsv() will read any file that you can get a
> handle to using fopen() or fsockopen(),  including remote files.
> However, if allow_url_fopen is not enabled, you can't use fopen().
> Also if the file is so large that your script is timing out while
> waiting for it to be uploaded, it could also timeout just trying to
> read the file remotely as well.
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
you probably won't be able to edit PHP.ini with shared-hosting. The other 
solutions, one I can think of it now - you can use PHP to upload files from 
remote computer to the server at certain time, and set schedule with cron to 
run your PHP scripts on your server. 
Good luck

-----Original Message-----
From: Jon Westcot [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 24, 2007 3:18 PM
To: PHP General
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


Thanks, Wolf.  I'm going to have to do a lot of long processes -- uploads,
queries, and the like -- and I appreciate knowing that I can adjust that.
Now if I can just find the PHP.INI file....  (Stupid GoDaddy-shared-domains;
can't find anything on 'em.)

    Jon

----- Original Message -----
From: "Wolf" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> Go into your php.ini file and increase the script timeout length, which
should allow the upload to finish.
>
>
> ---- Jon Westcot <[EMAIL PROTECTED]> wrote:
> > Hi all:
> >
> >     I'm working on a project that requires frequent updating of a large
amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV
file to the server, have it process the file, and then delete it once the
processing is complete.  Rather than waste the up-front time of having to
upload the file (which is currently timing out without fully uploading the
file and I have no idea how to resolve this!), is it possible to have the
server open the specified file remotely and read it using the fgetcsv()
function?  If so, how?
> >
> >     Any help you can give me will be GREATLY appreciated!
> >
> >     Thanks,
> >
> >         Jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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


--- End Message ---
--- Begin Message ---
Hi again, Andrew:

    You had asked some questions that I forgot to address with my previous
reply, so here goes:

    The test file that I'm using -- which probably is a small version of the
normal file -- is around 60 MB in size (just under 30,000 records).

    I checked the phpinfo info and it appears that the allow_url_fopen
setting is set to "On," which I take is a good thing.  How, then, do I
specify the filename at the server so that it points back to the file that
is on my computer (or whatever computer is trying to initiate the process)?

    Thanks again for your help,

        Jon


----- Original Message -----
From: "Jon Westcot" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2007 1:22 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> Hi Andrew:
>
>     Thanks for the reply.
>
>     If I use fopen() to open the remote file, how do I specify its
location?
> Isn't it going to need to know not only the address of the computer I'm
> using but the path on that computer to the file?  Does it get all that
from
> the name I pass over to it?
>
>     Also, can I adjust the allow_url_fopen setting from within a PHP
script,
> or do I need to manually set it in the PHP.INI file?  The server I'm
> using -- not my own; this is for a friend -- is a shared server with
GoDaddy
> and they make it so incredibly hard to find anything.
>
>     Thanks!
>
>         Jon
>
>
> ----- Original Message -----
> From: "Andrew Ballard" <[EMAIL PROTECTED]>
> To: "PHP General" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 24, 2007 1:15 PM
> Subject: Re: [PHP] Can a PHP script process a file on a remote computer?
>
>
> > How big is the file? fgetcsv() will read any file that you can get a
> > handle to using fopen() or fsockopen(),  including remote files.
> > However, if allow_url_fopen is not enabled, you can't use fopen().
> > Also if the file is so large that your script is timing out while
> > waiting for it to be uploaded, it could also timeout just trying to
> > read the file remotely as well.
> >
> > Andrew
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 10/24/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
>     The test file that I'm using -- which probably is a small version of the
> normal file -- is around 60 MB in size (just under 30,000 records).

That sounds like a rather large file to process anyway. You might need
to use some scheduled task like Lance suggested to copy the file and
then open it locally. I'm not sure how GoDaddy hosting works.

>     I checked the phpinfo info and it appears that the allow_url_fopen
> setting is set to "On," which I take is a good thing.

It's pretty typical, but you never know without checking since it is an option.

>  How, then, do I
> specify the filename at the server so that it points back to the file that
> is on my computer (or whatever computer is trying to initiate the process)?

The file has to be accessible from the server through either a web
path or some sort of file share or local file path. So if the server
can see the file as http://remoteserver/remotefile.csv,
\\remoteserver\remotefile.csv, etc., you can use that path.

Andrew

--- End Message ---
--- Begin Message --- There is set_time_limit() that works from the script as long as safe_mode is not enabled.

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

Ed


On Oct 24, 2007, at 3:26 PM, Vo, Lance wrote:

you probably won't be able to edit PHP.ini with shared-hosting. The other solutions, one I can think of it now - you can use PHP to upload files from remote computer to the server at certain time, and set schedule with cron to run your PHP scripts on your server.
Good luck

-----Original Message-----
From: Jon Westcot [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 24, 2007 3:18 PM
To: PHP General
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


Thanks, Wolf. I'm going to have to do a lot of long processes -- uploads, queries, and the like -- and I appreciate knowing that I can adjust that. Now if I can just find the PHP.INI file.... (Stupid GoDaddy-shared- domains;
can't find anything on 'em.)

    Jon

----- Original Message -----
From: "Wolf" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


Go into your php.ini file and increase the script timeout length, which
should allow the upload to finish.


---- Jon Westcot <[EMAIL PROTECTED]> wrote:
Hi all:

I'm working on a project that requires frequent updating of a large
amount of data to a MySQL database. Currently, I'm trying to transfer a CSV file to the server, have it process the file, and then delete it once the processing is complete. Rather than waste the up-front time of having to upload the file (which is currently timing out without fully uploading the file and I have no idea how to resolve this!), is it possible to have the server open the specified file remotely and read it using the fgetcsv()
function?  If so, how?

    Any help you can give me will be GREATLY appreciated!

    Thanks,

        Jon

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



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


--- End Message ---
--- Begin Message ---
Warning... this is ajax-related and not necessarily PHP (even though it
calls PHP scripts). I sent this to several JS lists, but haven't received a
response, so I thought I'd query this list to see if anyone here had an
idea.

~Philip


On 10/24/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
>
> Hi. I have this js function below. In it I grab the coordinates of where
> the user clicked (on the map). I want to take these coordinates and stuff
> 'em into a database, then display on the map where they clicked. Then I want
> to display some links in another div (not the map).
>
> [js code]
> function addPoint (e, imageId)
> {
>     var pl = new Array();
>     pl = map.pointLocation (e, CURRENT_POINT_SIZE);
>
>     var url = 'addPoint.php?x='+pl['x']+'&y='+pl['y']+'&size='+
>         CURRENT_POINT_SIZE+'&map='+imageId;
>     xmlHttpRequest (url, null, updateMap, 'GET');
>
>     url = 'updateForm.php?x='+pl['x']+'&y='+pl['y']+'&size='+
>         CURRENT_POINT_SIZE+'&map='+imageId;
>     xmlHttpRequest (url, null, updateForm, 'GET');
> }
>
> function xmlHttpRequest (url, vars, callbackFunction, requestMethod) {...}
> [/js code]
>
> Here, xmlHttpRequest is the method I call to perform the asynchronous
> requests. Ok, if I don't make the 2nd call to it, the points show up fine on
> the map (from the 1st request). If I make both calls, the points do NOT show
> up, but the links (from the 2nd request) appear.
>
> Is there an issue with calling this more than once? I tried setting a
> timeout for the 2nd request, but that didn't seem to help. Thoughts?
>
> Thanks in advance,
> ~Philip
>
>

--- End Message ---
--- Begin Message ---
Hi, I got a strange problem: Using php 4.4.x, I capture the whole output for a 
webpage into the output-buffer by using ob_start and ob_get_clean, because I 
got to make some replacements in the html-code before sending the page to the 
browser.

This worked fine with a small page, but now I got a page for which the 
html-code is about 280 KB  (not too big I think). But I get an server-error 500 
for this script on my linux-based webhoster.

I tried to run it on an local WAMP-installation - it worked without error.
I temporarly deleted some of the output - it worked without error.
I turned of the output-buffering - it worked without error.

I printed memory_get_usage, but it never exceeded 2 MB (I load about 200 
records from a database and create objects from it and then print the data of 
these 200 records).
On phpinfo(), memory_limit of my webhoster is 40M - so 2MB SHOULD be no problem.
I increased the memory-limit to 64M - it doesn't help.

Any idea what I could do next? I got no access to the apache error-log, but the 
error is definitely connected to the output buffer and how much I try to store 
in it.

Any help is welcome.

Regards

Wuschba




       __________________________________ Ihr erstes Fernweh? Wo gibt es den 
schönsten Strand? www.yahoo.de/clever

--- End Message ---
--- Begin Message ---
After doing some reading, I figured out that I was causing a race condition
because my request was declared globally. I fixed this by making it local.
So, it had nothing to do with the addPoint() function, but I just saw the
affects there.

I read this here (http://developer.mozilla.org/en/docs/AJAX:Getting_Started)
on Step 3, Note 3.

~Philip


On 10/24/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
>
> Hi. I have this js function below. In it I grab the coordinates of where
> the user clicked (on the map). I want to take these coordinates and stuff
> 'em into a database, then display on the map where they clicked. Then I want
> to display some links in another div (not the map).
>
> [js code]
> function addPoint (e, imageId)
> {
>     var pl = new Array();
>     pl = map.pointLocation (e, CURRENT_POINT_SIZE);
>
>     var url = 'addPoint.php?x='+pl['x']+'&y='+pl['y']+'&size='+
>         CURRENT_POINT_SIZE+'&map='+imageId;
>     xmlHttpRequest (url, null, updateMap, 'GET');
>
>     url = 'updateForm.php?x='+pl['x']+'&y='+pl['y']+'&size='+
>         CURRENT_POINT_SIZE+'&map='+imageId;
>     xmlHttpRequest (url, null, updateForm, 'GET');
> }
>
> function xmlHttpRequest (url, vars, callbackFunction, requestMethod) {...}
> [/js code]
>
> Here, xmlHttpRequest is the method I call to perform the asynchronous
> requests. Ok, if I don't make the 2nd call to it, the points show up fine on
> the map (from the 1st request). If I make both calls, the points do NOT show
> up, but the links (from the 2nd request) appear.
>
> Is there an issue with calling this more than once? I tried setting a
> timeout for the 2nd request, but that didn't seem to help. Thoughts?
>
> Thanks in advance,
> ~Philip
>

--- End Message ---
--- Begin Message ---
Hi
I have installed php v5 on a windowsXP PC. Server is Apache 2.2.
Even though I have turned register globals on in the ini file, the php is still 
not allowing the use of $HTTP_GET_VARS (and probably other similier variables), 
and I am having to change my existing script to $_GET before they will run.

Any idea why the directive is being ignored?
Rodney Courtis


--- End Message ---
--- Begin Message ---
You're using the wrong option.

Register globals is for the auto-creation of variables passed through GET, POST, etc.

What you want is register_long_vars (or something like that, long variables, long arrays...)

Chris

Rodney Courtis wrote:
Hi
I have installed php v5 on a windowsXP PC. Server is Apache 2.2.
Even though I have turned register globals on in the ini file, the php is still 
not allowing the use of $HTTP_GET_VARS (and probably other similier variables), 
and I am having to change my existing script to $_GET before they will run.

Any idea why the directive is being ignored?
Rodney Courtis



--- End Message ---
--- Begin Message ---
I tried:

$a=$_SERVER["REMOTE_ADDR"];
echo "<p>REMOTE_ADDR=$a<br>";
if($a="192.168.250.108") {
   $a="61.64.101.101";
}


$aa=system('lynx -dump http://api.hostip.info/country.php?ip=$a',$location);
echo "<p>a=$a<br>aa=$aa<br>location=$location<br>";

$aa=system('lynx -dump http://api.hostip.info/country.php?ip=61.64.101.101',$location);
echo "<p>a=$a<br>aa=$aa<br>location=$location<br>";


I get:

REMOTE_ADDR=192.168.250.108
XX

a=61.64.101.101
aa=XX
location=0
TW

a=61.64.101.101
aa=TW
location=0


as you can see, if I put the IP address in, I get the right answer (TW).

What am I doing wrong?

bye

Ronald

--- End Message ---

Reply via email to