Re: [PHP] $_FILES doesn't work but $_POST works

2006-05-31 Thread Rabin Vincent

On 5/31/06, kartikay malhotra <[EMAIL PROTECTED]> wrote:

However, with Mbuni MMS Gateway (which provides HTTP POST),  the above
condition in if loop isn't satisfied. I think $_FILES isn't working. However
the following code works:

 0*/ )
{

$f=fopen($out,'a');
echo "HEL";
copy($in, $out);
}

?>

This implies, $_POST works, and a file has been uploaded. I  however, do not
know how to access it


Have you tried simply saving $_POST['userfile'] to a file?

Rabin

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



[PHP] corrupt pdfs

2006-05-31 Thread Ross

I have pdfs saved as BLOBs I create the links dynamically but only some of 
the PDFs display an error message 'error opening this files...this file 
cannot be repaired..."


Is there a file size limit in kb for Blobs and what is it?
What size of file can a LONG BLOB accomodate?
If it is not this any ideas? It seems to fix it though!

Thanks,


Ross

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



Re: [PHP] corrupt pdfs

2006-05-31 Thread Chris

Ross wrote:
I have pdfs saved as BLOBs I create the links dynamically but only some of 
the PDFs display an error message 'error opening this files...this file 
cannot be repaired..."



Is there a file size limit in kb for Blobs and what is it?
What size of file can a LONG BLOB accomodate?


Who knows? What database are you using? Each database is different. Have 
you checked the databases documentation?



If it is not this any ideas? It seems to fix it though!


So does it fix it or not?

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

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



Re: [PHP] $_FILES doesn't work but $_POST works

2006-05-31 Thread kartikay malhotra

Thanks for your replies.

1. Did you put the enctype="multipart/form-data" into the FORM tag?
Ans: I do not have a form! I'm using a gateway utility to upload files


From documentation of Mbuni MMS gateway:


post-url
Response content is obtained as result of sending a HTTP POST request to the
provided URL. The POST message is *always* encoding (such as that used by a
web browser when an HTML form has the submitted using the
multipart/form-dataenctype=multipart/form-data parameter set). If
http-post-parameters field is given (see below), then the relevant
parameters are sent as part of the request. *X-Mbuni* headers are sent as
well.


http-post-parameters
Used in conjunction with post-url. Parameters are provided in the same way
as would be provided in an HTTP GET request (e.g. *
message=true&myname=test&image=%i*).

2.  Have you tried simply saving $_POST['userfile'] to a file?

$save = $_POST['userfile'];
$f=fopen($out,'a');
copy($save, $out);


Nothing is copied. Opened file is empty.

Pls suggest
KM

On 5/31/06, Rabin Vincent <[EMAIL PROTECTED]> wrote:


On 5/31/06, kartikay malhotra <[EMAIL PROTECTED]> wrote:
> However, with Mbuni MMS Gateway (which provides HTTP POST),  the above
> condition in if loop isn't satisfied. I think $_FILES isn't working.
However
> the following code works:
>
> 
> $in='/usr/share/wallpapers/alien-night.jpg';
> $out='/tmp/alien.jpg';
>
> if(isset($_POST['userfile'])/* || $_FILES['userfile']['size'] > 0*/ )
> {
>
> $f=fopen($out,'a');
> echo "HEL";
> copy($in, $out);
> }
>
> ?>
>
> This implies, $_POST works, and a file has been uploaded. I  however, do
not
> know how to access it

Have you tried simply saving $_POST['userfile'] to a file?

Rabin



Re: [PHP] corrupt pdfs

2006-05-31 Thread André Medeiros

A quick google search tells you that LONGBLOB can contain  string with
a maximum length of 4294967295 characters, which translates into
4gb+/-

Maybe a MEDIUMBLOB (16777215 characters) would already do the trick,
no? It supports as much as 16mb +/-



On 5/31/06, Chris <[EMAIL PROTECTED]> wrote:

Ross wrote:
> I have pdfs saved as BLOBs I create the links dynamically but only some of
> the PDFs display an error message 'error opening this files...this file
> cannot be repaired..."
>
>
> Is there a file size limit in kb for Blobs and what is it?
> What size of file can a LONG BLOB accomodate?

Who knows? What database are you using? Each database is different. Have
you checked the databases documentation?

> If it is not this any ideas? It seems to fix it though!

So does it fix it or not?

--
Postgresql & php tutorials
http://www.designmagick.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] Parse string with variables

2006-05-31 Thread Merlin

Hi there,

I am trying to parse a plain text which contains variables. The string 
looks like this:


P=1
U=test
T=ok
P=2
U=test2
T=anything

