Re: [PHP] htaccess / php

2003-12-01 Thread Jason Wong
On Tuesday 02 December 2003 14:34, Ed Lazor wrote:
> What do I put in .htaccess for Apache to process a named "archive" as a PHP
> file?
>
> I did it before and can't seem to find what I did.  Requests to
> http://myhost.com/archive/page1.php would get processed by the file named
> archive and page1.php would just be a parameter that I could access from
> within the script by checking the url and subtracting
> "http://myhost.com/archive/";.

 
ForceType application/x-httpd-php
 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Win98 is called Win98 because it is 98% slower than Linux.
*/

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



[PHP] htaccess / php

2003-12-01 Thread Ed Lazor
What do I put in .htaccess for Apache to process a named "archive" as a PHP file?

I did it before and can't seem to find what I did.  Requests to 
http://myhost.com/archive/page1.php would get processed by the file named archive and 
page1.php would just be a parameter that I could access from within the script by 
checking the url and subtracting "http://myhost.com/archive/";.

Thanks in advance,

-Ed

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



[PHP] htaccess / PHP

2003-12-01 Thread Ed Lazor
What do I put in .htaccess for Apache to process a named "archive" as a PHP file?

I did it before and can't seem to find what I did. Requests to 
http://myhost.com/archive/page1.php would get processed by the file named archive and 
page1.php would just be a parameter that I could access from within the script by 
checking the url and subtracting "http://myhost.com/archive/";.

Thanks in advance,

-Ed

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



[PHP] function array problems

2003-12-01 Thread Steve Turner
Hi,
Having some problems with multi-dimentional arrays.
I am creatng an array using some database data, and adding stuff like an image 
tag, and hyperlink.
Then passing this to another function that creates an Html table from an array.

Here is the function to create the table from an array, seems to work fine.
//-
// Builds transparent table from array
function trans_table_array
($array, $bodyfontcolor = "", $headerfontcolor = "")
{
 global $theme_bodyfontcolor, $theme_headerfontcolor;// Defined in a theme file

 // Poputlate with theme colors if called without specifying
 if ($bodyfontcolor == "")
  $bodyfontcolor = $theme_bodyfontcolor;
 if ($headerfontcolor == "")
  $headerfontcolor = $theme_headerfontcolor;
 
 $content = "\n";
 foreach ($array as $rowkey => $colkey)
 {
  $content .= "";
  foreach ($colkey as $value)
  {
if ($rowkey=="0") // Treat first row as column names
{
 $content .= "" 
 . $value . "\n";
}
else
{
 $content .= "";
 if (!isset($value)) //test for null value
  {$content .= "NULL";}
 else
  {$content .= ""
. $value . "";}
 $content .= "\n";
}
  }
  $content .= "\n";
 }
 $content .= "";
 return $content;
}
//

I use this function to get the whole database results into an array, passing the 
result of a query
//-
function mysql_fetch_array_r($result, $fetch = MYSQL_BOTH)
{ 
$row_counter = 0;
 while ($row = mysql_fetch_array($result,$fetch))
 { 
  $whole_result[$row_counter] = $row; 
  $row_counter++;
} 
return $whole_result; 
} 
//--
Then I am trying to build a table with 3 pictures per row.

$query = "Select * from picture";
$result = mysql_query($query)
 or die (mysql_error());

// Returns array with entire contents of query
$whole_result = mysql_fetch_array_r($result);

 $col_key = 0;
 foreach ($whole_result as $rowkey => $colkey)
 {  
  $table_string = "

  {$whole_result[$rowkey]['path']}";
   $table_array[$rowkey][$col_key] = $table_string;

// 3 $table_string per row in table
   if ($col_key< 2)
{ $col_key++; }
   else
{ $col_key=0; }
 }
  echo trans_table_array($table_array);

The above is not populating the array correctly. It results in one $table_string per 
row instead of column.
Am I just simply making a logic error. This multi-dimentional array stuff is 
confusing, been struggling with this for hours.
Does anyone else have a simpler way of seperating logic, and html? Thanks for any help.





Re: [PHP] Please please help - very very urgent

2003-12-01 Thread Manisha Sathe
A big thanks to both of you, it got solved,

it was a config problem only and with the help of ISP we could resolve it,

Thanks once again

manisha

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



Re: [PHP] Working as a PHP/database developer..

2003-12-01 Thread Joshua D. Drake
Hello,

  As a development company who has been profitable for 6 years I suggest
the following:

  1. There are no fixed fees. All time will be billed.
  2. Put everything in writing. If they want you to change the f to F make
them put it in writing.
  3. If you do have a flat fee for something... make it something you 
already have code for or have a procedure for. Even then, make sure
you have a test case for the procedure. If the test case fails it is
time and materials.
  4. Require a downpayment of at least 30% of the total "ESTIMATE". Our 
estimates are usually something like:

15,000 - 22,000

7500.00 (we do 50% down) would be required to begin work. When
then hit the 15k they have to pay up to the 15k.

Sincerely,

Joshua D. Drake


On Tue, 2 Dec 2003, Justin French wrote:

> On Tuesday, December 2, 2003, at 12:04  PM, Video Populares et 
> Optimates wrote:
> 
> > Ahoy!
> >
> > I'm sitting here, pondering on a problem that has just occurred to me. 
> > Having a short though intensive period of experience with PHP, I'm now 
> > in the process of being "swallowed" up by a group of web designers. 
> > That is, I've been offered a job opportunity.
> >
> > Now, how do you charge your services? Do you do it on a time-slot 
> > basis (seems kind of awkard to me since much PHP code can be reused a 
> > l o t!) or do you do it on the basis of the size of projects and 
> > whether new code has to be developed etc etc?
> 
> What's the matter with re-using the code and charging the same rate for 
> it?  You're a business, and you're supposed to make money.  I currently 
> charge by the hour, but I'm trying whereever possible to move away from 
> hourly rates into fixed price services.  Why?
> 
> a) The client knows exactly what to expect in terms of price and result
> b) I don't spend half my days quoting every last detail of a job
> c) I have the opportunity to re-use code over and over, making a 
> PROFIT, rather than braking even all the time
> 
> 
> > Another question is: Since they are the owners of the web servers 
> > (also in control of the web admins.), they effectively control the PHP 
> > code that I develop. How do I make sure that I'm not just used once 
> > for a project and thereafter thrown on the trashbin, i.e. they take 
> > the code and keep using it for many other projects without my 
> > knowledge. As far as I'm concerned, a proper pay should be for each 
> > project that my PHP code goes into. Or do you not agree? Very thankful 
> > for your opinions here!
> 
> Copyright is the simple answer, but it needs to be
> a) observed by your clients
> b) enforced by you when not observed by clients
> 
> You can always compile your scripts, and supply them with compiled 
> (encoded) products, rather than source scripts.  This of course would 
> depend on the copyright agreement you have with your clients.
> 
> > And what is a proper pay?
> 
> There's no decent answer to that -- there's soo many factors to 
> take into consideration, like the market, the economic environment, 
> your skills, your productivity, your client's budget, etc etc.  The 
> only accurate answer is "twice as much as half".
> 
> 
> > I would really like to get some tips on how to specify a partnership 
> > with these web designers. I know about code obfuscators... but let's 
> > get real. They don't come close to hiding code (from these web 
> > designers and web admins.) as compiled software is hidden from end 
> > users.
> 
> Compiling with Zend encoder or similar, as stated above.
> 
> 
> > Perhaps someone here remembers my last post - which was about security 
> > of PHP code (from viewing and unauthorized usage). Now, I'm kind of 
> > put against the wall here. I want to get to it, i.e. get to the work. 
> > But after some bad experiences *grunt*, I'm not willing to get 
> > literally squished by blood sucking vampires (*clearing my throat*) 
> > later on.
> 
> You obviously aren't confident working with these people, so consider 
> NOT working for them.
> 
> 
> Justin French
> 
> 

-- 
Co-Founder
Command Prompt, Inc.
The wheel's spinning but the hamster's dead

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



Re: [PHP] Working as a PHP/database developer..

2003-12-01 Thread Justin French
On Tuesday, December 2, 2003, at 12:04  PM, Video Populares et 
Optimates wrote:

Ahoy!

I'm sitting here, pondering on a problem that has just occurred to me. 
Having a short though intensive period of experience with PHP, I'm now 
in the process of being "swallowed" up by a group of web designers. 
That is, I've been offered a job opportunity.

Now, how do you charge your services? Do you do it on a time-slot 
basis (seems kind of awkard to me since much PHP code can be reused a 
l o t!) or do you do it on the basis of the size of projects and 
whether new code has to be developed etc etc?
What's the matter with re-using the code and charging the same rate for 
it?  You're a business, and you're supposed to make money.  I currently 
charge by the hour, but I'm trying whereever possible to move away from 
hourly rates into fixed price services.  Why?

a) The client knows exactly what to expect in terms of price and result
b) I don't spend half my days quoting every last detail of a job
c) I have the opportunity to re-use code over and over, making a 
PROFIT, rather than braking even all the time


Another question is: Since they are the owners of the web servers 
(also in control of the web admins.), they effectively control the PHP 
code that I develop. How do I make sure that I'm not just used once 
for a project and thereafter thrown on the trashbin, i.e. they take 
the code and keep using it for many other projects without my 
knowledge. As far as I'm concerned, a proper pay should be for each 
project that my PHP code goes into. Or do you not agree? Very thankful 
for your opinions here!
Copyright is the simple answer, but it needs to be
a) observed by your clients
b) enforced by you when not observed by clients
You can always compile your scripts, and supply them with compiled 
(encoded) products, rather than source scripts.  This of course would 
depend on the copyright agreement you have with your clients.

And what is a proper pay?
There's no decent answer to that -- there's soo many factors to 
take into consideration, like the market, the economic environment, 
your skills, your productivity, your client's budget, etc etc.  The 
only accurate answer is "twice as much as half".


I would really like to get some tips on how to specify a partnership 
with these web designers. I know about code obfuscators... but let's 
get real. They don't come close to hiding code (from these web 
designers and web admins.) as compiled software is hidden from end 
users.
Compiling with Zend encoder or similar, as stated above.


Perhaps someone here remembers my last post - which was about security 
of PHP code (from viewing and unauthorized usage). Now, I'm kind of 
put against the wall here. I want to get to it, i.e. get to the work. 
But after some bad experiences *grunt*, I'm not willing to get 
literally squished by blood sucking vampires (*clearing my throat*) 
later on.
You obviously aren't confident working with these people, so consider 
NOT working for them.

Justin French

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


Re: [PHP] Important notice

2003-12-01 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> Chris W. Parker wrote:
> > [EMAIL PROTECTED] 
> > on Wednesday, November 26, 2003 9:30 PM said:
> > 
> >>If you feel this transaction was made
> >>by our mistake, please press "No".
> > 
> > I keep clicking "No" but nothing is happening. PLEASE HELP! Maybe it's a
> > bug with PHP??
> > 
> > Chris.
> 
> My keyboard doesn't have a 'No' key.

It should be right under the 'Any' key :-)

-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



Re: [PHP] Please please help - very very urgent

2003-12-01 Thread Chris Shiflett
--- Manisha Sathe <[EMAIL PROTECTED]> wrote:
> I am developing one site. Initially it was working properly, but
> later installed certificate so now instead of http:// now it has
> become https://
> 
> Now all weired things started happenning, it asks whether i want to
> download the file ? if i open the file then it shows me all 'Source
> Codes' instead of HTML output

Yeah, it sounds like you did more than install a new certificate. Look at
the last modified time of your httpd.conf, and I bet it coincides with
your recent installation.

You want to make sure you have this line in there:

AddType application/x-httpd-php .php

If PHP is still not getting parsed (in .php files), then it is likely that
you will need to reinstall Apache again, this time remembering to add
support for PHP.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Please please help - very very urgent

2003-12-01 Thread Robert Cummings
On Mon, 2003-12-01 at 22:46, Manisha Sathe wrote:
> I am developing one site. Initially it was working properly, but later
> installed certificate so now instead of http:// now it has become https://
> 
> Now all weired things started happenning, it asks whether i want to download
> the file ? if i open the file then it shows me all 'Source Codes' instead of
> HTML output, but all plain html files are displayed ok, what is missing ?
> do i need to change any php settings ?? please give me hints on that,
> 
> please please help me - it's very very urgent.

Sounds like your webserver settings aren't set properly fgor HTTPS and
so rather than processing the scripts it thinks they are just files.
This is most likely the case if your files don't end with .html.

HTH,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Please please help - very very urgent

2003-12-01 Thread Manisha Sathe
I am developing one site. Initially it was working properly, but later
installed certificate so now instead of http:// now it has become https://

Now all weired things started happenning, it asks whether i want to download
the file ? if i open the file then it shows me all 'Source Codes' instead of
HTML output, but all plain html files are displayed ok, what is missing ?
do i need to change any php settings ?? please give me hints on that,

please please help me - it's very very urgent.

regards,
manisha

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



Re: [PHP] Picture Width and Height in $_FILES

2003-12-01 Thread Richard Davey
Hello Dimitri,

Tuesday, December 2, 2003, 2:40:27 AM, you wrote:

DM> I've seen the code somewhere but can't remember what it is exactly.
DM> Basically I need to know what the PHP is to get the picture width and
DM> height.

Use getimagesize() on the uploaded file. See PHP manual for details.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP] Picture Width and Height in $_FILES

2003-12-01 Thread Dimitri Marshall
Hi there,
I've seen the code somewhere but can't remember what it is exactly.
Basically I need to know what the PHP is to get the picture width and
height.

I tried:

 $pic = $_FILES[$objectNumber];
 $width = $pic['width'];
 $height = $pic['height'];

... with no success.

Any help is greatly appreciated.

Thanks,
Dimitri Marshall

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



Re: [PHP] Working as a PHP/database developer..

2003-12-01 Thread Jason Sheets
Turck MMCache is a free optimizer/encoder.  There is a free web based 
front end to the encoding part of it available at 
http://phpcoder.shadonet.com.

You can find Turck MMCache at http://turck-mmcache.sourceforge.net

It runs on Windows, Linux, BSD, and most other platforms and works with 
PHP 4 and 5.

That said you should have a discussion with the person making the job 
offer and get a good contract as others have said.  If they want to use 
the code in other projects without paying you each time ask for a higher 
rate.  Also make sure that you maintain the rights to use the code you 
develop in other projects. 

I do work on a per project basis, I base my quote on the number of hours 
I expect it will take me then add 15% I've learned over the years to 
estimate my time well, if you are just starting you will either want to 
quote entirely per project or increase the time by more than 15% (most 
newer people underquote for fear of coming in high and wind up eating it).

If you are quoting based on time you also want to come in slightly ahead 
of schedule, not so much to make them think that you intentionally over 
quoted but enough that it saves them some money and makes you look good.

Jason

Jason
Richard Davey wrote:
Hello Video,

Tuesday, December 2, 2003, 1:04:34 AM, you wrote:

VPeO> Now, how do you charge your services? Do you do it on a
VPeO> time-slot basis (seems kind of awkard to me since much PHP code
VPeO> can be reused a l o t!) or do you do it on the basis of the size
VPeO> of projects and whether new code has to be developed etc etc?
That is for you to decide and your client to agree with. Some will
prefer a fixed-cost project, others prefer time sheets. The fact you
are re-using code isn't a bad thing, I mean, you wrote it in the first
place right? and you're not a charity.. so what if you manage to save
yourself a few hours :)
VPeO> control the PHP code that I develop. How do I make sure that I'm
VPeO> not just used once for a project and thereafter thrown on the
VPeO> trashbin, i.e. they take the code and keep using it for many
Get a good contract. Unless they'll allow PHP script encoding (Zend
Encoder, etc) on their server, you have no other choice.
VPeO> And what is a proper pay?

Depends on country, location within country, age, experience, etc etc
etc.
VPeO> obfuscators... but let's get real. They don't come close to
VPeO> hiding code (from these web designers and web admins.) as
VPeO> compiled software is hidden from end users.
So compile it :)

 

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


Re: [PHP] Variable in $_FILES?

2003-12-01 Thread Kelly Hallman
On Mon, 1 Dec 2003, Dimitri Marshall wrote:
> This is what I'm trying to do:
> $pic = $_FILES['object$objectNumber'];
> $picName = $pic['name'];
> ...
> $objectNumber is being defined, but for some reason this code won't work.
> Can someone tell me why and also what I can do to make it work?

$_FILES["object$objectnumber"] will do it...
( or $_FILES['object'.$objectnumber] )

When you enclose a string in double quotes ("") PHP will interpolate 
variables within the string, as you are trying to do.

When you enclose a string with '' it will be treated as a literal.

You may also consider "object{$objectnumber}" if you need to avoid 
ambiguities with the rest of your string. I personally think it's a good 
habit to use the curlies anyway, but I'm sure that's a matter of debate..

--
Kelly Hallman
// Ultrafancy

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



Re: [PHP] Working as a PHP/database developer..

2003-12-01 Thread Richard Davey
Hello Video,

Tuesday, December 2, 2003, 1:04:34 AM, you wrote:

VPeO> Now, how do you charge your services? Do you do it on a
VPeO> time-slot basis (seems kind of awkard to me since much PHP code
VPeO> can be reused a l o t!) or do you do it on the basis of the size
VPeO> of projects and whether new code has to be developed etc etc?

That is for you to decide and your client to agree with. Some will
prefer a fixed-cost project, others prefer time sheets. The fact you
are re-using code isn't a bad thing, I mean, you wrote it in the first
place right? and you're not a charity.. so what if you manage to save
yourself a few hours :)

VPeO> control the PHP code that I develop. How do I make sure that I'm
VPeO> not just used once for a project and thereafter thrown on the
VPeO> trashbin, i.e. they take the code and keep using it for many

Get a good contract. Unless they'll allow PHP script encoding (Zend
Encoder, etc) on their server, you have no other choice.

VPeO> And what is a proper pay?

Depends on country, location within country, age, experience, etc etc
etc.

VPeO> obfuscators... but let's get real. They don't come close to
VPeO> hiding code (from these web designers and web admins.) as
VPeO> compiled software is hidden from end users.

So compile it :)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP] Refreshing in forms using post

2003-12-01 Thread Richard Davey
Hello Matt,

Monday, December 1, 2003, 10:31:23 PM, you wrote:

MG> Suppose I have a form.  Upon submission, the metadata is posted to a
MG> processing script (a separate PHP file), which parses it and then sends the
MG> user back to a particular page using the header function.  If said user
MG> clicks their browser's back button, the aforementioned processing script
MG> will re-parse that post data and create a duplicate record.  How can I
MG> prevent this?  Cache control?

There is no 100% reliable method of controlling the cache of any
browser. Why not, in your processing script, set a flag or issue
something to the users session to the effect of "already submitted
this form". Then if they do click back and submit it all again you can
check for the existence of this value and give them a nice friendly
error message ("Thanks for your enthusiasm, but you've already done
this!") :)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re[2]: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Richard Davey
Hello rogue,

Monday, December 1, 2003, 10:39:02 PM, you wrote:

r> echo looks fine (no error in the URL). I am stumped. Is there anything
r> besides output to the screen before header() that breaks it?

Other than browser incompatibility, not usually.

You can use the following to determine if a header has been sent
without you perhaps realising it (an extra space before a PHP tag
perhaps)

http://www.google.com/');
exit;
}
?>

Ideally you should exit after the header is finished.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP] Working as a PHP/database developer..

2003-12-01 Thread Video Populares et Optimates
Ahoy!

I'm sitting here, pondering on a problem that has just occurred to me. Having a short 
though intensive period of experience with PHP, I'm now in the process of being 
"swallowed" up by a group of web designers. That is, I've been offered a job 
opportunity.

Now, how do you charge your services? Do you do it on a time-slot basis (seems kind of 
awkard to me since much PHP code can be reused a l o t!) or do you do it on the basis 
of the size of projects and whether new code has to be developed etc etc?

Another question is: Since they are the owners of the web servers (also in control of 
the web admins.), they effectively control the PHP code that I develop. How do I make 
sure that I'm not just used once for a project and thereafter thrown on the trashbin, 
i.e. they take the code and keep using it for many other projects without my 
knowledge. As far as I'm concerned, a proper pay should be for each project that my 
PHP code goes into. Or do you not agree? Very thankful for your opinions here! And 
what is a proper pay?

I would really like to get some tips on how to specify a partnership with these web 
designers. I know about code obfuscators... but let's get real. They don't come close 
to hiding code (from these web designers and web admins.) as compiled software is 
hidden from end users.

Perhaps someone here remembers my last post - which was about security of PHP code 
(from viewing and unauthorized usage). Now, I'm kind of put against the wall here. I 
want to get to it, i.e. get to the work. But after some bad experiences *grunt*, I'm 
not willing to get literally squished by blood sucking vampires (*clearing my throat*) 
later on.

Kind regards,
Video Populares et Optimates


[PHP] Re: Variable in $_FILES?

2003-12-01 Thread Dimitri Marshall
Just to answer my own question, but for reference for anyone else who has
this problem, I made a simple error (not very experienced with PHP). Anyway,
turns out that 'object$objectNumber' is different than 'object'$objectNumber
and also different that just $objectNumber. As most of you know, putting ' '
around a variable makes PHP print it out exactly like that (ie.
'$objectNumber' = $objectNumber in PHP) whereas I just wanted the variable
properties to actually be put into the $_FILES function (or whatever it is).
I couldn't figure out how to put 'object'$objectNumber together so I just
changed it to simply $objectNumber, so it now works.

This is what the code is now:

 $file = $_FILES{$objectNumber};
 $fileName = $file['name'];
 $filetmp = $file['tmp_name'];

... and everything works.

Dimitri Marshall

"Dimitri Marshall" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there,
> This is what I'm trying to do:
>
> $pic = $_FILES['object$objectNumber'];
> $picName = $pic['name'];
> $pictmp = $pic['tmp_name'];
>
> $objectNumber is being defined, but for some reason this code won't work.
> Can someone tell me why and also what I can do to make it work?
>
> Thanks in advance,
> Dimitri Marshall

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



Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Tom Rogers
Hi,

Tuesday, December 2, 2003, 7:17:58 AM, you wrote:
r> Hi all,

r> I have this in a template:

r> $redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
r> header("Location: $redirect");

r> Only, nothing happens when this code is executed. Nothing. It gets 
r> completely ignored.

r> I even tried:

r> $redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
r> echo $redirect;
r> header("Location: $redirect");

r> to try and throw an error,  but all that happens is the value of 
r> $redirect gets sent to the screen and then rest of the page is 
r> displayed. I know the code block is getting executed, but I have no 
r> idea WHY the header() function is not doing its job.

r> Any thoughts? Please CC me on the post since I am on the digest.

r> Thanks


Try adding exit; after the header call.

-- 
regards,
Tom

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



[PHP] 12 seconds!?!?

2003-12-01 Thread Comex
I have a script that replicates a human on a message board, and its logs
(logging in, going to inventory, etc.) occur every 12 (no more no less)
seconds.  Do you know why?

function sendreq($addy,$type,$content = "",$cookie =
"",$useragent="",$host="---") {
$msg = strtoupper($type); // get or post
$msg .= " ";
$msg .= $addy;
$msg .= " HTTP/1.1\r\n";
$msg .= "Host: $host\r\n";
$msg .= "User-agent: $useragent\r\n";
if($cookie != "") $msg .= "Cookie: $cookie\r\n";
if (strtolower($type) == 'post') {
$msg .= "Content-type: application/x-www-form-urlencoded\r\n";
$msg .= "Content-length: ";

$msg .= strlen($content);
$msg .= "\r\n\r\n";
$msg .= $content;
} else {
$msg .= "\r\n";
}

//message is prepared!

$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp) {
die("$errstr ($errno)\n");
} else {
fputs ($fp, $msg);
while (!feof($fp)) {
$result.= fgets ($fp);
}
fclose ($fp);
}
return $result;

}
function extractcookie($result) {
preg_match_all("!Set-Cookie: (.*);!",$result,$matches);

$matches = $matches[1];

return $matches[count($matches)-1];
}

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



[PHP] Variable in $_FILES?

2003-12-01 Thread Dimitri Marshall
Hi there,
This is what I'm trying to do:

$pic = $_FILES['object$objectNumber'];
$picName = $pic['name'];
$pictmp = $pic['tmp_name'];

$objectNumber is being defined, but for some reason this code won't work.
Can someone tell me why and also what I can do to make it work?

Thanks in advance,
Dimitri Marshall

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



[PHP] PEAR: HTML_Progress -- how do I actually use this now?!

2003-12-01 Thread Daevid Vincent
I was very excited when I saw this link and the examples on the site. So
I've downloaded all the files and installed them all. Now I don't know what
to do with it or how to use it!?

The package doesn't have any humanly useable tutorials or quick start or
even a text file describing how I would put this in a web page of my own
site. Instead it seems to force me to use phpDocumentor to build the
corresponding .html files. Ugh!

So, I went through the extremely tedious process of (installing
phpDocumentor and) building the options.ini and stylesheet.css file with a
directory path that gave me carpal-tunnel...
"PEAR\data\PhpDocumentor\phpDocumentor\Converters\HTML\frames\templates\DOM\
earthli\templates\media\stylesheet.css"

Then I deciphered what the heck the author's README file meant to come up
with thiis magic incantation which he could have just typed out and said,
"run this command", or better yet, a shell script that builds the above dir
path, copies the files and runs the below commands.

phpdoc -f /usr/local/lib/php/HTML/Progress.php  -d
/usr/local/lib/php/HTML/Progress -po HTML_Progress -o
HTML:frames:DOM/earthli -t /tmp/Progress/ 

Then trying to get what would appear to be the thing I need to actually use
this tool -- the tutorial -- I get an error that doesn't give any indication
of what file to look at to fix.

phpdoc -f /usr/local/lib/php/HTML/Progress.php  -d
/usr/local/lib/php/HTML/Progress/tutorials -po HTML_Progress -o
HTML:frames:DOM/earthli -t /tmp/Progress/
Parsing configuration file phpDocumentor.ini...
done
using experimental tokenizer Parser
directory: ''  not found