How could I create arrays out of this. To be able to access the values 
like this:

echo $P[1];

parse_str does not work here and I could not find another function which 
does this.


Thank you for any hint,

Merlin

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



[PHP] Re: Parse string with variables

2006-05-31 Thread Barry

Merlin schrieb:

Hi there,

I am trying to parse a plain text which contains variables. The string 
looks like this:


P=1
U=test
T=ok
P=2
U=test2
T=anything

How could I create arrays out of this. To be able to access the values 
like this:

echo $P[1];

parse_str does not work here and I could not find another function which 
does this.


Thank you for any hint,

Merlin


quite less infos you give.

echo $P[2] would output test or what?
$U["test"] or $U[1] = test ??

a hint. Uhm, use regexpressions to split the string and form variables 
out of it.


my guess.

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Re: Parse string with variables

2006-05-31 Thread Dimiter Ivanov

On 5/31/06, Barry <[EMAIL PROTECTED]> wrote:

Merlin schrieb:
> Hi there,
>
> I am trying to parse a plain text which contains variables. The string
> looks like this:
>
> P=1
> U=test
> T=ok
> P=2
> U=test2
> T=anything
>
> How could I create arrays out of this. To be able to access the values
> like this:
> echo $P[1];
>
> parse_str does not work here and I could not find another function which
> does this.
>
> Thank you for any hint,
>
> Merlin

quite less infos you give.

echo $P[2] would output test or what?
$U["test"] or $U[1] = test ??

a hint. Uhm, use regexpressions to split the string and form variables
out of it.

my guess.

Barry


OR, you could try :
1st split the text by newline into array.
Then split every element of the resulting array by '=' and
then you have all you need to create the variables, i guess :)

simple example :
$text_arr = explode("\n",$text);
foreach($text AS $val){
$temp_arr=explode("=",$val);
$$temp_arr[0][] = $temp_arr[1]; // not sure if this line is correct...
}

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



Re: [PHP] $_FILES doesn't work but $_POST works

2006-05-31 Thread chris smith

On 5/31/06, kartikay malhotra <[EMAIL PROTECTED]> wrote:

Thanks for your replies.

1. Did you put the enctype="multipart/form-data" into the FORM tag?
Ans: I do not have a form! I'm using a gateway utility to upload files

From documentation of Mbuni MMS gateway:

post-url
Response content is obtained as result of sending a HTTP POST request to the
provided URL. The POST message is *always* encoding (such as that used by a
web browser when an HTML form has the submitted using the
multipart/form-dataenctype=multipart/form-data parameter set). If
http-post-parameters field is given (see below), then the relevant
parameters are sent as part of the request. *X-Mbuni* headers are sent as
well.


http-post-parameters
Used in conjunction with post-url. Parameters are provided in the same way
as would be provided in an HTTP GET request (e.g. *
message=true&myname=test&image=%i*).

2.  Have you tried simply saving $_POST['userfile'] to a file?

 $save = $_POST['userfile'];
 $f=fopen($out,'a');
 copy($save, $out);


Files don't go into $_POST - they go into $_FILES.

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

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



Re: [PHP] $_FILES doesn't work but $_POST works

2006-05-31 Thread Rabin Vincent

On 5/31/06, chris smith <[EMAIL PROTECTED]> wrote:

On 5/31/06, kartikay malhotra <[EMAIL PROTECTED]> wrote:
> 2.  Have you tried simply saving $_POST['userfile'] to a file?
>
>  $save = $_POST['userfile'];
>  $f=fopen($out,'a');
>  copy($save, $out);

Files don't go into $_POST - they go into $_FILES.


Yes, his problem is that the $_FILES is not being set, but
there is some value in $_POST['userfile'].

Kartikay, I was suggesting that $_POST['userfile'] may
contain the file itself, not a filename. What does
$_POST['userfile'] contain? Try var_dump()ing it.

Rabin

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



Re: [PHP] corrupt pdfs

2006-05-31 Thread John Nichel

Ross wrote:
I have pdfs saved as BLOBs I create the links dynamically but only some of 
the PDFs display an error message 'error opening this files...this file 
cannot be repaired..."



Is there a file size limit in kb for Blobs and what is it?
What size of file can a LONG BLOB accomodate?
If it is not this any ideas? It seems to fix it though!



Let's not even attempt to pretend that this question has anything 
remotely to do with PHP.   mmmKay?


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Addtime is for 4.1, what can i use for 3.23? (pretty much 0T)

2006-05-31 Thread Ryan A
Hey,

 
> Might be quicker for you to ask on a mysql mailing
> list :)

Yep, am waiting for the confirmation email...

 
> I tried a couple of different things looking at the
> mysql page 
>
(http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html)
> 
> but couldn't come up with a proper solution.


Yep, then tried some weird stuff and it worked :-)

INSERT INTO test2
VALUES (Curtime(), DATE_ADD(Now(), INTERVAL '5'
minute)); 


Maybe this will help someone else out. 

Thanks for trying though.

Cheers!
Ryan


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
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



[PHP] is there a faster "file" command?

2006-05-31 Thread Merlin

Hi there,

I am reading a remote plain text file from another server via the file 
command:


$str = file ("http:/x");
This is a feed so there is no other way then reading it remote.

Now this reading takes up between 0.5 and 1.0 s which is far to slow. 
The whole other process on the site takes only 0.1 s and I would like to 
keep it inside this area of 0.1 - 0.2 s


Is there a faster way to read a remote txt file than with file() ?

If not, is there a way in php to process this in the background and 
continue to display the page without the results of the file?


Thank you in advance,

Merlin

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



Re: [PHP] is there a faster "file" command?

2006-05-31 Thread Brad Bonkoski



Merlin wrote:


Hi there,

I am reading a remote plain text file from another server via the file 
command:


$str = file ("http:/x");
This is a feed so there is no other way then reading it remote.

Now this reading takes up between 0.5 and 1.0 s which is far to slow. 
The whole other process on the site takes only 0.1 s and I would like 
to keep it inside this area of 0.1 - 0.2 s


Is there a faster way to read a remote txt file than with file() ?

If not, is there a way in php to process this in the background and 
continue to display the page without the results of the file?


not sure on a "faster" way, but you can have PHP handle this on the 
backend without disrupting the normal page load time...

Enter AJAX...
Set a side a place on your page for the results, and on page load issue 
an AJAX request to a backend process to get your contents from the file, 
and when it is done, your page can display at that point in time.
Fairly common usage for AJAX, so there should be some good tutorials out 
there which google will help you find.


-brad


Thank you in advance,

Merlin



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



Re: [PHP] is there a faster "file" command?

2006-05-31 Thread Dimiter Ivanov

On 5/31/06, Merlin <[EMAIL PROTECTED]> wrote:

Hi there,

I am reading a remote plain text file from another server via the file
command:

$str = file ("http:/x");
This is a feed so there is no other way then reading it remote.

Now this reading takes up between 0.5 and 1.0 s which is far to slow.
The whole other process on the site takes only 0.1 s and I would like to
keep it inside this area of 0.1 - 0.2 s

Is there a faster way to read a remote txt file than with file() ?

If not, is there a way in php to process this in the background and
continue to display the page without the results of the file?

Thank you in advance,

Merlin

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



It's said on the manual that
file_get_contents() is to be used if you want to read a text file.

from the manual :
"file_get_contents() is the preferred way to read the contents of a
file into a string. It will use memory mapping techniques if supported
by your OS to enhance performance."

The loading speed may be also affected by the time your server needs
to access the remote server.

If the information is not updated really fast, you may create a
cronjob to run every N minutes, and fetch that file on your server,
than make your site access the local version of the file, that will
effectively remove the network lag...

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



[PHP] [PHP5] safe_mode_exec_dir

2006-05-31 Thread James Nunnerley
Hi Folks,

 

Should be a nice easy one - if running PHP5, how do I add more than one
exec_dir into the list?  i.e. what is the separator?

 

Cheers

Nunners



Re: [PHP] is there a faster "file" command?

2006-05-31 Thread Rory Browne

As I believe someone else said, file_get_contents() is the perfered way.

Bare in mind however that reading off a network will probably be slow
compared to other operations.

This of course depends on the speed of your network, and the complexity of
the other operations.


Re: [PHP] [PHP5] safe_mode_exec_dir

2006-05-31 Thread Jochem Maas

James Nunnerley wrote:

Hi Folks,

 


Should be a nice easy one - if running PHP5, how do I add more than one
exec_dir into the list?  i.e. what is the separator?


I have never used the directive but I imagine it hasn't changed between
php4 and php5 ...

and I would hazard a guess that the dir seperator is the same as for 
open_base_dir
name:

linux   = :
windows = ;





 


Cheers

Nunners




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



[PHP] Session variables and words with spaces

2006-05-31 Thread Beauford
Hi,

I have a form in which a drop down field is populated from a MySQL database.
I am also using sessions.

The problem is this. After I submit the form the session variable only shows
the part of the input before the space.

Example: if I choose Niagra Falls from the drop down list, then I only see
Niagra when I display it.