The website doesn't give a single tutorial (or example that I could copy and
change)...
http://pear.laurent-laville.org/HTML_Progress/apidoc/
http://pear.laurent-laville.org/HTML_Progress/examples/

And the progress maker bombs out at the end after you go through 5 tabs of
options.
http://pear.laurent-laville.org/HTML_Progress/examples/ProgressMaker.php

Could someone PLEASE tell me how to use this seemingly useful class? And I
guess, before we even started, what I want to do is query a mySQL database
every second and use the results to show the progress bar, without reloading
the web page. Can that be done with this project, or did I just waste a day?

Excuse my frustration please, but this seems way more complicated than it
should be. But perhaps that's the way PEAR is and since I've never used it,
I've been blissfully ignorant building my own things.

Daevid Vincent
http://daevid.com
  

> -Original Message-
> From: Burhan Khalid [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, November 27, 2003 2:47 AM
> To: Astron of BrOnX; [EMAIL PROTECTED]
> Subject: Re: [PHP] Does anyone have Upload meter php codes?
> 
> Astron of BrOnX wrote:
> > Hi everyone, i am looking for upload meter progress bar 
> codes. I have looked
> > up arround and the most of them needs for patching PHP to get upload
> > variables. And also they are for Linux. I have need a 
> solution for windows.
> > It can be a extra DLL file for PHP but i dont know how i can find?
> 
> http://pear.php.net/package/HTML_Progress
> 
> -- 
> Burhan Khalid
> phplist[at]meidomus[dot]com
> http://www.meidomus.com
> ---
> "Documentation is like sex: when it is good,
>   it is very, very good; and when it is bad,
>   it is better than nothing."
> 
> -- 
> 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] Optimizing PHP Relevancy Ranking Algorithm

2003-12-01 Thread Raditha Dissanayake
What david says +
you have a nested loop,  that means the running time is propotional to 
the square of the number of inputs.  - I haven't looked too hard either.

David Otton wrote:

On Fri, 28 Nov 2003 03:26:08 -0800, you wrote:

 

Anybody got a few ideas on how to speed up these two sluggish lines of 
code? I'm pretty much out of ideas. And if you have any other 
suggestions to speed things up, I would really appreciate them too.
   

I know nothing about your application, and I haven't looked too hard at your
code.
Having said that, you're not actually displaying 20,000 results on the page
at one time, are you? And even if you did, what user is going to go check
what hit no. 14,879 was? Most of your sort-processing is wasted.
Pass over the array once, throwing away everything with a low relevancy.
Then do your sort. If the user does decide to delve further into the
results, then you can shuffle more of the abandoned stuff back in. But 99%
of your users won't go past the first three pages, and you've saved yourself
a vast amount of processor time.
 

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


Re: [PHP] [Stats] PHP Net List: November 2003

2003-12-01 Thread Bill Doerrfeld
At 7:05 PM -0500 12/1/03, David T-G wrote:
Bill --

...and then Bill Doerrfeld said...
%
...
% November, 2003
...
%
% Top 20 Threads by Number of Posts
% --
...
% [PHP]
%  and22
[snip]
Tee hee -- you should validate your input and beware of "newline exploits",
even in the Subject: line!  We should have a "worst interpreted subject"
contest (and if we all talk about it enough it'll make it onto this list
at the end of December ;-)
Thanks for bringing this to our attention. I'll forward this to the 
appropriate person here to resolve. Feel free to send along any 
additional comments/suggestions to [EMAIL PROTECTED] Thanks.
--

-
Bill Doerrfeld[EMAIL PROTECTED]
Blue World Communications, Inc.   http://www.blueworld.com/
-
 Build and serve powerful data-driven Web sites
  with Lasso Studio and Lasso Professional.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Does anyone have Upload meter php codes?

2003-12-01 Thread Raditha Dissanayake
Megaupload does not reply on DHTML.
And sorry guys i have given the wrong link in the prev message. the 
correct one is
http://www.raditha.com/megaupload/



Duncan Hill wrote:

On Thursday 27 November 2003 18:21, Ryan A wrote:
 

http://pear.php.net/package/HTML_Progress
 

Very nice,
But seems to have a problem with Netscape Communicator 4.75
   

Quote: Your browser should accept DHTML feature.

Last I checked, Netscape 4.x weren't very good at that.

 

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


RE: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Chris W. Parker
rogue 
on Monday, December 01, 2003 2:39 PM said:

> echo looks fine (no error in the URL). I am stumped. Is there anything
> besides output to the screen before header() that breaks it?

Create a file with only the following code and see what happens.

http://www.google.com/";);

?>



Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



Re: [PHP] [Stats] PHP Net List: November 2003

2003-12-01 Thread David T-G
Bill --

...and then Bill Doerrfeld said...
% 
...
% November, 2003
...
% 
% Top 20 Threads by Number of Posts
% --
...
% [PHP]
%  and22
[snip]

Tee hee -- you should validate your input and beware of "newline exploits",
even in the Subject: line!  We should have a "worst interpreted subject"
contest (and if we all talk about it enough it'll make it onto this list
at the end of December ;-)


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] [Stats] PHP Net List: November 2003

2003-12-01 Thread Bill Doerrfeld
--
Searchable archives for this list are available at

--
==
PHP Net List Stats
November, 2003
==
Note: Up/Down % as compared with October, 2003

Posts:   3184 (Down 15%)
Authors:  558 (Down  6%)
Threads:  757 (Down  9%)
Top 20 Contributors by Number of Posts
--
Jay Blanchard  146
Chris Shiflett 131
Marek Kilimajer109
David T-G   95
John Nichel 86
Burhan Khalid   71
John W. Holmes  70
Jason Wong  68
Eugene Lee  68
CPT John W. Holmes  63
Chris W. Parker 61
Robert Cummings 51
Raditha Dissanayake 47
Curt Zirzow 39
Kim Steinhaug   38
Wouter van Vliet38
Scott Fletcher  35
Jake McHenry33
pete M  33
- Edwin -   29
Top 20 Threads by Number of Posts
--
[PHP] Add Reply-To to this list(s)  82
[PHP] Include an encoder into PHP distribution? 34
[PHP] High bandwidth application tips   28
[PHP] BTML 2.0 released!!!  27
[PHP]
 and22
[PHP] Can't fetch HTTP POST data in PHP?21
[PHP] Sessions within new windows   20
[PHP] Japanese character validation 18
[PHP] help create community newbie guide to security18
[PHP] Microsoft .NET arguement  18
[PHP] echo or print 18
[PHP] msession - giving me a hard time  17
[PHP] Removing security-problematic chars from strings  17
[PHP] DAMN  16
[PHP] JavaScript question   15
[PHP] location=  Construct Doc  14
[PHP] stepping through alphabet 14
[PHP] Why is the php loop, 'for()', so slow 14
[PHP] strpos() act funny when searching for "]]>"   14
[PHP] Locking mysql tables with PHP 14
Top 20 Search Terms by Number of Requests
--
imagemagick  2
pear 1
bbedit   1
file 1
write1
--
-
Bill Doerrfeld[EMAIL PROTECTED]
Blue World Communications, Inc.   http://www.blueworld.com/
-
 Build and serve powerful data-driven Web sites
  with Lasso Studio and Lasso Professional.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Curt Zirzow
* Thus wrote rogue ([EMAIL PROTECTED]):
> Okay. I reworked the code a bit, but still no go.
> 
> Here is what I have:
> 
> $redirect = "http://"; . $_SERVER['HTTP_HOST'] . 
> "/cm/clients/viewclient.php?id={$_REQUEST['id']}&foo=bar";
> error_reporting(E_ALL);
> echo "Location: $redirect";
> header("Location: $redirect");

hmm... 
 - add a ini_set('display_errors', true);
 - check your logs, apache and php

That code is throwing an warning somewhere.

Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Chris Shiflett
--- rogue <[EMAIL PROTECTED]> wrote:
> echo looks fine (no error in the URL). I am stumped. Is there
> anything  besides output to the screen before header() that breaks
> it?

I'm sure there are lots of things, but I can't think of why your code
would not work. You did remove the echo before trying again, right? Can
you show us the exact output of the echo call?

A more reliable way to see what is going on is to view the actual HTTP
response your script is generating. Do you have a way to examine this?
There is a Mozilla plugin that can show you the HTTP, and there is also
things such as ethereal which can sniff your network traffic. This would
show you whether the proper Location header is actually being sent in the
response.

I suspect it is not, as I'm not aware of any browser that doesn't handle
this header correctly.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Refreshing in forms using post

2003-12-01 Thread Marek Kilimajer
What header are you using? If you use Location header, this should not 
happen.

Matt Grimm wrote:
Suppose I have a form.  Upon submission, the metadata is posted to a
processing script (a separate PHP file), which parses it and then sends the
user back to a particular page using the header function.  If said user
clicks their browser's back button, the aforementioned processing script
will re-parse that post data and create a duplicate record.  How can I
prevent this?  Cache control?
Thanks,
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread rogue
hi again,

echo looks fine (no error in the URL). I am stumped. Is there anything 
besides output to the screen before header() that breaks it?

thanks

On Dec 1, 2003, at 5:13 PM, Chris Shiflett wrote:

--- rogue <[EMAIL PROTECTED]> wrote:
$redirect = "http://"; . $_SERVER['HTTP_HOST'] .
"/cm/clients/viewclient.php?id={$_REQUEST['id']}&foo=bar";
error_reporting(E_ALL);
echo "Location: $redirect";
header("Location: $redirect");
I meant to try using a full URL first, then use echo if it still 
doesn't
work. :-) This shouldn't work as it is, because you have output prior 
to
your header call.

But, since you already tried this, what did the echo output? Did it 
look
correct? Comment that out, and see what happens.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/
PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] random question generation

2003-12-01 Thread Justin French
On Tuesday, December 2, 2003, at 02:01  AM, Frank Tudor wrote:

I am building an application that has course material and one of
the requirments is that questions related to course material pop
up randomly in relation to the question bank and to time.
So if there are 15 pages in a section and four questions need to
populate somewhere after page 1 before the end of the section
what would you guys use to do this.
The questions and answers will be in a database.

Also a question on page 4 can't be asked on page 1.

The questions will not pop up like a javascript event but lay
seeded between the pages it will either happen based on
randomization or not.
Anybody been down this road before?
Well, there's many topics here, including page generation, templating, 
etc etc, but I'll stick to the one in the subject -- random questions.

Store your questions in a database (eg MySQL), and also store the page 
which they relate to.  Your table might look like this:

id,question,answer,page_id

In which case, when it comes time to ask a question after page 3, you 
can use MySQL's RANDOM() function to retrieve 4 questions:

SELECT * FROM questions WHERE page_id=3 ORDER BY RAND() LIMIT 4

You probably need to take notice of the question id and put it in a 
hidden form element, so that you know which answer to look for on the 
next page:

$sql = "SELECT answer FROM questions WHERE id={$_POST['something']}";

Seems easy enough -- what else do you need help with?

Justin French

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


[PHP] Refreshing in forms using post

2003-12-01 Thread Matt Grimm
Suppose I have a form.  Upon submission, the metadata is posted to a
processing script (a separate PHP file), which parses it and then sends the
user back to a particular page using the header function.  If said user
clicks their browser's back button, the aforementioned processing script
will re-parse that post data and create a duplicate record.  How can I
prevent this?  Cache control?

Thanks,
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org

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



[PHP] Search and Replace with WinWord and COM Objects?

2003-12-01 Thread jon
Hey folks...

Hopefully, I'm not the only person out there trying this stuff... but I
haven't been able to find much documentation. I'm trying to do basic
search and replace with Word XP, but am not having any success...

The basics work -- I can connect via com, write some stuff, save a file,
etc... but when it comes to the actual search and replace, it gets ugly.

Here's my sample code:

Version)\n";
$word->visible = true;
$word->Documents->Add();

$word->Selection->Typetext("This is a test");
$word->Selection->Typetext(" 123");
$word->Selection->Find->ClearFormatting();
$word->Selection->Find->Execute
("test","pain",True,'wdFindContinue',False,False,False,False,False,False
);
$word->Documents[1]->SaveAs("c:\wordTest\Useless test5.doc"); 
?>

Here's the output I get:
Loaded word version (10.0) 
Warning: (null)(): Invoke() failed: Exception occurred. Source:
Unavailable Description: Unavailable in C:\Program Files\Apache
Group\Apache2\htdocs\wordFix.php on line 11

Any help would be greatly appreciated...

 -- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557

 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.544 / Virus Database: 338 - Release Date: 11/25/2003
 

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



Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Chris Shiflett
--- rogue <[EMAIL PROTECTED]> wrote:
> $redirect = "http://"; . $_SERVER['HTTP_HOST'] . 
> "/cm/clients/viewclient.php?id={$_REQUEST['id']}&foo=bar";
> error_reporting(E_ALL);
> echo "Location: $redirect";
> header("Location: $redirect");

I meant to try using a full URL first, then use echo if it still doesn't
work. :-) This shouldn't work as it is, because you have output prior to
your header call.

But, since you already tried this, what did the echo output? Did it look
correct? Comment that out, and see what happens.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