I'm not sure though if it is the session or the forms variable that is
causing the problem. I haven't been able to find much on this.

See code below

Thanks



session_start(  );

..Open database and connect to server...

Include("connect.inc");

!! Start of form !!


-- Select Province --  
 
"$line['location']."\n";
}
}



!! Rest of Form !!

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



Re: [PHP] Session variables and words with spaces

2006-05-31 Thread Brad Bonkoski
Perhaps you should load up your initial form and then use the "view 
source" option in your browser as this will probably give you insight 
into your problems...

-Brad

Beauford wrote:


Hi,

I have a form in which a drop down field is populated from a MySQL database.
I am also using sessions.

The problem is this. After I submit the form the session variable only shows
the part of the input before the space.

Example: if I choose Niagra Falls from the drop down list, then I only see
Niagra when I display it.

I'm not sure though if it is the session or the forms variable that is
causing the problem. I haven't been able to find much on this.

See code below

Thanks



session_start(  );

..Open database and connect to server...

Include("connect.inc");

!! Start of form !!


-- Select Province --			 
			 


$query = "select pid, location from province order by location"; $results =
mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { 
  	$dberror = "Messed Up";

include("index.php");
exit;
}   

while ($line = mysql_fetch_array($results)) {
if($line['pid'] == 1) {
echo ""$line['location']."\n";
}
}



!! Rest of Form !!

 



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



Re: [PHP] Session variables and words with spaces

2006-05-31 Thread John Nichel

Beauford wrote:

Hi,

I have a form in which a drop down field is populated from a MySQL database.
I am also using sessions.

The problem is this. After I submit the form the session variable only shows
the part of the input before the space.

Example: if I choose Niagra Falls from the drop down list, then I only see
Niagra when I display it.

I'm not sure though if it is the session or the forms variable that is
causing the problem. I haven't been able to find much on this.

See code below

Thanks



session_start(  );

..Open database and connect to server...

Include("connect.inc");

!! Start of form !!


-- Select Province --			 
			 


$query = "select pid, location from province order by location"; $results =
mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { 
   	$dberror = "Messed Up";

include("index.php");
exit;
}   

while ($line = mysql_fetch_array($results)) {
if($line['pid'] == 1) {
echo ""$line['location']."\n";
}
}





I'm surprised you're not getting a parse error...

echo "" . $line['location'] . 
"\n";

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] ob_flush() problems

2006-05-31 Thread cajbecu

Hello,

   for ($i=0; $i < 10; $i++) {
   $output = "ccc2";
   print "";
   echo $output;
   print "";
   ob_flush();
   flush();

   sleep(1);
   }

I want to show on the browser, "ccc2" (example) every 1 second, but it
shows all the text when the for stops... any ideea?

i tried all the examples from php.net, all the examples on the net,
bot no succes.

cheers,

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



Re: [PHP] ob_flush() problems

2006-05-31 Thread Brad Bonkoski



cajbecu wrote:


Hello,

   for ($i=0; $i < 10; $i++) {
   $output = "ccc2";
   print "";
   echo $output;
   print "";
   ob_flush();
   flush();

   sleep(1);
   }

I want to show on the browser, "ccc2" (example) every 1 second, but it
shows all the text when the for stops... any ideea?

i tried all the examples from php.net, all the examples on the net,
bot no succes.

cheers,

PHP is a server side scripting language, so the information would not be 
sent to the browser( aka client) until the server side script has 
completed its execution.

-Brad

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



RE: [PHP] Session variables and words with spaces

2006-05-31 Thread Beauford
 
Thanks - Done that though. It shows the way it should be.

Example: Niagara Falls


-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED] 
Sent: May 31, 2006 2:28 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] Session variables and words with spaces

Perhaps you should load up your initial form and then use the "view source"
option in your browser as this will probably give you insight into your
problems...
-Brad

Beauford wrote:

>Hi,
>
>I have a form in which a drop down field is populated from a MySQL
database.
>I am also using sessions.
>
>The problem is this. After I submit the form the session variable only 
>shows the part of the input before the space.
>
>Example: if I choose Niagra Falls from the drop down list, then I only 
>see Niagra when I display it.
>
>I'm not sure though if it is the session or the forms variable that is 
>causing the problem. I haven't been able to find much on this.
>
>See code below
>
>Thanks
>
>
>
>session_start(  );
>
>..Open database and connect to server...
>
>Include("connect.inc");
>
>!! Start of form !!
>
>
>-- Select Province -- 
>
>
>$query = "select pid, location from province order by location"; 
>$results =
>mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { 
>   $dberror = "Messed Up";
>   include("index.php");
>   exit;
>   }   
>   
>while ($line = mysql_fetch_array($results)) {
>   if($line['pid'] == 1) {
>   echo "Value="$line['location'].">"$line['location']."\n";
>   }
>}
>
>
>
>!! Rest of Form !!
>
>  
>

--
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] Session variables and words with spaces

2006-05-31 Thread Brad Bonkoski



Beauford wrote:



Thanks - Done that though. It shows the way it should be.

Example: Niagara Falls


 

which of course is wrong and explains perfectly why you are getting 
the results you are getting...

it *should* display:
Niagra Falls
(View source is a powerful tool!)
-Brad


-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED] 
Sent: May 31, 2006 2:28 PM

To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] Session variables and words with spaces

Perhaps you should load up your initial form and then use the "view source"
option in your browser as this will probably give you insight into your
problems...
-Brad

Beauford wrote:

 


Hi,

I have a form in which a drop down field is populated from a MySQL
   


database.
 


I am also using sessions.

The problem is this. After I submit the form the session variable only 
shows the part of the input before the space.


Example: if I choose Niagra Falls from the drop down list, then I only 
see Niagra when I display it.


I'm not sure though if it is the session or the forms variable that is 
causing the problem. I haven't been able to find much on this.


See code below

Thanks



session_start(  );

..Open database and connect to server...

Include("connect.inc");

!! Start of form !!


-- Select Province --			 
			 


$query = "select pid, location from province order by location"; 
$results =
mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { 
 	$dberror = "Messed Up";

include("index.php");
exit;
}   

while ($line = mysql_fetch_array($results)) {
if($line['pid'] == 1) {
echo ""$line['location']."\n";
}
}



!! Rest of Form !!



   



--

 



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



Re: [PHP] Session variables and words with spaces

2006-05-31 Thread cajbecu

Niagara Falls

replace with

Niagara Falls (note the quotes)

because you will post only "Niagara" instead "Niagara Falls"

cheers,

On 5/31/06, Beauford <[EMAIL PROTECTED]> wrote:


Thanks - Done that though. It shows the way it should be.

Example: Niagara Falls


-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED]
Sent: May 31, 2006 2:28 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] Session variables and words with spaces

Perhaps you should load up your initial form and then use the "view source"
option in your browser as this will probably give you insight into your
problems...
-Brad

Beauford wrote:

>Hi,
>
>I have a form in which a drop down field is populated from a MySQL
database.
>I am also using sessions.
>
>The problem is this. After I submit the form the session variable only
>shows the part of the input before the space.
>
>Example: if I choose Niagra Falls from the drop down list, then I only
>see Niagra when I display it.
>
>I'm not sure though if it is the session or the forms variable that is
>causing the problem. I haven't been able to find much on this.
>
>See code below
>
>Thanks
>
>
>
>session_start(  );
>
>..Open database and connect to server...
>
>Include("connect.inc");
>
>!! Start of form !!
>
>
>-- Select Province --
>
>
>$query = "select pid, location from province order by location";
>$results =
>mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) {
>   $dberror = "Messed Up";
>   include("index.php");
>   exit;
>   }
>
>while ($line = mysql_fetch_array($results)) {
>   if($line['pid'] == 1) {
>   echo "Value="$line['location'].">"$line['location']."\n";
>   }
>}
>
>
>
>!! Rest of Form !!
>
>
>

--
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] Session variables and words with spaces

2006-05-31 Thread Beauford
Not sure why I would get a parse error, but that did correct the problem. I
just completely missed the single quote. I never even clue'd in when I
looked at the source of the page.

Sometimes another pair of eyes does the trick. Maybe it's time for a break.

Thanks


>> I'm surprised you're not getting a parse error...

echo "" . $line['location'] . 
"\n";
--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[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] Session variables and words with spaces

2006-05-31 Thread Beauford
Yep, I see that now. I really need to take a break - been at this way to
long. 

Thanks to all. 

-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED] 
Sent: May 31, 2006 3:02 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] Session variables and words with spaces



Beauford wrote:

> 
>Thanks - Done that though. It shows the way it should be.
>
>Example: Niagara Falls
>
>
>  
>
which of course is wrong and explains perfectly why you are getting the
results you are getting...
it *should* display:
Niagra Falls (View source is a
powerful tool!) -Brad