[PHP] RE: dhtml/css/javascript help

2003-12-01 Thread Dan McCullough
This is a bit offtopic.  I need someone who is good at
javascriptt/dhtml/css to help me with a piece of a project, I'm at the end
of
my rope and hoping I dont slip.

I wont go into detail here but you can contact me at
[EMAIL PROTECTED]

The project is a small menu project with categories and subcategories.
Serious inquires only.  Ive had enough of people wasting my time.

thanks

dan




-
This mail sent through IMP: http://horde.org/imp/

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



Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread rogue
Okay. I reworked the code a bit, but still no go.

Here is what I have:

$redirect = "http://"; . $_SERVER['HTTP_HOST'] . 
"/cm/clients/viewclient.php?id={$_REQUEST['id']}&foo=bar";
error_reporting(E_ALL);
echo "Location: $redirect";
header("Location: $redirect");

I get NO errors at all :(
It was my understanding that the only thing I needed to worry about 
breaking this, would be if there was some output before the header(). 
There is not, but there are some variables getting set etc.

Anyone else think of anything?

Thanks

On Dec 1, 2003, at 4:48 PM, Chris Shiflett wrote:

--- rogue <[EMAIL PROTECTED]> wrote:
$redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
header("Location: $redirect");
Only, nothing happens when this code is executed.
I would try two things, in this order:

1. Use a full URL. A Location header is defined in the specification as
taking a full URL as an argument. You are using a relative one, which 
is
incorrect.

2. Replace your header call with an echo. Basically, rather than
header("Location: $redirect") use echo "Location: $redirect" instead. 
This
might reveal typos or other problems that are more difficult to inspect
when in the HTTP headers instead of the content.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/
PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Error message trying to include a file

2003-12-01 Thread Curt Zirzow
* Thus wrote Matthias Wulkow ([EMAIL PROTECTED]):
> 
> I have an array filled with urls of javascript files and then I
> include them one by one in a loop.
> 
> for( $i = 0 ; $i < sizeof($this->page->javascript) ; $i++ ){
> 
>  include($this->page->javascript[$i]);
>  //This line above is line 52 shown on error warning
> }

what does print_r($this->page->javascript) yield?

you'd be better off with a loop like:
foreach($this->page->javascript as $file_to_include) {
  include($file_to_include);
}



Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] question regarding subclasses, is this possible to do

2003-12-01 Thread Curt Zirzow
* Thus wrote Luke ([EMAIL PROTECTED]):
> 
> $test->windows->showID();
> $test->windows("Window3")->showID();
> ?>
> ---end php code--

You might want to read:
  http://php.net/oop


Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] replace a chunk peace of string

2003-12-01 Thread Curt Zirzow
* Thus wrote ada ([EMAIL PROTECTED]):
> > What do you mean trim() doesn't work?
> 
> trim is a basic function that remove spaces on the left and the right at the
> string :
> " abc"->"abc"

trim() removes more than spaces, please read:
  http://php.net/trim


What I meant in my original post was how are you using trim() that
doesn't make it work?  trim() *will* fix your problem.


Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



[PHP] Error message trying to include a file

2003-12-01 Thread Matthias Wulkow

Hi php-general,

sorry for the post before, forget the sentence about the writehead
function. It means writeHead() (error Warning doesn't seem to be case
sensitive...). It's the name of my method... :-(
But it has nothing to do with the error itself...

SvT

-- 
Who is the ennemy?

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



Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Chris Shiflett
--- rogue <[EMAIL PROTECTED]> wrote:
> $redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
> header("Location: $redirect");
> 
> Only, nothing happens when this code is executed.

I would try two things, in this order:

1. Use a full URL. A Location header is defined in the specification as
taking a full URL as an argument. You are using a relative one, which is
incorrect.

2. Replace your header call with an echo. Basically, rather than
header("Location: $redirect") use echo "Location: $redirect" instead. This
might reveal typos or other problems that are more difficult to inspect
when in the HTTP headers instead of the content.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



[PHP] Error message trying to include a file

2003-12-01 Thread Matthias Wulkow

Hi php-general,

I have an array filled with urls of javascript files and then I
include them one by one in a loop.

for( $i = 0 ; $i < sizeof($this->page->javascript) ; $i++ ){

 include($this->page->javascript[$i]);
 //This line above is line 52 shown on error warning
}

When I had only two files to include it worked. Now I added a third
and I get following error message:

Notice: Undefined offset: 2 in /usr/local/www/ViewPageClass.php on line 52

Warning: writehead() [function.writehead]:
Failed opening '' for inclusion (include_path='.:/usr/local/lib/php')
in /usr/local/www/ViewPageClass.php on line 52

I don't really know what to do,the function writehead doesn't seem to
exist... the javascript file is
http://pajhome.org.uk/crypt/md5/md5.js. I suppose it's free of
errors...

SvT

-- 
Who is the ennemy?

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



Re: [PHP] header("Location: page.php") not redirecting

2003-12-01 Thread Curt Zirzow
* Thus wrote rogue ([EMAIL PROTECTED]):
> 
> $redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
> header("Location: $redirect");
> 
> Only, nothing happens when this code is executed. Nothing. It gets 
> completely ignored.
> 
> I even tried:
> 
> $redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
> echo $redirect;
> header("Location: $redirect");

You're error_reporting is too low, set it to something like:
  error_reporting(E_ALL);

before the header() call

Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



[PHP] question regarding subclasses, is this possible to do

2003-12-01 Thread Luke
Hi, i was wondering if the last line of the following code is possible
somehow (the second last works perfect) but say i wanted to automatically
get the id (or anything else for that particular window) would it be
possible? or would i have to include a new function in windows called setID
or something like that?

php code-
windows = new windows();
 }
 function getSize(){
  return "Big House";
 }


}

class windows{
 var $id;
 function windows($id = "all"){
  $this->id = $id;
 }
 function showID(){
   echo "ID: " . $this->id;
 }
}

$test = new house();

echo $test->getSize() . "\n\n";

$test->windows->showID();
$test->windows("Window3")->showID();
?>
---end php code--

I could always have $test->windows->setID($id) then display the properties
for that current window, but it would be sumpler if i could use
$test->windows($id)->showID() and if no var is there, show all...any ideas
on how to do this?

Thanks heaps

Luke

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



[PHP] header("Location: page.php") not redirecting

2003-12-01 Thread rogue
Hi all,

I have this in a template:

$redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
header("Location: $redirect");
Only, nothing happens when this code is executed. Nothing. It gets 
completely ignored.

I even tried:

$redirect = "viewclient.php?id={$_REQUEST['id']}&foo=bar";
echo $redirect;
header("Location: $redirect");
to try and throw an error,  but all that happens is the value of 
$redirect gets sent to the screen and then rest of the page is 
displayed. I know the code block is getting executed, but I have no 
idea WHY the header() function is not doing its job.

Any thoughts? Please CC me on the post since I am on the digest.

Thanks

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


Re: [PHP] replace a chunk peace of string

2003-12-01 Thread ada
> What do you mean trim() doesn't work?

trim is a basic function that remove spaces on the left and the right at the
string :
" abc"->"abc"

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



Re: [PHP] date() function doesn't seem to work right...

2003-12-01 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
> When I do this script, I didn't get a ":" and numbers in second.
> --snip--
> date("Y-m-d H:i:s");
> --snip--
> 

works fine with phpversion() 4.2.2

Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



[PHP] PHP Community Site - Volunteers Needed

2003-12-01 Thread Chris Shiflett
PHP has one of the largest developer communities in the world, yet we have
no community gathering place like those you can find for other languages
(Perl has http://use.perl.org/, for example).

Want to help change this? Read on. Don't care? Click delete. :-)

I am coordinating the development of a Web site that is built by and for
the PHP community. Its features will include such things as:

1. Personal blogs for all registered users
2. Frequent community news and user comments (Slashdot style)
3. Weekly summaries of key mailing lists (such as php-general)
4. Weekly summaries of other news from related communities
5. News from various user groups (such as NYPHP)
6. Links, FAQs, articles, tutorials, and other helpful documentation

More importantly, the features will be driven by the needs of the
community and not any one person. This list is just an example of the most
common features found on other community sites.

Will this site seek to eliminate other PHP sites that offer one or more of
these features already? Absolutely not. My hope is to help bring the
community together, both the people in the community as well as all
related Web sites.

I have spoken with O'Reilly, and they have agreed to support us in this
endeavor with servers, bandwith, administration, and anything else we
need. All we have to do is provide the people to develop and maintain the
site and its content.

You don't have to be an expert to help out. I need people to fill the
following roles (multiple people can fill the same role and a single
person can fill multiple roles):

1.  Site management and global vision
2.  Coding standards creation and software architecture
3.  Security audits and general guidance
4.  Weekly summary of php-general
5.  Weekly summary of php-internals
6.  Weekly summary of general community news
7.  News item selection and posting (users can submit suggested news)
8.  Database design
9.  Software development (PHP, Perl, etc.)
10. PHP user group representatives (updated news from your group)
11. Content writers (FAQs, articles, tutorials, etc.)
12. Graphic designers, user interface specialists, etc.
13. Translators

There are likely many other roles to be filled. If you think you can help
out a lot, please consider the first role, site management and global
vision. If you want to help but don't feel like you fit into any specific
role, don't worry about it (any help is very much appreciated).

There will be mailing lists, CVS, and other tools available to assist in
the creation of this site. More information about these things will be
given to those who are interested in being involved.

Please send me an email at [EMAIL PROTECTED] if you are willing to help.
Mention where you are interested in helping and any information about
yourself that you think is important. This information is not intended to
determine whether anyone is "worthy" or any silliness like that, but it is
rather to help organize the contributors so that everyone is doing
something they enjoy.

Thanks for your attention.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] replace a chunk peace of string