>-Original Message-
>From: Brad Bonkoski [mailto:[EMAIL PROTECTED]
>Sent: May 31, 2006 2:28 PM
>To: Beauford
>Cc: php-general@lists.php.net
>Subject: Re: [PHP] Session variables and words with spaces
>
>Perhaps you should load up your initial form and then use the "view source"
>option in your browser as this will probably give you insight into your 
>problems...
>-Brad
>
>Beauford wrote:
>
>  
>
>>Hi,
>>
>>I have a form in which a drop down field is populated from a MySQL
>>
>>
>database.
>  
>
>>I am also using sessions.
>>
>>The problem is this. After I submit the form the session variable only 
>>shows the part of the input before the space.
>>
>>Example: if I choose Niagra Falls from the drop down list, then I only 
>>see Niagra when I display it.
>>
>>I'm not sure though if it is the session or the forms variable that is 
>>causing the problem. I haven't been able to find much on this.
>>
>>See code below
>>
>>Thanks
>>
>>
>>
>>session_start(  );
>>
>>..Open database and connect to server...
>>
>>Include("connect.inc");
>>
>>!! Start of form !!
>>
>>
>>-- Select Province --
>>   
>>>
>>$query = "select pid, location from province order by location"; 
>>$results =
>>mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { 
>>  $dberror = "Messed Up";
>>  include("index.php");
>>  exit;
>>  }   
>>  
>>while ($line = mysql_fetch_array($results)) {
>>  if($line['pid'] == 1) {
>>  echo ">Value="$line['location'].">"$line['location']."\n";
>>  }
>>}
>>
>>
>>
>>!! Rest of Form !!
>>
>> 
>>
>>
>>
>
>--
>
>  
>

--
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] Am I supposed to be using SPL?

2006-05-31 Thread D. Dante Lorenso
I was about to write code to recursively list the contents of a 
directory when I remembered seeing an object in SPL that would do it for me:


   
http://us3.php.net/manual/en/function.recursivedirectoryiterator-next.php


But there is no documentation on this object, and although I have it in 
PHP 5.1.4, docs say it's might be only in CVS.  So, I try using it and 
get this:


valid()) {
   print $dir->current()."\n";
  $dir->next();
}
?>

But it doesn't seem to recurse through the directories.  In fact, this 
acts just like DirectoryIterator.  So, there must be a flag to make it 
recurse, but documentation is not there.  I see this documentation here:


   http://www.php.net/~helly/php/ext/spl/

But that just looks like the source code was parsed to generate it, 
nothing much help in seeing an example of the usage.


Is SPL meant to be used?  If so, is it experimental?  Is it documented?  
Should I stay away from SPL for production code?  What's the official word?


Dante

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



Re: [PHP] ob_flush() problems

2006-05-31 Thread Adam Zey

Brad Bonkoski wrote:



cajbecu wrote:


Hello,

   for ($i=0; $i < 10; $i++) {
   $output = "ccc2";
   print "";
   echo $output;
   print "";
   ob_flush();
   flush();

   sleep(1);
   }

I want to show on the browser, "ccc2" (example) every 1 second, but it
shows all the text when the for stops... any ideea?

i tried all the examples from php.net, all the examples on the net,
bot no succes.

cheers,

PHP is a server side scripting language, so the information would not be 
sent to the browser( aka client) until the server side script has 
completed its execution.

-Brad


That is incorrect. There is nothing stopping a PHP script from doing 
exactly what he says, and being a server-side script doesn't imply that 
the data will be buffered.


I suggest that both of you examine the contents of 
http://www.php.net/manual/en/function.flush.php for more information on 
obstacles to getting data to the client as it is generated.


As an unrelated note, there is no point in using "print" for some things 
and "echo" for others. For your uses, you might as well just use "echo" 
for everything.


Regards, Adam Zey.

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



[PHP] [ANNOUNCEMENT] Sparse 1.03b Released

2006-05-31 Thread Daniel Orner
	New beta release of Sparse, my framework for writing MySQL-based 
programs without any code. This release includes search capability and 
completely removes all external dependencies (also allowing for Sparse 
tags to be embedded in regular tags).

Try it out!
http://sparse-php.sourceforge.net/

--Daniel
--
Sparse - a new way to write MySQL-based programs with little to no 
actual programming. Save yourself time and effort!

http://sparse-php.sourceforge.net/

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



Re: [PHP] Am I supposed to be using SPL?

2006-05-31 Thread Jochem Maas

your not supposed to do anything ;-)
but you can if you like :-) ...