2003-12-01 Thread Curt Zirzow
* Thus wrote ada ([EMAIL PROTECTED]):
> select hex("a
> ")
> ->
> 610D0A
> always 0D0A at the ends :(
> 
> I' m on windows, and i didn't manage to destroy this peace of string :(
> trim() doesn't work ...

What do you mean trim() doesn't work? 


Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] string

2003-12-01 Thread Matt Matijevich

Name|17|5|7|12|26|8|4|0|2|0|40|12.50|3|33.30|19 it should 16 pieces. 
Any 
thoughts on how I can get it to cut off at the 19, one thing that I
should say 
is 19 is value that can change.


Can't you just use the explode function?
http://www.php.net/manual/en/function.explode.php

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



[PHP] Kerberos authentication with PHP

2003-12-01 Thread Pablo Gosse
Hi all.  I'd like to use Kerberos to authenticate users and I'm looking
for a decent tutorial on how to accomplish this.  I've Googled this and
have searched the archives but I can't find any decent links which point
to useful tutorials.

Anyone have one they'd like to share?

Cheers and TIA,

Pablo

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



[PHP] string

2003-12-01 Thread php-general
I'm parsing some content I get back from a website, and I for most of the 
cases I get the infromation back and everything is formatted correctly.  There 
is this one part where I get back a bunch of crap on the end.

example:

 


One thing I have going for me, beside my dashing good looks, is I know exactly 
the length of what I am supposed to get back.  
Name|17|5|7|12|26|8|4|0|2|0|40|12.50|3|33.30|19 it should 16 pieces.  Any 
thoughts on how I can get it to cut off at the 19, one thing that I should say 
is 19 is value that can change.



-
This mail sent through IMP: http://horde.org/imp/

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



[PHP] configure hangs on SunOS 5.8

2003-12-01 Thread Bill Shupp
Hello,

I'm trying to configure php 4.3.4 on SunOS 5.8, but configure hangs 
just after "checking host system type":

bash-2.03# ./configure
loading cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for working sed... sed
checking host system type... sparc-sun-solaris2.8
Any ideas?

Regards,

Bill Shupp

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


Re: [PHP] file uploads

2003-12-01 Thread Eugene Lee
On Mon, Dec 01, 2003 at 02:00:34PM +, Jon Bennett wrote:
: 
: Hi Chris,
: 
: I think you're referring to this:
: 
: $_FILES["image"]["tmp_name"]
: 
: In my class I pass this as a reference:
: 
: $aArgs['Image'] = $_FILES["image"];
: 
: Then, $aImage in my storeBigImage() method is passed the 
: $aArgs['Image'] when it's called:
: 
: $this->storeBigImage($productID, $aArgs['Image']);
: 
: All the image details are there because otherwise functions like 
: getimagesize would fail, it just won't save the resized or, if the 
: dimensions of the uploaded image aren't bigger than my max width and 
: height, original image, and I really have no idea why!!

In your storeBigImage() method, what do you get if you do:

print_r($aArgs);

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



Re: [PHP] regular expression, image, name, alt, title, preg_match_all

2003-12-01 Thread Adam i Agnieszka Gasiorowski FNORD
Sophie Mattoug wrote:
 
> Sophie Mattoug wrote:
> 
> > Adam i Agnieszka Gasiorowski FNORD wrote:
> >
> >> I'm trying to develop a regex for matching
> >> with preg_match_all, I want to match such things
> >> like image name, image alt text, image title in
> >> construct like this:
> >>
> >> html...
> >> 
> >>  
> >>  
> >>   text
> >>  
> >> 
> >> html...
> >> The rexex as for now is:
> >>
> >> define(
> >>'REGEX_IMAGE_NAMES_AND_TITLES_AND_ALTS_FROM_CONTENT',
> >>'{
> >> (?:<\s*img\s+src\s*=\s*(?:"|\')?\s*(?:img)?\s*=\s*)   #
> >> 
> >> (?>\b\S+\b)   # name
> >> (?:title\s*=\s*(?:"|\'))  #
> >> title
> >> (?>\b\S*\b)
> >> (?:"|\')*\s*
> >> (?:alt\s*=\s*(?:"|\'))# alt
> >> (?>\b\S*\b)
> >> (?:"|\')*\s*
> >> (?:\"|\'|>|/>|\s) # 
> >> }Uix'
> >>  );
> >>
> >> , but it does not match. How can I fix it?
> >>
> >>
> >
> > It's not so easy to match an entire IMG tag, because first of all the
> > attributes are not always in the same order. If I were you, this is
> > what I would do :
> > ereg("]+)>", $your_text, $img_array);
> > $i = 0;
> > foreach ($img_array as $img) {
> >  while (ereg("^(.+)=\"(.+)\"", "", $img, $regs))
> >$images[$i][$regs[1]] = $regs[2];
> >  $i++;
> > }
> >
> > Hope this helps,
> 
> Sorry I made a mistake. Better do this:
> ereg("]+)>", $your_text, $img_array);
> $i = 0;
> foreach ($img_array as $img) {
>  while (ereg("^(.+)=\"(.+)\"(.+)$", "", $img, $regs))  {
>$images[$i][$regs[1]] = $regs[2];
> $img = $regs[3];
>   }
>  $i++;
> }

Ah, now I get it. I'll try it 
 (with preg-functions, as I prefer them).

So I'll get something like

 $images = array(
 [0] => array(
  src => 'image1.jpg',
  alt => '',
  title => 'a cow'
 ),
 [1] ...
)

 ...nice :8]. Thank you!

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



Re: [PHP] regular expression, image, name, alt, title, preg_match_all

2003-12-01 Thread Adam i Agnieszka Gasiorowski FNORD
Sophie Mattoug wrote:
 
> Adam i Agnieszka Gasiorowski FNORD wrote:
> 
> >   I'm trying to develop a regex for matching
> > with preg_match_all, I want to match such things
> > like image name, image alt text, image title in
> > construct like this:
> >
> > html...
> > 
> >  
> >  
> >   text
> >  
> > 
> > html...
> > The rexex as for now is:
> >
> >define(
> >'REGEX_IMAGE_NAMES_AND_TITLES_AND_ALTS_FROM_CONTENT',
> >'{
> > (?:<\s*img\s+src\s*=\s*(?:"|\')?\s*(?:img)?\s*=\s*)   #  
> > (?>\b\S+\b)   # name
> > (?:title\s*=\s*(?:"|\'))  # title
> > (?>\b\S*\b)
> > (?:"|\')*\s*
> > (?:alt\s*=\s*(?:"|\'))# alt
> > (?>\b\S*\b)
> > (?:"|\')*\s*
> > (?:\"|\'|>|/>|\s) # 
> > }Uix'
> >  );
> >
> > , but it does not match. How can I fix it?
> >
> >
> 
> It's not so easy to match an entire IMG tag, because first of all the
> attributes are not always in the same order. If I were you, this is what
> I would do :
> ereg("]+)>", $your_text, $img_array);
> $i = 0;
> foreach ($img_array as $img) {
>   while (ereg("^(.+)=\"(.+)\"", "", $img, $regs))
> $images[$i][$regs[1]] = $regs[2];
>   $i++;
> }
> 
> Hope this helps,

What I 
 really want to get out of this regex is
 1) image name
 2) image alt text
 3) image title text
 , so only those three parentheses are of capturing
 kind and the rest is marked as non-capturing...
 I wonder will this work (if I change this part):
 (?:
  (?:title\s*=\s*(?:"|\'))  # title
  (?>\b\S*\b)
  (?:"|\')*\s*
 |
  (?:alt\s*=\s*(?:"|\'))# alt
  (?>\b\S*\b)
  (?:"|\')*\s*
 )

 , notice the "or" character. I guess it should
 match, as the order is not important now...
 I love monster regexes ;8].

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



[PHP] Contract Position at New York Post for PHP-PostgreSQL Developer

2003-12-01 Thread Heather Johnson
The New York Post is seeking a part-time consultant to participate in 
the planning and development of a web-based registration project. The 
position will last for approximately 3 months or until the candidate's 
role in the project is completed. The candidate will work with other 
programmers on staff to integrate database-backed online registration 
with an existing demographics database implemented in PostgreSQL and 
will report directly to the Senior Database Programmer. Work from home 
is an option. Salary commensurate with experience. There is a 
possibility for additional contracts with the Post and/or full-time 
employment in the future. The successful candidate will have the following:

* Basic familiarity with Unix (Solaris and/or FreeBSD preferred)
* Moderate to advanced knowledge of PostgreSQL (MySQL ok, but PostgreSQL 
preferred)
* Experience with database planning (e.g., table design, indexing, 
logging, performance, knowledge of plpgsql a plus)
* Experience with web-based registration projects a strong plus
* Moderate to advanced knowledge of PHP (e.g., experience with functions 
that interface with PostgreSQL or MySQL a must, knowledge of application 
security a plus)
* Basic html (forms, tables)

Please email or mail resume and cover letter describing your 
qualifications to:

Heather Johnson
Senior Database Programmer
New York Post
1211 6th Avenue, 9th Floor
New York, NY 10036
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problems with ldap_modify() and very large entries

2003-12-01 Thread Peter J Hartman
Here is a problem which I've been completely unable to unravel.
Basically, if I call ldap_modify (or ldap_mod_replace) with a VERY large
amount of data in the attributes array (see ldif below), the browser
will just turn and turn and turn and never finish or report anything.

But, I can do a print_r on the array passed to
ldap_mod_replace and run ldap_modify from the commandline on it (after
properly formatting it) and it works absolutely and quickly.

I can't figure this out.  Any help would be very very nice.  If you need
me to provide more information, let me know.

Peter

the ldif file:

dn: 
mnTB=CB2,mnTS=Bulletin,mnTS=Worship,mnT=index,dc=berkeyavenue,dc=in,dc=us,dc=mennonite,dc=net
mnappparam: 
tmpFolderSettings:YToxNTp7czo1OiJmaWxlcyI7YTo1Mjp7aTowO2E6NTp7czo0OiJuYW1lIjtzOjY6Im91dHB1dCI7czo2OiJzdGF0dXMiO3M6NzoidmlzaWJsZSI7czoyOiJkbiI7czo5MToibW5GPW91dHB1dCxtbk9EPUJ1bGxldGlucyxtbk9EPU15IERvY3VtZW50cyxkYz1iZXJrZXlhdmVudWUsZGM9aW4sZGM9dXMsZGM9bWVubm9uaXRlLGRjPW5ldCI7czoxMjoiZXhwRGF0ZU5ldmVyIjtzOjU6Im5ldmVyIjtzOjc6ImV4cERhdGUiO3M6MTk6IjIwMDUtMTEtMjkgMTU6MjQ6NDUiO31pOjE7YTo1OntzOjQ6Im5hbWUiO3M6MTU6IkIyMDAzLTExLTIzLnJ0ZiI7czo2OiJzdGF0dXMiO3M6NzoidmlzaWJsZSI7czoyOiJkbiI7czoxMDA6Im1uRj1CMjAwMy0xMS0yMy5ydGYsbW5PRD1CdWxsZXRpbnMsbW5PRD1NeSBEb2N1bWVudHMsZGM9YmVya2V5YXZlbnVlLGRjPWluLGRjPXVzLGRjPW1lbm5vbml0ZSxkYz1uZXQiO3M6MTI6ImV4cERhdGVOZXZlciI7czo1OiJuZXZlciI7czo3OiJleHBEYXRlIjtzOjE5OiIyMDA1LTExLTI5IDEzOjQzOjQ0Ijt9aToyO2E6NTp7czo0OiJuYW1lIjtzOjE1OiJCMjAwMy0xMS0xNi5ydGYiO3M6Njoic3RhdHVzIjtzOjc6InZpc2libGUiO3M6MjoiZG4iO3M6MTAwOiJtbkY9QjIwMDMtMTEtMTYucnRmLG1uT0Q9QnVsbGV0aW5zLG1uT0Q9TXkgRG9jdW1lbnRzLGRjPWJlcmtleWF2ZW51ZSxkYz1pbixkYz11cyxkYz1tZW5ub25pdGUsZGM9bmV0IjtzOjE!
yOiJleHBEYXRlTmV2ZXIiO3M6NToibmV2ZXIiO3M6NzoiZXhwRGF0ZSI7czoxOToiMjAwNS0xMS0yOSAxMzo0Mzo0NCI7fWk6MzthOjU6e3M6NDoibmFtZSI7czoxNToiQjIwMDMtMTEtMDkucnRmIjtzOjY6InN0YXR1cyI7czo3OiJ2aXNpYmxlIjtzOjI6ImRuIjtzOjEwMDoibW5GPUIyMDAzLTExLTA5LnJ0Zixtbk9EPUJ1bGxldGlucyxtbk9EPU15IERvY3VtZW50cyxkYz1iZXJrZXlhdmVudWUsZGM9aW4sZGM9dXMsZGM9bWVubm9uaXRlLGRjPW5ldCI7czoxMjoiZXhwRGF0ZU5ldmVyIjtzOjU6Im5ldmVyIjtzOjc6ImV4cERhdGUiO3M6MTk6IjIwMDUtMTEtMjkgMTM6NDM6NDQiO31pOjQ7YTo1OntzOjQ6Im5hbWUiO3M6MTU6IkIyMDAzLTExLTAyLnJ0ZiI7czo2OiJzdGF0dXMiO3M6NzoidmlzaWJsZSI7czoyOiJkbiI7czoxMDA6Im1uRj1CMjAwMy0xMS0wMi5ydGYsbW5PRD1CdWxsZXRpbnMsbW5PRD1NeSBEb2N1bWVudHMsZGM9YmVya2V5YXZlbnVlLGRjPWluLGRjPXVzLGRjPW1lbm5vbml0ZSxkYz1uZXQiO3M6MTI6ImV4cERhdGVOZXZlciI7czo1OiJuZXZlciI7czo3OiJleHBEYXRlIjtzOjE5OiIyMDA1LTExLTI5IDEzOjQzOjQ0Ijt9aTo1O2E6NTp7czo0OiJuYW1lIjtzOjE1OiJCMjAwMy0xMC0yNi5ydGYiO3M6Njoic3RhdHVzIjtzOjc6InZpc2libGUiO3M6MjoiZG4iO3M6MTAwOiJtbkY9QjIwMDMtMTAtMjYucnRmLG1uT0Q9QnVsbGV0aW5zLG1uT0Q9TXkgRG9jdW1lbnRzLGRjPWJlcmtl!
eWF2ZW51ZSxkYz1pbixkYz11cyxkYz1tZW5ub25pdGUsZGM9bmV0IjtzOjEyOiJleHBEYXRlTmV2ZXIiO3M6NToibmV2ZXIiO3M6NzoiZXhwRGF0ZSI7czoxOToiMjAwNS0xMS0yOSAxMzo0Mzo0NCI7fWk6NjthOjU6e3M6NDoibmFtZSI7czoxNToiQjIwMDMtMTAtMTkucnRmIjtzOjY6InN0YXR1cyI7czo3OiJ2aXNpYmxlIjtzOjI6ImRuIjtzOjEwMDoibW5GPUIyMDAzLTEwLTE5LnJ0Zixtbk9EPUJ1bGxldGlucyxtbk9EPU15IERvY3VtZW50cyxkYz1iZXJrZXlhdmVudWUsZGM9aW4sZGM9dXMsZGM9bWVubm9uaXRlLGRjPW5ldCI7czoxMjoiZXhwRGF0ZU5ldmVyIjtzOjU6Im5ldmVyIjtzOjc6ImV4cERhdGUiO3M6MTk6IjIwMDUtMTEtMjkgMTM6NDM6NDQiO31pOjc7YTo1OntzOjQ6Im5hbWUiO3M6MTU6IkIyMDAzLTEwLTEwLnJ0ZiI7czo2OiJzdGF0dXMiO3M6NzoidmlzaWJsZSI7czoyOiJkbiI7czoxMDA6Im1uRj1CMjAwMy0xMC0xMC5ydGYsbW5PRD1CdWxsZXRpbnMsbW5PRD1NeSBEb2N1bWVudHMsZGM9YmVya2V5YXZlbnVlLGRjPWluLGRjPXVzLGRjPW1lbm5vbml0ZSxkYz1uZXQiO3M6MTI6ImV4cERhdGVOZXZlciI7czo1OiJuZXZlciI7czo3OiJleHBEYXRlIjtzOjE5OiIyMDA1LTExLTI5IDEzOjQzOjQ0Ijt9aTo4O2E6NTp7czo0OiJuYW1lIjtzOjE0OiJCMjAwMy0xMC0zLnJ0ZiI7czo2OiJzdGF0dXMiO3M6NzoidmlzaWJsZSI7czoyOiJkbiI7czo5OToibW5GPUIyMDAzLTEwLTMucnRmL!
G1uT0Q9QnVsbGV0aW5zLG1uT0Q9TXkgRG9jdW1lbnRzLGRjPWJlcmtleWF2ZW51ZSxkYz1pbixkYz11cyxkYz1tZW5ub25pdGUsZGM9bmV0IjtzOjEyOiJleHBEYXRlTmV2ZXIiO3M6NToibmV2ZXIiO3M6NzoiZXhwRGF0ZSI7czoxOToiMjAwNS0xMS0yOSAxMzo0Mzo0NCI7fWk6OTthOjU6e3M6NDoibmFtZSI7czoxNToiQjIwMDMtMDktMjgucnRmIjtzOjY6InN0YXR1cyI7czo3OiJ2aXNpYmxlIjtzOjI6ImRuIjtzOjEwMDoibW5GPUIyMDAzLTA5LTI4LnJ0Zixtbk9EPUJ1bGxldGlucyxtbk9EPU15IERvY3VtZW50cyxkYz1iZXJrZXlhdmVudWUsZGM9aW4sZGM9dXMsZGM9bWVubm9uaXRlLGRjPW5ldCI7czoxMjoiZXhwRGF0ZU5ldmVyIjtzOjU6Im5ldmVyIjtzOjc6ImV4cERhdGUiO3M6MTk6IjIwMDUtMTEtMjkgMTM6NDM6NDQiO31pOjEwO2E6NTp7czo0OiJuYW1lIjtzOjE1OiJCMjAwMy0wOS0yMS5ydGYiO3M6Njoic3RhdHVzIjtzOjc6InZpc2libGUiO3M6MjoiZG4iO3M6MTAwOiJtbkY9QjIwMDMtMDktMjEucnRmLG1uT0Q9QnVsbGV0aW5zLG1uT0Q9TXkgRG9jdW1lbnRzLGRjPWJlcmtleWF2ZW51ZSxkYz1pbixkYz11cyxkYz1tZW5ub25pdGUsZGM9bmV0IjtzOjEyOiJleHBEYXRlTmV2ZXIiO3M6NToibmV2ZXIiO3M6NzoiZXhwRGF0ZSI7czoxOToiMjAwNS0xMS0yOSAxMzo0Mzo0NCI7fWk6MTE7YTo1OntzOjQ6Im5hbWUiO3M6MTU6IkIyMDAzLTA5LTE0LnJ0ZiI7czo2OiJzdGF0dXMiO3M6Nz!
oidmlzaWJsZSI7czoyOiJkbiI7czoxMDA6Im1uRj1CMjAwMy0wOS0xNC5ydGYsbW5PRD1CdWxsZXRpbnMsbW5PRD1NeSBEb2N1bWVudHMsZGM9YmVya2V5YXZlbnVlLGRjPWluLGRjPXVzLGRjPW1lbm5vbml0ZSxkYz1uZXQiO3M6MTI6ImV4cERhdGVOZXZlciI7czo1OiJuZXZlciI7czo3OiJleHBEYXRlIjtzOjE5OiIyMDA1LTExLTI5IDEzOjQzOjQ0Ijt9aToxMjthOjU6e3M6NDoibmFtZSI7czoxNToiQjIwMDMtMDktMDcucnRmIjtzOjY6In

[PHP] Re: Friendly dates

2003-12-01 Thread Scott Fletcher
Something like this, but this is not perfect..  The mktime seem to work only
for Unix/Linux and not work for Windows.

--snip--
function dateDiff($input_date)
{
   //MSG #1 - Parameter1 must be in this date format --> "mm/dd/"
   //MSG #2 - This script does not include fix for the leap year...
   $UserInput = explode("/", $input_date);

   $UserInputMonth = $UserInput[0];
   $UserInputDay = $UserInput[1];
   $UserInputYear = $UserInput[2];

   $clockDate = mktime(0,0,0,date("m"),date("d"),date("Y"));
   $inputDate = mktime(0,0,0,$UserInputMonth,$UserInputDay,$UserInputYear);

   $Days = (($clockDate - $inputDate) / (24 * 3600));
   $Days = round($Days);

   return $Days;
}
--snip--

"Richard Davey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm just wondering if anyone knows of a class/function (or easy way)
> to do the following:
>
> At the moment I display dates like this:
>
> Last message received: 30th Nov 2003 16:07
>
> This is fine, but I would like to make them more friendly like so:
>
> Last message received: Yesterday, 16:07
>
> I would ideally like to have the ranges "Today, Yesterday, This Week, Last
> Week" and beyond that I'll use the method above.
>
> I know how to actually do this from a code point of view, but think it
> must be a quite general sort of task and am all for not re-inventing
> the wheel here if someone knows/has a quick way to do this?
>
> -- 
> Best regards,
>  Richard  mailto:[EMAIL PROTECTED]

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



Re: [PHP] date() function doesn't seem to work right...

2003-12-01 Thread Chris Shiflett
--- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> When I do this script, I didn't get a ":" and numbers in second.
> --snip--
> date("Y-m-d H:i:s");
> --snip--
> 
>  But when I do this script by adding a period to it, it worked okay.
> --snip--
> date("Y-m-d H:i:s.");
> --snip--

Either this is a bug, or you're misrepresenting your code. Did you try
this with a test script that does nothing but echo each of these? If so,
can you show us your exact code (copy and paste to eliminate typos) and
exact output (same thing)?

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



[PHP] Re: Friendly dates

2003-12-01 Thread Scott Fletcher
Perhap a date difference will help, PHP doesn't have this feature,
date_diff() while C/C++ have this feature.  So, there is a way, you can use
the date() function and get the day difference.  So, if you have one day
difference, you use the if statement or switch statement to use the word
'Yesterday'.  For 'Last Week', I don't know because it is a little tricky.
:-)  Someone else may know of something better than I do.

Scott

"Richard Davey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm just wondering if anyone knows of a class/function (or easy way)
> to do the following:
>
> At the moment I display dates like this:
>
> Last message received: 30th Nov 2003 16:07
>
> This is fine, but I would like to make them more friendly like so:
>
> Last message received: Yesterday, 16:07
>
> I would ideally like to have the ranges "Today, Yesterday, This Week, Last
> Week" and beyond that I'll use the method above.
>
> I know how to actually do this from a code point of view, but think it
> must be a quite general sort of task and am all for not re-inventing
> the wheel here if someone knows/has a quick way to do this?
>
> -- 
> Best regards,
>  Richard  mailto:[EMAIL PROTECTED]

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



Re: [PHP] Question on sending PhP variable results to an HTML page to be displayed.

2003-12-01 Thread Chris Shiflett
--- Al Costanzo <[EMAIL PROTECTED]> wrote:
> This will not work because the page in question ends in .HTML but I
> did discover a way to do what I need and an answer to many other
> posts.
> 
> Here is the answer:
> 
> To make a PHP command to execute on a .html page create another page
> ending in .php with the code there. Where you need to display this in
> your .html page use the  html tag. It works just fine.

This will work, but it sure seems ugly. There are possibly better
alternatives for you. For example, you can make your Web server interpret
.html files as PHP, or you can use the proper .php extension.

Are either of these a possibility for you?

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] date() function doesn't seem to work right...

2003-12-01 Thread Scott Fletcher
Okay thanks...  I'll do a workaround for now until PHP get upgraded in the
near future.

"Thijs Lensselink" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Scott Fletcher wrote on maandag 1 december 2003 16:41:
>
> When I do this script, I didn't get a ":" and numbers in second.
> : --snip--
> : date("Y-m-d H:i:s");
> : --snip--
> :
> : But when I do this script by adding a period to it, it worked
> : okay. --snip--
> : date("Y-m-d H:i:s.");
> : --snip--
> :
> : Thanks,
> :  Scott
>
> On my Unix box running php 4.2.3 the output is this:
> 2003-12-01 16:25:06
> 2003-12-01 16:25:06.
>
> Looks good to me!

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



Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Down't worry, it's sorted!

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
sorry, made a mistake when writing my email:

return = $aNewImage['new_name'];

should be:

return $aNewImage['new_name'];

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Friendly dates

2003-12-01 Thread Richard Davey
Hi,

I'm just wondering if anyone knows of a class/function (or easy way)
to do the following:

At the moment I display dates like this:

Last message received: 30th Nov 2003 16:07

This is fine, but I would like to make them more friendly like so:

Last message received: Yesterday, 16:07

I would ideally like to have the ranges "Today, Yesterday, This Week, Last
Week" and beyond that I'll use the method above.

I know how to actually do this from a code point of view, but think it
must be a quite general sort of task and am all for not re-inventing
the wheel here if someone knows/has a quick way to do this?

-- 
Best regards,
 Richard  mailto:[EMAIL PROTECTED]

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



Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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] date() function doesn't seem to work right...

2003-12-01 Thread Thijs Lensselink
Scott Fletcher wrote on maandag 1 december 2003 16:41:

When I do this script, I didn't get a ":" and numbers in second.
: --snip--
: date("Y-m-d H:i:s");
: --snip--
: 
: But when I do this script by adding a period to it, it worked
: okay. --snip--
: date("Y-m-d H:i:s.");
: --snip--
: 
: Thanks,
:  Scott

On my Unix box running php 4.2.3 the output is this:
2003-12-01 16:25:06
2003-12-01 16:25:06.

Looks good to me!

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



RE: [PHP] date() function doesn't seem to work right...

2003-12-01 Thread Jay Blanchard
[snip]
When I do this script, I didn't get a ":" and numbers in second.
--snip--
date("Y-m-d H:i:s");
--snip--
[/snip]

When I cut and paste your code (PHP v 4.3.n) it works OK

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



[PHP] date() function doesn't seem to work right...

2003-12-01 Thread Scott Fletcher
Hi Everyone!!!

I noticed that date() function act a little funny, so I am wondering if
anyone of you have noticed this problem or not.  I'm just curious because I
wanna know if it is my issue or is it a general issue for everyone.  I'm
using PHP version 4.2.3 on Unix machine.  Please don't ask me to upgrade to
newer version because I don't have much time for it.

When I do this script, I didn't get a ":" and numbers in second.
--snip--
date("Y-m-d H:i:s");
--snip--

But when I do this script by adding a period to it, it worked okay.
--snip--
date("Y-m-d H:i:s.");
--snip--

Thanks,
 Scott

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



Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, where 
You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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] file uploads

2003-12-01 Thread Pavel Jartsev
Jon Bennett wrote:
Just to clarify about using move_uploaded_file()

...

function addProduct(){

// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}

...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
...


Just noticed one thing... maybe it's just a typo, but directory, where 
You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

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


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Ok, I've got it sorted now, but I'm buggered as to why this didn't work 
the way I hoped. It seems that if I use an indexed or associative array 
to store the location and new image file name, imagejpeg never works, 
but if I use a normal var it does !! what's with that!

// doesn't work
$aNewImage['image_loc'] = $aNewImage['image_dir'] . 
$aNewImage['new_name'];

// does work!!
$sImageLoc = '/Library/Webserver/Documents/wrox_site/_img/_products/' . 
$aNewImage['new_name'];

Why oh why is that the case ??? Would love to know.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 14:00, Jon Bennett wrote:

Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the 
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like 
getimagesize would fail, it just won't save the resized or, if the 
dimensions of the uploaded image aren't bigger than my max width and 
height, original image, and I really have no idea why!!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 13:36, Chris Hayes wrote:

PHP first gives the file a temporary name on a temporary location. 
This name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

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


[PHP] replace a chunk peace of string

2003-12-01 Thread ada
Hi,

After ahavuing inseted my vvalues from a local file via : load infile ...
I notice a strange peace of string in my fnal field :
like :
"kkv850
"
select hex("kkv850
")
->
6B6B763835300D0A
select hex("a
")
->
610D0A
always 0D0A at the ends :(

I' m on windows, and i didn't manage to destroy this peace of string :(
trim() doesn't work ...

Thanks.

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



[PHP] random question generation

2003-12-01 Thread Frank Tudor
I am building an application that has course material and one of
the requirments is that questions related to course material pop
up randomly in relation to the question bank and to time.  

So if there are 15 pages in a section and four questions need to
populate somewhere after page 1 before the end of the section
what would you guys use to do this.

The questions and answers will be in a database.

Also a question on page 4 can't be asked on page 1.

The questions will not pop up like a javascript event but lay
seeded between the pages it will either happen based on
randomization or not.

Anybody been down this road before?

Frank

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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



RE: [PHP] String construction help required please

2003-12-01 Thread Wouter van Vliet
Jay Blanchard wrote:
> [snip]
>> I need to display : "$_POST[$var],"
>> 
>> Including the "" and the , .
>> 
>> I have tried : \"\"$_POST[\".$var.\"]," but that is very wrong.
>> 
>> Could one of you kind list members show me what it should be please ?
> 
> 
> You have a couple of options... just pick the one that suits you...
> 
>  echo "\"{$_POST[$var]},\"";
> echo '"'.$_POST[$var].',"';
>> 
> [/snip]
> 
> var should not have a $ in front of it, should it?
> 
> echo "\"{$_POST['var']},\"";
> echo '"'.$_POST['var'].',"';

That all depends. Consider the following:

Assume:

to be posted to the script

print '"$_POST[$var],"'; // prints (literally): "$_POST[$var],"
print '"'.$_POST['something'].","; // prints: "foo,"
print '"'.$_POST[$var].","; // Issues a 'notice: undefined index..' and
prints: ","

$var = 'something';
print '"'.$_POST[$var].","; // prints: "foo,"

Pick your flavor.

Wouter

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



RE: [PHP] include-problem

2003-12-01 Thread Rasmus Lerdorf
On Mon, 1 Dec 2003, Wouter van Vliet wrote:
>  print "!!!";
> ob_start();
> include 'http://server.com/test/echo.php';
> $XML = ob_get_clean(); // or use ob_get_contents(); and ob_end_clean() for
> PHP < 4.3
> print "???";
> 
> print '[Between this you'll get your XYZ]';
> print $XML;
> print '[Between this you'll get your XYZ]';
> ?>

Or just use file_get_contents() which would be more efficient than using 
output buffering for this.

-Rasmus

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



RE: [PHP] String construction help required please

2003-12-01 Thread Jay Blanchard
[snip]
> I need to display : "$_POST[$var],"
>
> Including the "" and the , .
>
> I have tried : \"\"$_POST[\".$var.\"]," but that is very wrong.
>
> Could one of you kind list members show me what it should be please ?


You have a couple of options... just pick the one that suits you...


[/snip]

var should not have a $ in front of it, should it? 

echo "\"{$_POST['var']},\"";
echo '"'.$_POST['var'].',"';

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



Re: [PHP] Question on sending PhP variable results to an HTML page to be displayed.

2003-12-01 Thread Jon Bennett
Hi Al,

I'd add a scrolling tag to your iFrame, as you won't ever need it to 
scroll.



hth

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 14:04, Al Costanzo wrote:

Hi Jay,

This will not work because the page in question ends in .HTML but I did
discover a way to do what I need and an answer to many other posts.
Here is the answer:

To make a PHP command to execute on a .html page create another page 
ending
in .php with the code there. Where you need to display this in your 
.html
page use the  html tag.  It works just fine.

A person gave me this idea by emailing me and saying why not use a 
frameset
to do this. This is kinda what IFRAME does but it is more like a little
window.  Same concept but it does not interfere with how a search 
engine
indexes a website.

Anyone interested in seeing the resulting code, it is located at:
http://www.dynamicsubmission.com and a one line php program returns 
the date
to the page.

I would like to thank everyone for their ideas and this is a very 
useful
resource to have.

I may know a great deal about seach engines, but when it comes to 
php...
well ... thanks for the help!

Al Costanzo
- Original Message -
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Al Costanzo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, December 01, 2003 8:49 AM
Subject: RE: [PHP] Question on sending PhP variable results to an HTML 
page
to be displayed.

[snip]
If you use the date function in PhP you can get the date and it will 
not
change in the cache since the actual code is not on the page that
generated
it.

My question is how do I get the answer that I have in a PHP variable
back to
an HTML page and give it lets say to JavaScript to display.
[/snip]
Why do you need to give it to JavaScript to display? Consider this in
your HTML 


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

2003-12-01 Thread Jay Blanchard
[snip]
Is it possible to export some data to MSOffice format ( .doc and .xls )
,
OOffice ( .sxw and sxc ) or .rtf format with PHP
[/snip]

Yes, it is.

http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-n
o-answers.html

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



Re: [PHP] Question on sending PhP variable results to an HTML page to be displayed.

2003-12-01 Thread Al Costanzo
Hi Jay,

This will not work because the page in question ends in .HTML but I did
discover a way to do what I need and an answer to many other posts.

Here is the answer:

To make a PHP command to execute on a .html page create another page ending
in .php with the code there. Where you need to display this in your .html
page use the  html tag.  It works just fine.

A person gave me this idea by emailing me and saying why not use a frameset
to do this. This is kinda what IFRAME does but it is more like a little
window.  Same concept but it does not interfere with how a search engine
indexes a website.

Anyone interested in seeing the resulting code, it is located at:
http://www.dynamicsubmission.com and a one line php program returns the date
to the page.

I would like to thank everyone for their ideas and this is a very useful
resource to have.

I may know a great deal about seach engines, but when it comes to php...
well ... thanks for the help!

Al Costanzo
- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Al Costanzo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, December 01, 2003 8:49 AM
Subject: RE: [PHP] Question on sending PhP variable results to an HTML page
to be displayed.


[snip]
If you use the date function in PhP you can get the date and it will not
change in the cache since the actual code is not on the page that
generated
it.

My question is how do I get the answer that I have in a PHP variable
back to
an HTML page and give it lets say to JavaScript to display.
[/snip]

Why do you need to give it to JavaScript to display? Consider this in
your HTML 



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



Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the 
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like 
getimagesize would fail, it just won't save the resized or, if the 
dimensions of the uploaded image aren't bigger than my max width and 
height, original image, and I really have no idea why!!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 13:36, Chris Hayes wrote:

PHP first gives the file a temporary name on a temporary location. 
This name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

--
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] Question on sending PhP variable results to an HTML page to be displayed.

2003-12-01 Thread Jay Blanchard
[snip]
If you use the date function in PhP you can get the date and it will not
change in the cache since the actual code is not on the page that
generated
it.

My question is how do I get the answer that I have in a PHP variable
back to
an HTML page and give it lets say to JavaScript to display.
[/snip]

Why do you need to give it to JavaScript to display? Consider this in
your HTML 



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



Re: [PHP] file uploads

2003-12-01 Thread Chris Hayes
PHP first gives the file a temporary name on a temporary location. This 
name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know it's 
not the permissions, could someone have a little look  at my method and 
let me know if there's anything wrong with it please

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


[PHP] Re: Export data

2003-12-01 Thread Al
> Is it possible to export some data to MSOffice format ( .doc and .xls ) ,
> OOffice ( .sxw and sxc ) or .rtf format with PHP

The answer is sort of..

To write Excel files, you can use the Spreadsheet Excel Writer package
available under the PEAR module. The module's site is at:
http://pear.php.net/package/Spreadsheet_Excel_Writer

The only RTF file generator for PHP that I know of is (appropriately) called
RTF Generator, but it costs around $50. The website is:
http://www.paggard.com/projects/rtf.generator/

Another commonly suggested method of creating RTF files with PHP, especially
if your file format is not likely to change much, is to create the document
in Word and format it as you like, using unique words as placeholders. Then
open the file with a text editor find the placeholder words, and use PHP to
substitute your data for the placeholder words.

Yet another work around is to create your documents in HTML but then name
them "filname.doc" When your users open the document, Word will launch and
auto-convert the file, giving your users the option to save it as a normal
Word document.

You can also use this tactic with Excel, creative CSV file easily in PHP,
and then serving them to your users as XLS files.

Good luck,

Al

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



Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Just to clarify about using move_uploaded_file()

I call the storeBigImage methid from aother method like so

function addProduct(){

	$this->storeBigImage($ID, $_FILES["image"]);

}

that doesn't work, if I use this:

function addProduct(){

	// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}

The above works fine, which I find very strange indeed!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 12:50, Jon Bennett wrote:

Hi,

I have a file upload problem, but I don't think it's a permission 
thing (if only, that would be simple!).

I have written a resizing method for a class I'm working on, and it 
always fails on the imageJpeg() at the end of the method. This is the 
error I get...

imagejpeg(): Unable to open 
'/Library/WebServer/Documents/my_site/_lib/_products/2_big_me.jpg' for 
writing in 
/Library/WebServer/Documents/my_site/_lib/_classes/class.products.php 
on line 132

Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

// $ID is an integer used for naming purposes
// $aImage is an array, it's basically a copy of $_FILES["image"]
// BASE_DIR is a constant var and holds, yep you guessed it, the base 
dir of the site!
// IMGMAXHEIGHT & IMGMAXWIDTH are also constants used for resizing 
purposes

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
// copy original image
$aNewImage['original_image'] = 
ImageCreateFromJpeg($aImage['tmp_name']);
$aNewImage['sizes'] = getimagesize($aImage['tmp_name']);
$aNewImage['width'] = $aNewImage['sizes'][0];
$aNewImage['height'] = $aNewImage['sizes'][0];

if($aNewImage['width'] >= IMGMAXWIDTH || $aNewImage['height'] 
>= IMGMAXHEIGHT){

// calculate ratios
$iRatio_w = IMGMAXWIDTH / $aNewImage['width'];
$iRatio_h = IMGMAXHEIGHT / $aNewImage['height'];
$iRatio = $iRatio_w < $iRatio_h ? $iRatio_w:$iRatio_h;

// calculate new dimensions
$aNewImage['new_width'] = $aNewImage['width'] * $iRatio;
$aNewImage['new_height'] = $aNewImage['height'] * $iRatio;

// save resized image
$aNewImage['new_image'] = 
ImageCreateTrueColor($aNewImage['new_width'], 
$aNewImage['new_height']);
ImageCopyResized($aNewImage['new_image'], 
ImageCreateFromJpeg($aImage['tmp_name']), 0, 0, 0, 0, 
$aNewImage['new_width'], $aNewImage['new_height'], 
$aNewImage['width'], $aNewImage['height']);
//ImageJpeg($aNewImage['new_image'], 
$aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);

} else {

// save original image
//ImageJpeg($aImage['tmp_name'], $aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
//ImageJpeg($this->aArgs['Image']['tmp_name'], 
$aNewImage['image_loc']);
}
}

I have ftp'd into my local server and the folder in question is set at 
777, and like I said it works fine if I don't use this class

Any ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
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] file uploads

2003-12-01 Thread Jon Bennett
Hi,

I have a file upload problem, but I don't think it's a permission thing 
(if only, that would be simple!).

I have written a resizing method for a class I'm working on, and it 
always fails on the imageJpeg() at the end of the method. This is the 
error I get...

imagejpeg(): Unable to open 
'/Library/WebServer/Documents/my_site/_lib/_products/2_big_me.jpg' for 
writing in 
/Library/WebServer/Documents/my_site/_lib/_classes/class.products.php 
on line 132

Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know it's 
not the permissions, could someone have a little look  at my method and 
let me know if there's anything wrong with it please

// $ID is an integer used for naming purposes
// $aImage is an array, it's basically a copy of $_FILES["image"]
// BASE_DIR is a constant var and holds, yep you guessed it, the base 
dir of the site!
// IMGMAXHEIGHT & IMGMAXWIDTH are also constants used for resizing 
purposes

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
// copy original image
$aNewImage['original_image'] = 
ImageCreateFromJpeg($aImage['tmp_name']);
$aNewImage['sizes'] = getimagesize($aImage['tmp_name']);
$aNewImage['width'] = $aNewImage['sizes'][0];
$aNewImage['height'] = $aNewImage['sizes'][0];

if($aNewImage['width'] >= IMGMAXWIDTH || $aNewImage['height'] 
>= IMGMAXHEIGHT){

// calculate ratios
$iRatio_w = IMGMAXWIDTH / $aNewImage['width'];
$iRatio_h = IMGMAXHEIGHT / $aNewImage['height'];
$iRatio = $iRatio_w < $iRatio_h ? $iRatio_w:$iRatio_h;

// calculate new dimensions
$aNewImage['new_width'] = $aNewImage['width'] * $iRatio;
$aNewImage['new_height'] = $aNewImage['height'] * $iRatio;

// save resized image
$aNewImage['new_image'] = 
ImageCreateTrueColor($aNewImage['new_width'], 
$aNewImage['new_height']);
ImageCopyResized($aNewImage['new_image'], 
ImageCreateFromJpeg($aImage['tmp_name']), 0, 0, 0, 0, 
$aNewImage['new_width'], $aNewImage['new_height'], $aNewImage['width'], 
$aNewImage['height']);
//ImageJpeg($aNewImage['new_image'], 
$aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);

} else {

// save original image
//ImageJpeg($aImage['tmp_name'], $aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
//ImageJpeg($this->aArgs['Image']['tmp_name'], 
$aNewImage['image_loc']);
}
}

I have ftp'd into my local server and the folder in question is set at 
777, and like I said it works fine if I don't use this class

Any ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] include-problem

2003-12-01 Thread Wouter van Vliet
Rasmus Lerdorf wrote:
> On Mon, 1 Dec 2003, Sophie Mattoug wrote:
>> Victor Spång Arthursson wrote:
>> 
>>> Hi!
>>> 
>>> I'm having a problem with including files. What I want to achieve is
>>> to execute a PHP-script on another server, and then to include the
>>> result (which will be XML-output) in another PHP-script (currently
>>> on my local computer). 
>>> 
>>> On the server I have the file
> http://server.com/test/echo.php with
>>> the content
>>> 
>>> ---
>>> >> echo 'xyz';
 
>>> ---
>>> 
>>> Locally I've a file with the following content:
>>> 
>>> ---
>>> >> echo "!!!";
>>> include ("http://server.com/test/echo.php";);
>>> echo "???";
 
>>> ---
>>> 
>>> I was expecting the output from my locally testfile to be something
>>> like: 
>>> 
>>> ---
>>> !!!???
>>> ---
>>> 
>>> but rather it is
>>> 
>>> ---
>>> !!!xyz???
>>> ---
>>> 
>>> I've also tried with a $fp = readfile("http…") with the same result,
>>> which is output of the echo-statement in the remote file which I am
>>> expecting to be evaluated remotely.
>>> 
>>> How can I do to include the PHP-script and have it to be ran before
>>> it is included? 
>>> 
>>> Sincerely
>>> 
>>> Victor
>> 
>> 
>> This is a perfectly normal behaviour ! See www.php.net/include to
>> understand what this function does. (comparing to
>> www.php.net/require) 
> 
> It's perfectly normal, yes, but it has nothing to do with include vs.
> require. 
> 
> I guess I don't really understand the question.  I assume you
> realize that an include 'http://server.com/file.php' is going
> to send an HTTP request to server.com asking for file.php and
> if server.com is configured to execute php for file.php then
> what will come back across the wire is the result of php
> running the script in file.php.  As such, when you do:
> 
>  echo '!!!';
>  include 'http://server.com/file.php';
>  echo '???';
> 
> you will of course see: !!!xyz??? because that is exactly
> what you have asked it to do.  Print !!!, then send an HTTP
> request to server.com and include the output of that script
> right here, and finally print out ???.
> So I don't understand why this output is surprising you and I
> don't understand your question about expecting it to be
> evaluated remotely.
> file.php was of course evaluated remotely on server.com.  If
> file.php had written something to the filesysts, for example,
> then that something would be on server.com not on your server.
> 
> -Rasmus

You can use the output buffer functions to catch the "xyz" into a var:

http://server.com/test/echo.php';
$XML = ob_get_clean(); // or use ob_get_contents(); and ob_end_clean() for
PHP < 4.3
print "???";

print '[Between this you'll get your XYZ]';
print $XML;
print '[Between this you'll get your XYZ]';
?>

Hope it helps ya,
Wouter

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



RE: [PHP] regular expression, image, name, alt, title, preg_match_all

2003-12-01 Thread Wouter van Vliet
Sophie Mattoug wrote:
> Adam i Agnieszka Gasiorowski FNORD wrote:
> 
>>  I'm trying to develop a regex for matching  with preg_match_all, I
>> want to match such things  like image name, image alt text, image
>> title in  construct like this: 
>> 
>> html...
>> 
>>>   style="style"> text
>>  
>> 
>> html...
>> The rexex as for now is:
>> 
>> define(
>>'REGEX_IMAGE_NAMES_AND_TITLES_AND_ALTS_FROM_CONTENT',   
>> '{ (?:<\s*img\s+src\s*=\s*(?:"|\')?\s*(?:img)?\s*=\s*)
>   #  
>> (?>\b\S+\b)
>   # name
>> (?:title\s*=\s*(?:"|\'))
>   # title
>> (?>\b\S*\b)
>> (?:"|\')*\s*
>> (?:alt\s*=\s*(?:"|\'))
>   # alt
>> (?>\b\S*\b)
>> (?:"|\')*\s*
>> (?:\"|\'|>|/>|\s)
>   # 
>> }Uix'
>>  );
>> 

My approach would be "somewhat something good from both worlds" it IS
possible to match an entire image tag with preg_match_all:

//i

Of course, this is not tested .. but should come at least a bit close to
what you want ...

Wouter

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



Re: [PHP] include-problem

2003-12-01 Thread Rasmus Lerdorf
On Mon, 1 Dec 2003, Sophie Mattoug wrote:
> Victor Spång Arthursson wrote:
> 
> > Hi!
> >
> > I'm having a problem with including files. What I want to achieve is 
> > to execute a PHP-script on another server, and then to include the 
> > result (which will be XML-output) in another PHP-script (currently on 
> > my local computer).
> >
> > On the server I have the file http://server.com/test/echo.php with the 
> > content
> >
> > ---
> >  > echo 'xyz';
> > ?>
> > ---
> >
> > Locally I've a file with the following content:
> >
> > ---
> >  > echo "!!!";
> > include ("http://server.com/test/echo.php";);
> > echo "???";
> > ?>
> > ---
> >
> > I was expecting the output from my locally testfile to be something like:
> >
> > ---
> > !!!???
> > ---
> >
> > but rather it is
> >
> > ---
> > !!!xyz???
> > ---
> >
> > I've also tried with a $fp = readfile("http…") with the same result, 
> > which is output of the echo-statement in the remote file which I am 
> > expecting to be evaluated remotely.
> >
> > How can I do to include the PHP-script and have it to be ran before it 
> > is included?
> >
> > Sincerely
> >
> > Victor
> 
> 
> This is a perfectly normal behaviour ! See www.php.net/include to 
> understand what this function does. (comparing to www.php.net/require)

It's perfectly normal, yes, but it has nothing to do with include vs. 
require.  

I guess I don't really understand the question.  I assume you realize that 
an include 'http://server.com/file.php' is going to send an HTTP request 
to server.com asking for file.php and if server.com is configured to 
execute php for file.php then what will come back across the wire is the 
result of php running the script in file.php.  As such, when you do:

 echo '!!!';
 include 'http://server.com/file.php';
 echo '???';

you will of course see: !!!xyz??? because that is exactly what you have 
asked it to do.  Print !!!, then send an HTTP request to server.com and 
include the output of that script right here, and finally print out ???. 
So I don't understand why this output is surprising you and I don't 
understand your question about expecting it to be evaluated remotely.  
file.php was of course evaluated remotely on server.com.  If file.php had 
written something to the filesysts, for example, then that something would 
be on server.com not on your server.

-Rasmus

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



Re: [PHP] regular expression, image, name, alt, title, preg_match_all

2003-12-01 Thread Sophie Mattoug
Sophie Mattoug wrote:

Adam i Agnieszka Gasiorowski FNORD wrote:

I'm trying to develop a regex for matching
with preg_match_all, I want to match such things
like image name, image alt text, image title in
construct like this:
html...

 
 
  text
 

html...
The rexex as for now is:
define(
   'REGEX_IMAGE_NAMES_AND_TITLES_AND_ALTS_FROM_CONTENT',
   '{
(?:<\s*img\s+src\s*=\s*(?:"|\')?\s*(?:img)?\s*=\s*)   #  

(?>\b\S+\b)   # name
(?:title\s*=\s*(?:"|\'))  # 
title
(?>\b\S*\b)
(?:"|\')*\s*  
(?:alt\s*=\s*(?:"|\'))# alt
(?>\b\S*\b)
(?:"|\')*\s*   
(?:\"|\'|>|/>|\s) # 
}Uix'
 );

, but it does not match. How can I fix it?
 

It's not so easy to match an entire IMG tag, because first of all the 
attributes are not always in the same order. If I were you, this is 
what I would do :
ereg("]+)>", $your_text, $img_array);
$i = 0;
foreach ($img_array as $img) {
 while (ereg("^(.+)=\"(.+)\"", "", $img, $regs))
   $images[$i][$regs[1]] = $regs[2];
 $i++;
}

Hope this helps,


Sorry I made a mistake. Better do this:
ereg("]+)>", $your_text, $img_array);
$i = 0;
foreach ($img_array as $img) {
while (ereg("^(.+)=\"(.+)\"(.+)$", "", $img, $regs))  {
  $images[$i][$regs[1]] = $regs[2];
   $img = $regs[3];
 }
$i++;
}
--
Cordialement,
---
Sophie Mattoug
Développement web dynamique
[EMAIL PROTECTED]
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include-problem

2003-12-01 Thread Sophie Mattoug
Victor Spång Arthursson wrote:

Hi!

I'm having a problem with including files. What I want to achieve is 
to execute a PHP-script on another server, and then to include the 
result (which will be XML-output) in another PHP-script (currently on 
my local computer).

On the server I have the file http://server.com/test/echo.php with the 
content

---

---
Locally I've a file with the following content:

---
http://server.com/test/echo.php";);
echo "???";
?>
---
I was expecting the output from my locally testfile to be something like:

---
!!!???
---
but rather it is

---
!!!xyz???
---
I've also tried with a $fp = readfile("http…") with the same result, 
which is output of the echo-statement in the remote file which I am 
expecting to be evaluated remotely.

How can I do to include the PHP-script and have it to be ran before it 
is included?

Sincerely

Victor


This is a perfectly normal behaviour ! See www.php.net/include to 
understand what this function does. (comparing to www.php.net/require)

Hope this helps,

--
Cordialement,
---
Sophie Mattoug
Développement web dynamique
[EMAIL PROTECTED]
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expression, image, name, alt, title, preg_match_all

2003-12-01 Thread Sophie Mattoug
Adam i Agnieszka Gasiorowski FNORD wrote:

I'm trying to develop a regex for matching
with preg_match_all, I want to match such things
like image name, image alt text, image title in
construct like this:
html...

 
 
  text
 

html...
The rexex as for now is:
define(
   'REGEX_IMAGE_NAMES_AND_TITLES_AND_ALTS_FROM_CONTENT',
   '{
(?:<\s*img\s+src\s*=\s*(?:"|\')?\s*(?:img)?\s*=\s*)   #  
(?>\b\S+\b)   # name
(?:title\s*=\s*(?:"|\'))  # title
(?>\b\S*\b)
(?:"|\')*\s*  
(?:alt\s*=\s*(?:"|\'))# alt
(?>\b\S*\b)
(?:"|\')*\s*   
(?:\"|\'|>|/>|\s) # 
}Uix'
 );

, but it does not match. How can I fix it?
 

It's not so easy to match an entire IMG tag, because first of all the 
attributes are not always in the same order. If I were you, this is what 
I would do :
ereg("]+)>", $your_text, $img_array);
$i = 0;
foreach ($img_array as $img) {
 while (ereg("^(.+)=\"(.+)\"", "", $img, $regs))
   $images[$i][$regs[1]] = $regs[2];
 $i++;
}

Hope this helps,

--
Cordialement,
---
Sophie Mattoug
Développement web dynamique
[EMAIL PROTECTED]
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] openssl_sign

2003-12-01 Thread Dietrich Heise
Hi,

I try to generate the same signature than openssl_sign from the command line.
I use the following command:

openssl dgst -sha1 data_file | sed "s:.*\=\ ::" | openssl rsautl -inkey \
private_rsa.key  -sign -out sign_file

but the signatures are different :/

If I understand the PHP doku right, a SHA1 hash over the data is generated
followed by signing this hash.  

What's going wrong here?

mfg
Dietrich Heise
--
Open WebMail Project (http://openwebmail.org)

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



[PHP] regular expression, image, name, alt, title, preg_match_all

2003-12-01 Thread Adam i Agnieszka Gasiorowski FNORD

I'm trying to develop a regex for matching
 with preg_match_all, I want to match such things
 like image name, image alt text, image title in
 construct like this:

 html...
 
  
  
   text
  
 
 html...
 The rexex as for now is:

define(
'REGEX_IMAGE_NAMES_AND_TITLES_AND_ALTS_FROM_CONTENT',
'{
 (?:<\s*img\s+src\s*=\s*(?:"|\')?\s*(?:img)?\s*=\s*)   #  
 (?>\b\S+\b)   # name
 (?:title\s*=\s*(?:"|\'))  # title
 (?>\b\S*\b)
 (?:"|\')*\s*  
 (?:alt\s*=\s*(?:"|\'))# alt
 (?>\b\S*\b)
 (?:"|\')*\s*   
 (?:\"|\'|>|/>|\s) # 
 }Uix'
  );

 , but it does not match. How can I fix it?
   
-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



Re: [PHP] move_uploaded_file, umask, and permissions

2003-12-01 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
% Message-ID: <[EMAIL PROTECTED]>

Mister Underhill, I presume? :-)  I only just noticed this :-)


% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
% > 
% > I have set my umask to 117 (and I change it when making a directory) and
% > I use move_uploaded_file to handle submitted files.
...
% > Must I really run chmod() on every move_uploaded_file() I process?  Isn't
% > there a better way?
% 
% I believe it does, move_uploaded_file() uses the current
% envirionment's umask which seems to be set at an awkward stage.
% 
% what is the output of:
%   echo `umask`;

I just tried it and

  print "UMASK IS .".`umask`.".\n";

gives me

   UMASK IS .0117 .

which certainly seems right.


% 
% I bet its '11'. I'm not sure how your system is configured but it

I don't get it...  Why would you think that?  The file as it uploads is
mode 600 == umask 177; the file as dropped into place is 666 == 111.
Nothing like a mask of 11 (which would leave us a mode of 766) has shown
up...


% seems the user apache is running under has that umask set that way
% which, IMO, is a bad thing (tm).

I am inclined to agree.


% 
% 
% Curt
% -- 
% If eval() is the answer, you're almost certainly asking the
% wrong question. -- Rasmus Lerdorf, BDFL of PHP
% 
% -- 
% PHP General Mailing List (http://www.php.net/)
% To unsubscribe, visit: http://www.php.net/unsub.php


:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


  1   2   >