D. Dante Lorenso wrote:
> I was about to write code to recursively list the contents of a
> directory when I remembered seeing an object in SPL that would do it for
> me:
>
>
> http://us3.php.net/manual/en/function.recursivedirectoryiterator-next.php
>
> But there is no documentation on this object, and although I have it in
> PHP 5.1.4, docs say it's might be only in CVS.  So, I try using it and
> get this:
>
>  $dir = new RecursiveDirectoryIterator("/some/dir/path");
> while($dir->valid()) {
>print $dir->current()."\n";

http://php.net/manual/en/function.recursivedirectoryiterator-haschildren.php

and related methods...

also take a look here:

http://www.wiki.cc/php/RecursiveDirectoryIterator

>   $dir->next();
> }
> ?>
>
> But it doesn't seem to recurse through the directories.  In fact, this
> acts just like DirectoryIterator.  So, there must be a flag to make it
> recurse, but documentation is not there.  I see this documentation here:
>
>http://www.php.net/~helly/php/ext/spl/

try looking at the userland version of the SPL classes they give quite abit
away as to how they work and how you can use them.

>
> But that just looks like the source code was parsed to generate it,
> nothing much help in seeing an example of the usage.
>
> Is SPL meant to be used?  If so, is it experimental?  Is it documented?
> Should I stay away from SPL for production code?  What's the official word?

yes it's meant to be used, yes you can use it in production BUT your
a little on the bleeding edge (not very many people using it full on) AND
the whole of SPL is still a little in flex (as is php5->php6 in general) so
that you may be forced, occasionally, to adapt your code to changes (e.g.
constants that were formally used in SPL are now class constants.)

and please note this is not the official word but jmho.

>
> Dante
>

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



[PHP] get directory paths recursively using SPL ... was Re: [PHP] Am I supposed to be using SPL?

2006-05-31 Thread D. Dante Lorenso

Jochem Maas wrote:

also take a look here:
http://www.wiki.cc/php/RecursiveDirectoryIterator

yes it's meant to be used, yes you can use it in production BUT your
a little on the bleeding edge (not very many people using it full on) AND
the whole of SPL is still a little in flex (as is php5->php6 in 
general) so

that you may be forced, occasionally, to adapt your code to changes (e.g.
constants that were formally used in SPL are now class constants.)


Wow, this is some magical stuff.  Here is my function in case it's of use:

   //--
   /**
* Magical SPL code to recursively list files in a directory
*/
   public static function get_paths_recursive($start_path) {
   $paths = array();
   $rdi = new RecursiveDirectoryIterator($start_path);
   foreach (new RecursiveIteratorIterator($rdi) as $path) {
   array_push($paths, (string) $path);
   }
   return $paths;
   }

   //--

This iterates over objects like arrays, casts objects as strings, and 
iterates
iterators.  All sorts of fun and joy enough to make your head spin.  
Seems to

work, though ;-)

Thanks for the wiki doc link, Jochem.

Dante

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



Re: [PHP] ob_flush() problems

2006-05-31 Thread Richard Lynch
On Wed, May 31, 2006 1:29 pm, cajbecu wrote:
> for ($i=0; $i < 10; $i++) {
> $output = "ccc2";
> print "";
> echo $output;
> print "";
> ob_flush();
> flush();
>
> sleep(1);
> }
>
> I want to show on the browser, "ccc2" (example) every 1 second, but it
> shows all the text when the for stops... any ideea?
>
> i tried all the examples from php.net, all the examples on the net,
> bot no succes.

ob_flush() only makes sense if you have ob_start() somewhere, or if
output_buffering is enabled in php.ini

flush(); and sleep(1); are all you should need...

At least from PHP standpoint.

But there are many other players outside the control of PHP...

Apache could be buffering output.

TCP could be buffering output.

Your browser will NOT render some parts of some elements until the
tags are all closed -- If you are inside a TABLE, for instance, expect
not to see things happening in real-time.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] ob_flush() problems

2006-05-31 Thread Richard Lynch
On Wed, May 31, 2006 1:36 pm, Brad Bonkoski wrote:
> PHP is a server side scripting language, so the information would not
> be
> sent to the browser( aka client) until the server side script has
> completed its execution.

This is just plain incorrect.

While buffering within various pieces of software MAY alter the
timing, data IS output from PHP as it runs, not only after execution
is completed.

If you pump ENOUGH data out, and then sleep(10) and then pump ENOUGH
more data out, you WILL see the data in parallel with script
execution.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] is there a faster "file" command?

2006-05-31 Thread Richard Lynch
On Wed, May 31, 2006 9:19 am, Merlin wrote:
> I am reading a remote plain text file from another server via the file
> command:
>
> $str = file ("http:/x");
> This is a feed so there is no other way then reading it remote.
>
> Now this reading takes up between 0.5 and 1.0 s which is far to slow.
> The whole other process on the site takes only 0.1 s and I would like
> to
> keep it inside this area of 0.1 - 0.2 s

What, exactly, are you measuring on that "other side"?

Think carefully about this.

Because odds are really good that you ONLY measure the time for some
process to spit "out" the data.

Yet, there is a great deal more time being spent on the "other side"

For example, if this "other side" has PHP and Apache, and you ONLY
measure the PHP start/end times, you're ignoring any Apache overhead.

How fast/slow is, say, wget from the local server?
That's probably a much more accurate measure to compare your PHP
performance with.

> Is there a faster way to read a remote txt file than with file() ?

Since file() has to read each line and build up an array, it might be
slower than http://file_get_contents

> If not, is there a way in php to process this in the background and
> continue to display the page without the results of the file?

You can use asynchronous streams/sockets to get the process started at
the beginning of your script, do other stuff, and then get the results
at the end of your script.

You could also use something browser-side like XmlHttpRequest or
full-blown AJAX to have the browser download the feed "later" --
Though even a iframe could do that, much simpler, most likely.

I would not be too hasty jumping into the iframe/ajax/client-side
solution, personally, as it tends to open up cans of worms.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] corrupt pdfs

2006-05-31 Thread Richard Lynch
On Wed, May 31, 2006 3:56 am, Ross wrote:
> I have pdfs saved as BLOBs

We've been through this a zillion time, so search the archives for the
pros and cons.

> Is there a file size limit in kb for Blobs and what is it?

I believe it depends on compile-time settings, but this is really a
MySQL question...

It's probably 4 Meg or something.

> What size of file can a LONG BLOB accomodate?

Probably twice as much as a regular one.

> If it is not this any ideas? It seems to fix it though!

It will only fix it for PDFs up to the size of a LONG BLOB, whatever
that is.

The REAL fix, imho, is to stop abusing your database for large file
storage, and use the custom highly-optimized large file data storage
engine commonly known as the "file system"

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] corrupt pdfs

2006-05-31 Thread tedd
At 6:26 PM -0500 5/31/06, Richard Lynch wrote:
>On Wed, May 31, 2006 3:56 am, Ross wrote:
>> I have pdfs saved as BLOBs
>
>We've been through this a zillion time, so search the archives for the
>pros and cons.
>
>> Is there a file size limit in kb for Blobs and what is it?
>
>I believe it depends on compile-time settings, but this is really a
>MySQL question...
>
>It's probably 4 Meg or something.
>
>> What size of file can a LONG BLOB accomodate?
>
>Probably twice as much as a regular one.
>
>> If it is not this any ideas? It seems to fix it though!
>
>It will only fix it for PDFs up to the size of a LONG BLOB, whatever
>that is.
>
>The REAL fix, imho, is to stop abusing your database for large file
>storage, and use the custom highly-optimized large file data storage
>engine commonly known as the "file system"

Yes, I was wondering that myself considering the onslaught of "no-no's" one 
gets by suggesting placing images into a dB. A PDf file is really not that much 
different and probably better served via file system.

tedd
-- 

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

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



[PHP] What would cause this?

2006-05-31 Thread tedd
Hi gang:

I have a question regarding php and security. My apologies beforehand if this 
is common knowledge to everyone except me.

I have a php application sitting at root level on one of my servers who's sole 
function is to send me an email whenever it's run. So, whenever I reference 
this app, it sends me an email -- very simple.

However, the app isn't reference or linked anywhere on the site, but it still 
occasionally runs all by itself.

My question is -- what's triggering it?

Is the cause a bot of some type? I was told that spiders/bots could only travel 
links outward from your front page (i.e., index) to all other referenced pages, 
but could not access things that are not linked -- unless of course they know 
the name of the app.

So, why does this php app occasionally run? Are there critters that navigate my 
root without my knowledge?

Thanks.

tedd

-- 

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

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



Re: [PHP] What would cause this?

2006-05-31 Thread Chris

tedd wrote:

Hi gang:

I have a question regarding php and security. My apologies beforehand if this 
is common knowledge to everyone except me.

I have a php application sitting at root level on one of my servers who's sole 
function is to send me an email whenever it's run. So, whenever I reference 
this app, it sends me an email -- very simple.

However, the app isn't reference or linked anywhere on the site, but it still 
occasionally runs all by itself.

My question is -- what's triggering it?

Is the cause a bot of some type? I was told that spiders/bots could only travel 
links outward from your front page (i.e., index) to all other referenced pages, 
but could not access things that are not linked -- unless of course they know 
the name of the app.

So, why does this php app occasionally run? Are there critters that navigate my 
root without my knowledge?


If you can, check your apache access logs and that will tell you the ip 
of the person who accessed that page.. will give you a starting point 
anyway.


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

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