Re: [PHP] Problem on OpenDir()

2002-11-25 Thread Joakim Andersson
Jack wrote:

Dear all
here is the path i want to open for reading files from it!
path = "c:/pdf_reports/bills/Oct-02"

Here you have no trailing /

--- Snip ---

when i change the path to : "c:/pdf_reports/bills/"

But here you do...
It should not make a difference as far as I know, but it may be worth a 
try. Have you tried other subfolders?

Post your code and point out the lines that give errors.

Regards
Joakim


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



Re: [PHP] implode()

2002-11-26 Thread Joakim Andersson
Jef wrote:

implode() expects an array as the second argument. You're passing a


string. In


fact with the code you have above I don't see why you don't just tack the
comma on the end in the first place:

  if($image11_name != '') $sqlUpdate .= "image11='$image11_name', ";



The reason being the comma at the end of the SQL command will prevent the
command from working because SQL will expect another entry. However, your
comment about implode expecting an array helps out. Thanks.



This is how I would do it:


Regards
Joakim


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




Re: [PHP] Decrypt Password

2002-11-27 Thread Joakim Andersson
Stephen wrote:

That's what I'm going to do but how can I pull it from the database to
decrypt it, then send it?


You can't. Well that depends what method you used to create the 
passwords, but most likely you used a one-way encryption.

How to solve the problem then?

1. User klicks link 'Forgot my password'
2. Generate a one-time password for this user. Do not change the users
   ordinary password yet.
3. Send mail to user with the one-time pw. This must be a verified
   mailaddress.
4. Let the user enter his login/mailaddress and the one-time pw to
   login.
5. Let the user enter a new pw. Then update the dB.

That's one way to do it with reasonable security.

Regards
Joakim


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



Re: [PHP] Problem on OpenDir()

2002-11-27 Thread Joakim Andersson
Jack wrote:

Dear Joakim
First of all, thx for the reply and here is the code :

");
 }
}


closedir($handle);
file://check if the directory exist for last month
file://Folder's Name
$folder=date("M",mktime(0,0,0,$previousmonth,1,$currentyear));

$dirname="Oct-02";
if (is_dir("Oct-02"))
{
print ("Good");
}
?>


here is the Error Message :
Warning : OpenDir: Invalid argument (errno22) in c:\inetpub\wwwroot\nedcor
internal live\reports\bills\reports\page.php on line 21

and second error message :

Warning Supplied argument is not a valid Directory resource in
c:\Interpub\wwwroot\nedcor internal live\reports\bills reports\page.php on
line 22

have you seems somthing like this before?

Thx a lot

jack


Try these, one at the time...
$filepath="c:\\pdf_reports\\Bills\\Oct02\\";
$filepath="c:\\pdf_reports\\Bills\\";

How are your permissions set up?
Are they the same on Bills and the subfolder Oct02?
I see that among the last lines you have a referense to Oct-02. Please 
check at least two more times that you have got the folder name right at 
all places in your scripts.

Have you tried to delete (or just move) the subfolder and create it again?

Regards
Joakim


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



Re: [PHP] Creating dynamic names for images

2002-12-04 Thread Joakim Andersson
Davíð Örn Jóhannsson wrote:

I have a situation where I allow users to upload images, and I store the
names of the images in a database and the images  I store in a some
folder on the server, but what I would like to do is to dynamically
create names for the images and dont ever have to worry about if this
name exists and with out having to got to the trouble of asking the user
to change tha name of the file.
 
So dose some one have a nice litle solution for this problem.
 
Thanks, David
 


Insert your file-info into the database
Use mysql_insert_id() (or similar) to get the ID of your new row. (You 
do have an auto_increment column, right?)
Use that ID as filename.

Regards
Joakim Andersson


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



Re: [PHP] fopen over a network

2002-12-05 Thread Joakim Andersson
Dara Dowd wrote:

Thanks for the advice lads but I realise I should have been clearer. I know about header(etc..) so displaying the download dialog isn't the problem, it's how to get to the file on the file server and then open it. The file server isn't a web server.  This is probably ridiculously easy so I hope I'm not wasting your time. I don't want to@use the 'right-click' option, I want something similar to@opening attachments in hotmail for example. Here's what I have anyway.


Cheers, Dara


What kind of network are you using?
If you're accessing a SMB-share (i.e. Windows or Samba) I think you need 
to skip "file:" from your script. Maybe you need to use backslashes 
instead ($fpath="file:fileserver\\directory\\").

Regards
Joakim


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



Re: [PHP] Re: Using strtotime on 'old' dates.

2003-01-23 Thread Joakim Andersson
Nathan Fritz wrote:

We're running into the same problem. It was quite convenient to use
date("Y-m-d",strtotime($dateField)) to process date data for MySQL. Worked
fine for my news management system, since I work with current dates, but my
colleague is using it for an application submission system, and needs
birthdates and such from before 1970.

Are there other functions that can do the same kind of textual date
conversions?


Is your colleague running on Windows?
I came across this problem today and scripts running fine on Linux and 
FreeBSD failed on Windows when feeding dates pre-1970 to strtotime().

I then found this post among PHP's bug reports:
http://bugs.php.net/bug.php?id=14313

Regards
Joakim Andersson



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



RE: [PHP] imagecopyresized problems

2002-09-09 Thread joakim . andersson

Hi,

> imagejpeg($dst_img);

This actually outputs the image, so your result is not unexpected.
Try this instead:
imagejpeg($dst_img, "/path/and/filename/to/newfile.jpg");

Regards
Joakim Andersson

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




RE: [PHP] Re: Cry for help

2002-09-12 Thread joakim . andersson

> |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
> |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
> 
> So for example, lets say I wanted to make another html form 
> that has a form
> field for List team by: and and select either "home" or "away" ... by
> selecting "home", the browser would print out the following:
> 
> Sangiovannese
> Gualdo
> 
> so now I need to figure out how to get PHP to do the following:
> 
> #1 look at each line in the text file and treat it individually
> #2 select the data after the 4th | from each line
> #3 print it back to the browser

$fd = fopen ("/tmp/inputfile.txt", "r"); // Opens file for reading
while (!feof ($fd)) // Start of loop.
{
$buffer = fgets($fd, 4096); // Reads one line of maximum 4096 bytes
$arr = explode("|", $buffer); // Divides each row into separate elements
in an array.
echo $arr[4]; // Prints the 5th element of each row.
// The first element ($arr[0]) is actually "" (an empty string) since each
line starts with |.
}
fclose ($fd);

Hopefully this will get you in the right direction.
Regards
Joakim Andersson

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




RE: [PHP] Re: Cry for help

2002-09-12 Thread joakim . andersson

> For example:
> 
> while (!feof ($fp))
> 
> What does the ! mean or do?

! means not.

> What does feof mean? is it one command? or is f e o f all different?

feof() is a function that checks if a file has reached the end or not. (eof
= end of file)

while (!feof ($fp)) in whole means something like this
As long as the filepointer ($fp) is not at the end, do whatever that's
between { and } over and over again...

> Why are there 2 ) at the end?

Just because :-)
The first ) belongs to feof and the second ) belongs to while.

> 
> $buffer = fgets($fp, 4096);
> 
> Why does it need a buffer? What is a buffer?

$buffer is just a variable that stores the result of fgets(). It could be
any name really...

> 
> $arr = explode("|", $buffer);
> 
> It's questions like that. I can understand more or less what 
> the meanings
> are of the concepts. Another example of this is, I tested 
> your code, and it
> returned the string
> 
> SangiovanneseFlorentia Viola
> 
> on one line only. If I want it to look like this:?
> 
> Sangiovannese
> Florentia Viola
> 
> Now i now the \n means to go to the next line, but where 
> would I put that?

You modify this line
echo $arr[4];
to this
echo $arr[4] . "\n"; // The . is a string concatenation operator. It simply
joins the two strings.

Now this would give you the same result in your browser, but if you view the
source in the browser you will see that the lines are separated. To do a
line break in the browser you have to insert the correct html ()
instead.

> You see my dilemmas no? I wish I could find a list of syntax 
> and functions
> like a reference guide. That would be a start

www.php.net/manual/en/ is a very good start.

> 
> Tack again
> -Tree

Varsågod!
Joakim

> 
> - Original Message -
> From: Joakim Andersson <[EMAIL PROTECTED]>
> Newsgroups: php.general
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 12, 2002 4:54 PM
> Subject: RE: [PHP] Re: Cry for help
> 
> 
> > > |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
> > > |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
> > >
> > > So for example, lets say I wanted to make another html form
> > > that has a form
> > > field for List team by: and and select either "home" or 
> "away" ... by
> > > selecting "home", the browser would print out the following:
> > >
> > > Sangiovannese
> > > Gualdo
> > >
> > > so now I need to figure out how to get PHP to do the following:
> > >
> > > #1 look at each line in the text file and treat it individually
> > > #2 select the data after the 4th | from each line
> > > #3 print it back to the browser
> >
> > $fd = fopen ("/tmp/inputfile.txt", "r"); // Opens file for reading
> > while (!feof ($fd)) // Start of loop.
> > {
> > $buffer = fgets($fd, 4096); // Reads one line of 
> maximum 4096 bytes
> > $arr = explode("|", $buffer); // Divides each row into separate
> elements
> > in an array.
> > echo $arr[4]; // Prints the 5th element of each row.
> > // The first element ($arr[0]) is actually "" (an empty 
> string) since each
> > line starts with |.
> > }
> > fclose ($fd);
> >
> > Hopefully this will get you in the right direction.
> > Regards
> > Joakim Andersson
> 

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




Re: [PHP] Ip address as 32bit int?

2002-11-22 Thread Joakim Andersson
In MySQL (and others?) you can use these two functions:
INET_NTOA(expr)
INET_ATON(expr)

Regards
Joakim


- Original Message -
From: "Noodle Snacks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 22, 2002 10:13 AM
Subject: [PHP] Ip address as 32bit int?


Is it easy enough to change a formated IP addy (eg 192.168.0.1) to the 32bit
unsigned int that computers use?

the reason I ask is because it is alot more efficient space wise in a db to
be storing a 32bit number rather that a char or varchar field.

Or am I going to run into trouble because all ints are signed in PHP?


--
JJ Harrison
[EMAIL PROTECTED]






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



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




RE: [PHP] Writing a GIF/JPG Image

2002-07-02 Thread joakim . andersson

Maybe something like this...



If you are going to use this with different types of images you should
probably store the content-type along with the image in the dB.

/Joakim

> -Original Message-
> From: Brandon [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 29, 2002 3:52 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Writing a GIF/JPG Image
> 
> 
> Well, hehe I'm kinda just learning it all, here is what I 
> really wanna do:
> I have a table in a MySQL database that will contain the gif data in a
> column.  I want to be able to read that in with a SELECT 
> statement (which I
> can do), problem is I need to actually put hte images in the 
> database, so I
> need to somehow read in the Logo.gif file, and store it in SQL with an
> INSERT statement... thats what Im trying to do, can't figure 
> it out 8(.

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




RE: [PHP] FW: Help please!

2002-07-03 Thread joakim . andersson

Hi,

Maybe you can do something like this (if you have access to GD on the
server):


/Joakim


> -Original Message-
> From: Steve Vernon [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 9:43 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] FW: Help please!
> 
> 
> Hello,
>   I have a PHP script which gets data from a MySQL database and
> returns an image. So  returns the image of
> id 3 from the database. What I really want is to state width 
> is 100 and
> height is 100 for example so I do not have to downlaod the entire
> picture and specify the width and height as part of the image:
>   
>   Do not want 
>   
> 
>   WHat I want
>   
> 
>   WHich will be a lot quicker on the client side.
> 
>   I cannot make a permanent file to use when I get the information
> from the PHP database due to server security, only a tmpfile which the
> data can then be placed. But to use the image functions you need to
> specify a filename. THere does not seem to be a way to get 
> the filename
> of a file pointer so how do I do it please?
> 
>   I have asked the ISP to give me permissions to create files int
> he server directory but they will not let me. 
> 
>   Thanks you!
> 
>   Steve
> 
> 
> -- 
> 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] Simple Example of Passing on a file through a PHP script

2002-07-03 Thread joakim . andersson

Hi,

Store all files in a 'secret' folder, preferably outside the www-root.
Store filename, size, type, date, whatever in your dB.
To link to a file, use something like this MyDoc.pdf

Then in download.php you update your stats table with the relevant info and
then send the file to the user.

| download.php |

This is not complete and I'm not really sure about the headers, but you can
read more at http://www.php.net/manual/en/function.fpassthru.php

/Joakim




> -Original Message-
> From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 03, 2002 2:05 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Simple Example of Passing on a file through a 
> PHP script
> 
> 
> I want to show info when my docs are viewed though my stats 
> program. I have
> decieded the best way would be to put the info into a DB 
> through php file
> then output the PDF, Excel, Zip or Powerpoint file.
> 
> Only trouble is I have no Idea how to do this
> 
> 
> --
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] AdRotator for PHP?

2002-07-04 Thread joakim . andersson

I'm pretty sure you'll find what you are looking for here:
http://www.hotscripts.com/PHP/Scripts_and_Programs/Ad_Management/

/Joakim

> -Original Message-
> From: Patrick Teague [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 04, 2002 1:31 PM
> To: PHP-General
> Subject: [PHP] AdRotator for PHP?
> 
> 
> Hey,
> 
> I'm wondering if anyone has found or ended up writing 
> something similar to
> the MSWC AdRotator object in ASP, but for PHP?  Or is there 
> already a module
> on apache.org that I missed?
> 
> Thanks for any help :)
> 
> Patrick
> 
> 
> 
> -- 
> 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] extension problem

2002-07-04 Thread joakim . andersson

You probably shoul start here: http://www.php.net/manual/en/zend.php

/Joakim

> -Original Message-
> From: adelpfephp [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 04, 2002 4:34 PM
> To: php-france; [EMAIL PROTECTED]
> Subject: [PHP] extension problem
> 
> 
> 
> 

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




RE: [PHP] How to use transparent png in createfrompng?

2002-07-05 Thread joakim . andersson

Have you tried imagecopyresampled instead? Maybe it solves your problem.
It's a long-shot.
Requires GD 2.x

/Joakim

> -Original Message-
> From: Victor Spång Arthursson [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 05, 2002 1:03 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How to use transparent png in createfrompng?
> 
> 
> Hi!
> 
> I'm having problems with createfrompng…
> 
> I do the following:
> 
> 1 Creates a new image
> 
> 2 Fill it with black
> 
> 3 copy an jpg on to it
> 
> 4 write some text
> 
> 5 tries to use copyimageresized to put a transparent png over 
> the whole 
> image…
> 
> It's in point 5 it goes wrong, because of some reason the png 
> loses its 
> transparens and becomes a white square instead of the nice 
> transparent 
> picture it was from the beginning…
> 
> What have I done wrong or is it simply impossible to perform 
> what i want?
> 
> Sincerely
> 
> Victor
> 
> 
> -- 
> 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] imagecopyresized() problems

2002-07-09 Thread joakim . andersson

Hi,

Output the correct headers before you output the image 
ie 
header("Content-type: image/jpeg");
imagejpeg($dst_img, '', 50);

Remove all print statements from this code. You cannot output anything but
the headers and the image itself.

Use imagecopyresampled if you can. It gives much better quality.

Then to output the image from another script (not within test.php) use this:


Regards
Joakim Andersson


> -Original Message-
> From: Lance Earl [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 8:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] imagecopyresized() problems
> 
> 
> I am trying to create a piece of code that will create and display
> thumbnail image. When trying to send the image to a browser, I see
> binary data rather then an image. You can see the problem at
> www.dallypost.com/a/test.php
> 
> The troubled cose for this page follows:
> 
>  
> //a master image may be any image of any size
> 
> //If the master image exists, the thumb will be created and output to
> the browser
> 
> //requires path from the file system home directory as
> $master_image_path
> 
> //requires the name of the master image as $master image  
>   
> 
> //test variables -- will eventually be defined by the calling module
> $master_image_path = "/home/html/74ranch/uploads/";
> $master_image = "chex34.jpg";
> 
> 
> 
> if(!isset($thumb_width))
> {
>   $thumb_width = 80;
> }//end if
> 
> 
> //make sure that the master file exists
> $master_image_all = "$master_image_path";
> $master_image_all .= "$master_image";
> 
> //remove this section after coding is complete
>   $master_image_all_link = "/74ranch/uploads/";
>   $master_image_all_link .= "$master_image";
>   print("");
> 
> if(file_exists($master_image_all))
> {
>   $size = getimagesize("$master_image_all");
>   $width = $size[0];
>   $height = $size[1];
>   
> 
>   //calculate thumb height
>   $factor = $width / $thumb_width;
>   $thumb_height = $height * $factor;
>   $thumb_height = $thumb_height * .1;
>   $thumb_height = round($thumb_height);
>   print(" Origional: height: $height width:
>   $widthTarget:
> height:$thumb_height width:   $thumb_width");
>   
>   //build the thumbnail 
>   $src_img = imagecreatefromjpeg("$master_image_all");
>   $dst_img = imagecreate($thumb_width,$thumb_height);
>   //$dst_img =
>   
> imagecreatetruecolor($thumb_width,$thumb_height);//requires   
>   gd 2.0
> or higher
>   
>   print("Variables that will be inserted into 
> the   imagecopyresized
> function");
>   print("width: $width");
>   print("height $height");
>   print("thumb_width $thumb_width");
>   print("thumb_height $thumb_height");
>   
>   print("Display the new thumb image");
>   
>   imagecopyresized($dst_img, $src_img, 0, 0, 0, 
> 0,$thumb_width,
> $thumb_height, $width, $height);
>   
>   
>   //imagecopyresampled($dst_img, $src_img, 0, 0, 
> 0, 0, $thumb_width,
> $thumb_height, $width, $height);//requires gd 
> 2.0 or higher
>   
>   
>   //imagejpeg($dst_img, "path and file name", 
> 75);//saves   the image to
> a file
>   
>   imagejpeg($dst_img, '', 50);//sends the image 
> to thebrowser
>   
>   imagedestroy($src_img);
>   imagedestroy($dst_img); 
> 
>   
> 
> }//end if
> ?>
> 
> 
> 
> 
> -- 
> 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] Grr SQL syntax error silghtly OT

2002-07-09 Thread joakim . andersson

I assume that 2count should really be count and 2 is just the line-number
you added in this post...

tececo_stats.views is (probably) the name of a column and cannot be used as
an alias. Change it to something else.
change count(*) to count(tececo_stats.*) (I think that's what you want)
And you probably need a group by-statement at the end: GROUP BY
whatever_you_need_to_group_by

It's really difficult to answer your questions without the table designs,
the error message and what you expect this query to do. And, it's not
slightly OT. It's totally OT. :-)

Regards
Joakim Andersson


> -Original Message-
> From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 10:10 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Grr SQL syntax error silghtly OT
> 
> 
> Sorry :}
> 
> I get a SQL syntax error at line two of the query:
> 
> $query = "select
> 2count(*) as tececo_stats.views, meta_data.title
> from
> meta_data, tececo_stats
> where
> meta_data.id = tececo_stats.id";
> 
> I have stared at this 'till i felt dizzy. can someone tell me 
> what I am
> doing wrong so that I can learn from it?
> 
> Thanks in advance
> 
> 
> --
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] Grr SQL syntax error silghtly OT

2002-07-09 Thread joakim . andersson

I would try something like this...

SELECT COUNT(tececo_stats.id) as num_hits, meta_data.title
FROM tececo_stats, meta_data
WHERE meta_data.id = tececo_stats.page_id
GROUP BY tececo_stats.page_id
ORDER BY num_hits DESC

/Joakim

> -Original Message-
> From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 11:07 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Grr SQL syntax error silghtly OT
> 
> 
> table structure for tececo stats(Stores information about the 
> visitors to my
> site.visited is either 0 or 1 depending on whether or not the 
> stats cookie
> has been set):
> 
>   id int(11) unsigned NOT NULL auto_increment,
>   page_id int(11) NOT NULL default '0',
>   visited int(11) NOT NULL default '0',
>   time int(11) NOT NULL default '0',
>   remote_dns varchar(100) NOT NULL default '',
>   remote_ip varchar(15) NOT NULL default '',
>   referer varchar(200) NOT NULL default '',
>   browser varchar(100) NOT NULL default '',
>   system varchar(100) NOT NULL default '',
>   PRIMARY KEY  (id),
>   KEY page_id (page_id,time)
> 
> table structure for meta_data(contains information about the 
> pages in my
> website):
> 
>   id int(11) unsigned NOT NULL auto_increment,
>   pid int(11) unsigned NOT NULL default '0',
>   title varchar(200) NOT NULL default '',
>   page_name varchar(75) NOT NULL default '',
>   description text NOT NULL,
>   keywords text NOT NULL,
>   PRIMARY KEY  (id),
>   KEY pid (pid)
> 
> main file(required.php automaticly does a DB connect and is 
> used elsewhere
> so I know is not the problem).
>  include "includes/required.php";
> do_html_header('Page Detail Statistics');
> 
> $query = "select
> count(tececo_stats.*) as tececo_stats.views, meta_data.title
> from
> meta_data, tececo_stats
> where
> meta_data.id = tececo_stats.id
> order by meta_data.id
> group by meta_data.id";
> $result = mysql_query($query) or die("Query failed: $query" .
> mysql_error());
> $num_results = mysql_num_rows($result);
> ?>
> 
> Page NameTota;Number of
> Sessions
>  for ($i=0; $i < $num_results; $i++)
>   {
>  $row = mysql_fetch_array($result);
>  echo
> ''.$row['meta_data.title'].''.$row['tececo_st
> ats.views'].'<
> /td>';
>  }
> ?>
> 
>  do_html_footer();
> ?>
> 
> error message:
> Query failed: select count(tececo_stats.*) as tececo_stats.views,
> meta_data.title from meta_data and tececo_stats where meta_data.id =
> tececo_stats.id order by meta_data.id
> You have an error in your SQL syntax near '*) as tececo_stats.views,
> meta_data.title from meta_data and tececo_stats whe' at line 2
> 
> What I want to do: This is essentially a script for a stats 
> program that I
> am writting that returns the number of hits for each page. Instead of
> looping a query I decieded to try and join the two tables to 
> make it more
> efficiant. I am trying to get it to work with hits now than 
> make it sessions
> later.
> 
> I hope this is enough info and thank you for your help.
> 
> 
> --
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com
> 
> 
> "Joakim Andersson" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I assume that 2count should really be count and 2 is just 
> the line-number
> > you added in this post...
> >
> > tececo_stats.views is (probably) the name of a column and 
> cannot be used
> as
> > an alias. Change it to something else.
> > change count(*) to count(tececo_stats.*) (I think that's 
> what you want)
> > And you probably need a group by-statement at the end: GROUP BY
> > whatever_you_need_to_group_by
> >
> > It's really difficult to answer your questions without the 
> table designs,
> > the error message and what you expect this query to do. 
> And, it's not
> > slightly OT. It's totally OT. :-)
> >
> > Regards
> > Joakim Andersson
> >
> >
> > > -Original Message-
> > > From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 09, 2002 10:10 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] Grr SQL syntax error silghtly OT
> > >
> > >
> > > Sorry :}
> > >
> > > I get a SQL syntax error at line two of the query:
> > >
> > > $query = "select
> > > 2count(*) as tececo_stats.views, meta_data.title
> > > from
> > > meta_data, tececo_stats
> > > where
> > > meta_data.id = tececo_stats.id";
> > >
> > > I have stared at this 'till i felt dizzy. can someone tell me
> > > what I am
> > > doing wrong so that I can learn from it?
> > >
> > > Thanks in advance
> > >
> > >
> > > --
> > > JJ Harrison
> > > [EMAIL PROTECTED]
> > > www.tececo.com
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] Grr SQL syntax error silghtly OT

2002-07-09 Thread joakim . andersson

Forgot. You have to change $row['tececo_stats.views'] to $row['num_hits']

/J

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 11:15 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Grr SQL syntax error silghtly OT
> 
> 
> I would try something like this...
> 
> SELECT COUNT(tececo_stats.id) as num_hits, meta_data.title
> FROM tececo_stats, meta_data
> WHERE meta_data.id = tececo_stats.page_id
> GROUP BY tececo_stats.page_id
> ORDER BY num_hits DESC
> 
> /Joakim
> 
> > -Original Message-
> > From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 09, 2002 11:07 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Grr SQL syntax error silghtly OT
> > 
> > 
> > table structure for tececo stats(Stores information about the 
> > visitors to my
> > site.visited is either 0 or 1 depending on whether or not the 
> > stats cookie
> > has been set):
> > 
> >   id int(11) unsigned NOT NULL auto_increment,
> >   page_id int(11) NOT NULL default '0',
> >   visited int(11) NOT NULL default '0',
> >   time int(11) NOT NULL default '0',
> >   remote_dns varchar(100) NOT NULL default '',
> >   remote_ip varchar(15) NOT NULL default '',
> >   referer varchar(200) NOT NULL default '',
> >   browser varchar(100) NOT NULL default '',
> >   system varchar(100) NOT NULL default '',
> >   PRIMARY KEY  (id),
> >   KEY page_id (page_id,time)
> > 
> > table structure for meta_data(contains information about the 
> > pages in my
> > website):
> > 
> >   id int(11) unsigned NOT NULL auto_increment,
> >   pid int(11) unsigned NOT NULL default '0',
> >   title varchar(200) NOT NULL default '',
> >   page_name varchar(75) NOT NULL default '',
> >   description text NOT NULL,
> >   keywords text NOT NULL,
> >   PRIMARY KEY  (id),
> >   KEY pid (pid)
> > 
> > main file(required.php automaticly does a DB connect and is 
> > used elsewhere
> > so I know is not the problem).
> >  > include "includes/required.php";
> > do_html_header('Page Detail Statistics');
> > 
> > $query = "select
> > count(tececo_stats.*) as tececo_stats.views, meta_data.title
> > from
> > meta_data, tececo_stats
> > where
> > meta_data.id = tececo_stats.id
> > order by meta_data.id
> > group by meta_data.id";
> > $result = mysql_query($query) or die("Query failed: $query" .
> > mysql_error());
> > $num_results = mysql_num_rows($result);
> > ?>
> > 
> > Page 
> NameTota;Number of
> > Sessions
> >  > for ($i=0; $i < $num_results; $i++)
> >   {
> >  $row = mysql_fetch_array($result);
> >  echo
> > ''.$row['meta_data.title'].''.$row['tececo_st
> > ats.views'].'<
> > /td>';
> >  }
> > ?>
> > 
> >  > do_html_footer();
> > ?>
> > 
> > error message:
> > Query failed: select count(tececo_stats.*) as tececo_stats.views,
> > meta_data.title from meta_data and tececo_stats where meta_data.id =
> > tececo_stats.id order by meta_data.id
> > You have an error in your SQL syntax near '*) as tececo_stats.views,
> > meta_data.title from meta_data and tececo_stats whe' at line 2
> > 
> > What I want to do: This is essentially a script for a stats 
> > program that I
> > am writting that returns the number of hits for each page. 
> Instead of
> > looping a query I decieded to try and join the two tables to 
> > make it more
> > efficiant. I am trying to get it to work with hits now than 
> > make it sessions
> > later.
> > 
> > I hope this is enough info and thank you for your help.
> > 
> > 
> > --
> > JJ Harrison
> > [EMAIL PROTECTED]
> > www.tececo.com
> > 
> > 
> > "Joakim Andersson" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I assume that 2count should really be count and 2 is just 
> > the line-number
> > > you added in this post...
> > >
> > > tececo_stats.views is (probably) the name of a column and 
> > cannot be used
> > as
> > > an alias. Change it to something else.
> > > change count(*) to count(tececo_stats.*) (I think that's 
> > what you 

RE: [PHP] PHP Image Functions

2002-07-09 Thread joakim . andersson

Well, you're halfway there...
You just have to separate the image-script from the rest like this:

image_spewing_script.php:


and in the other file (your actual page):

  

  

Regards
Joakim Andersson



> -Original Message-
> From: Mark Colvin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 11:27 AM
> To: Php (E-mail)
> Subject: [PHP] PHP Image Functions
> 
> 
> I have a directory of jpegs that I want to display thumbnails 
> of and have a
> link to the original jpeg. I would rather not create separate 
> thumbnails
> images preferring to create them in memory to display them. I 
> have installed
> GD v.1.8.4. The code below outputs jumbled text to the 
> browser (possibly the
> jpeg stream?). Code is as follows:
> 
> Why will this not work?
> 
> 
> 
> This e-mail is intended for the recipient only and
> may contain confidential information. If you are
> not the intended recipient then you should reply
> to the sender and take no further ation based
> upon the content of the message.
> Internet e-mails are not necessarily secure and
> CCM Limited does not accept any responsibility
> for changes made to this message. 
> Although checks have been made to ensure this
> message and any attchments are free from viruses
> the recipient should ensure that this is the case.
> 
> 
> -- 
> 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] PHP Image Functions

2002-07-09 Thread joakim . andersson

imagejpeg($thumbnail,'test.jpg',$quality);
should of course be
imagejpeg($thumbnail,'',$quality);

Otherwise you are creating a new image on your server and not outputting it
to the browser.

/Joakim

> -Original Message-
> From: Mark Colvin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 12:30 PM
> To: [EMAIL PROTECTED]
> Cc: Php (E-mail)
> Subject: RE: [PHP] PHP Image Functions
> 
> 
> Thanks for your reply. Its a bit further forward but still 
> not working. I
> have split the files and the output now shows the text part of 'img
> alt="text" src="...' ie it won't recognise the image. 
> Anything else you can
> think of?
> 
> 
> 
> 
> This e-mail is intended for the recipient only and
> may contain confidential information. If you are
> not the intended recipient then you should reply
> to the sender and take no further ation based
> upon the content of the message.
> Internet e-mails are not necessarily secure and
> CCM Limited does not accept any responsibility
> for changes made to this message. 
> Although checks have been made to ensure this
> message and any attchments are free from viruses
> the recipient should ensure that this is the case.
> 
> 

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




RE: [PHP] Sending data in table, multiple rows, via mail()

2002-07-09 Thread joakim . andersson

This bit looks kind of wierd. Don't know if it even should be possible to do
like that...
> $realcontent="
> 
> if ($myrow = mysql_fetch_array($result)) {
>   do {
> 
>
>$myrow[pid]
>$myrow[nm]
>$myrow[q]
>
>  
>   } while ($myrow = mysql_fetch_array($result));
> }
> 
> ";

You might wanna do like this instead:

$realcontent = "";
while ($myrow = mysql_fetch_array($result))
{
$realcontent .= "$myrow['pid']";
    $realcontent .= "$myrow['nm']";
$realcontent .= "$myrow['q']";
}

Regards
Joakim Andersson

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




RE: [PHP] Bug in SQL can you help?

2002-07-09 Thread joakim . andersson

> -Original Message-
> From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 12:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Bug in SQL can you help?
> 
> 
> Here is my SQL(used in a PHP script so this isn't ot)

PHP-script or not, it's still an SQL-query, right?

I'll give it a shot anyway...

> SELECT
> extract(year FROM time),
> extract(month FROM time),
> count(*) as monthly_views,
>   time
> FROM
> tececo_stats
> group by
>extract(year FROM time),
>extract(month FROM time)
> order by
>monthly_views desc
> limit 1
> 
> the problem is that is counts the number of rows in the whole 
> thing not the
> echoed row. How can I get it count the best days only?

SELECT CONCAT(YEAR(time), MONTH(time)) AS my_period, MAX(COUNT(*)) AS
monthly_views
FROM tececo_stats
GROUP BY my_period

/Joakim

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




RE: [PHP] Re: Wildcard

2002-07-10 Thread joakim . andersson



Regards
Joakim Andersson


> -Original Message-
> From: César Aracena [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 12:50 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: Wildcard
> 
> 
> Ok. Maybe I didn't express myself well (must be the 3-4 days awake ;)
> 
> No, I don't have an example on-line 'couse this is something 
> I'll start
> doing in a few days or hours. Well, just what it will probably be the
> search options at: http://www.icaam.com.ar/proyects/os-seek/ which I
> posted a few hours ago.
> 
> What I want, is to let the visitor search for an OS developer by
> WORK-AROUND and/or LANGUAGE and/or LOCATION and have just ONE static
> query to handle all this. The thing is that if I make the query like
> this:
> 
> SELECT * FROM table_name WHERE col1 = $elect1 AND col2 = $select2 AND
> col3 = $select3
> 
> I think maybe the script will go nuts if no option was selected
> (remember the and/or?). So I figured out that maybe by 
> telling HTML that
> the default value of each SELECT box is % (or any kind of 
> wildcard) the
> query might run as predicted. Does this makes ant sense now?
> 
> Please go to the site I've mentioned before and afterwards 
> (if have the
> time and will) go back a couple of dozens post back and read the post
> called *MORE WORK FOR US I HOPE* so you have a more clear 
> understanding
> of what my need will be.
> 
> Thanks, C.
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 10, 2002 7:27 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Re: Wildcard
> > 
> > why put in your query you want to look for an value .. if they don't
> want
> > to
> > look for it ?..
> > 
> > 
> > vins writes:
> > 
> > > Shit.
> > > Doesn't really make sense
> > > Sorry... I probably don't understand
> > >
> > > do you have an online example.
> > >
> > >
> > > "César aracena" <[EMAIL PROTECTED]> wrote in message
> > > 000101c227fb$74eed940$68ed0dd1@gateway">news:000101c227fb$74eed940$68ed0dd1@gateway...
> > > Hi all.
> > >
> > > I'm trying to figure out how to do a search trough a 
> MySQL db using
> LIKE
> > > or = but the thing is that I have 3 select boxes from where to
> choose
> > > the search terms. Can I use something like a wildcard instead of
> making
> > > several IF statements like this?
> > >
> > > SELECT * FROM table_name WHERE col1 = value1 AND col2 = value2 AND
> col3
> > > = %
> > >
> > > % goes for an unselected select box (default value = %) 
> in case the
> user
> > > doesn't want to make an *advanced* search, so it fetches all rows
> which
> > > does contains values 1 & 2.
> > >
> > > Thanks,
> > >
> > >  <mailto:[EMAIL PROTECTED]> Cesar Aracena
> > > CE / MCSE+I
> > > Neuquen, Argentina
> > > +54.299.6356688
> > > +54.299.4466621
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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] not parsing vars

2002-07-10 Thread joakim . andersson

Hmm, why post this here when I already answered your question in PHP-DB
(where it shouldn't have been in the first place) almost 40 minutes before
this post?

Regards
Joakim Andersson


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 10:29 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] not parsing vars
> 
> 
> hello all, 
> 
> i've install php 4.2.1 with apache 1.3.24
> but when i do something like :
> page.php?var=value&var1=value1 
> 
> then it does nothing.
> does any one have a solution ?
> or is it something that i have tot change in php.ini ? 
> 
> thanks in advance, 
> 
> Richard Pijnenburg
> The netherlands
> 
> -- 
> 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] Dos Paths

2002-07-10 Thread joakim . andersson

Hi all,

It's actually rather easy.

?

After this it's just a matter of parsing the dirlist and extracting the
right string...

Regards
Joakim Andersson

PS. dir /x works in Windows 2000, not sure about the others... DS.


> -Original Message-
> From: BB [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 2:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Dos Paths
> 
> 
> I've got an application that requires dos folder names (8.3 
> standard) as
> input.
> 
> I also have PHP, which quite happily can cope with both.
> 
> Can someone help me write a function to translate full paths 
> to dos paths
> 
> Thanks
> 
> 
> 
> -- 
> 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] Re: Images in Mysql

2002-07-10 Thread joakim . andersson

> Hi Asaf,
> 
> Thanks for the advice. That sounds like a good solution. One 
> thing I was 
> wondering about is...  when my PHP script saves the uploaded image to 
> the web server, how should the image be named [uniquely]? The 
> problem is 
> that if the user specifes the name of the image file, there's 
> a chance 
> he'll name another one the same way (and thus overwrite the 
> original). I 
> was thinking of maybe a dual approach, where the user gives the image 
> file a name, but then the PHP script appends, say, the table name and 
> record ID--so as to make the filename unique.
> 
> What do you think? Is that how you do it? (Or is there a better way??)

If you have a table that stores information about the images then I suggest
you use the record ID alone (with the correct file-extension) as a filename.
This will allways be unique, otherwise you probably have trouble with your
dB aswell...

This is how I do it.

Regards
Joakim Andersson

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




RE: [PHP] Table Making

2002-07-11 Thread joakim . andersson

This is one way of doing it:

- calculate how many rows are needed given the total number of records
(mysql_num_rows()) and how many columns you want.
- loop through all records and store them in a two-dimensional array
starting at arr[0][0] to arr[maxrows][0] and then increment the 'column' and
store arr[0][1] to arr[maxrows][1] etc. 
- loop through the array the other way round and create the html-table. So
start with arr[0][0] to arr[0][4] etc.

Make any sense?

Another way of doing it is to use mysql_data_seek() to jump back and forth
in the result set.

Regards
Joakim Andersson


> -Original Message-
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 11, 2002 8:05 AM
> To: PHP-General Mailing List
> Subject: [PHP] Table Making
> 
> 
> I'm driving myself crazy trying to visualize what I want to 
> do, so I thought
> I'd share the insanity and hope for some advice.
> 
> I have this nice piece of code to take my SQL result and 
> organize it into a
> nice 5 column table:
> 
> print "\n"; //start table
> 
> $i=0; //define variable - avoid errors
> $grad_year="";//define variable - avoid errors
> 
> while ($row = mysql_fetch_array($sql)) {
>   extract($row);
>   $i++;
> 
>   if($i=="1") {
>   print "\n"; //start table row on $i = 1
>   }
> 
>   printf(" href=\"year.asp?year=%s\">%s\n", $grad_year, $grad_year);
> //print links
> 
>   if ($i=="5") {
>   print "\n"; //end table row on $i = 5 
> to get 5 columns
>   $i=0; //reset $i
>   }
> 
>   $grad_year=""; //clear $grad_year
> 
>   }
> 
> if ($i<5) print "\n"; //end any rows with less than 5 columns
> 
> print "\n"; //end table
> ---END
> 
> Now, this works great for most things - it takes my SQL 
> results and puts
> them in a table sequentially, from left to right, top to 
> bottom. So in this
> case, the top-left cell displays "1941", the top-right cell 
> displays "1945",
> the next row starts with "1946" on the left and goes to 
> "1950" on the right,
> and so on.
> 
> What I want is rather than sorting left to right, top to 
> bottom, I want to
> sort top to bottom, left to right. So the top-left would 
> still be "1941",
> but rather than increasing to the right, it would increase down, then
> continue at the top of the next column.
> 
> I'm thinking this might be an easy thing to do with some 
> creative use of $i
> and print, but I just can't think it out. I'm guessing $i 
> would be used to
> limit the amount of items in a column... But, I'm in need of 
> some guidance
> to get it right. I can't even begin to think where to start. 
> Any help would
> be great - thanks!
> 
> Jason Soza
> 
> 
> -- 
> 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] Crazy idea about detecting visitor's connection speed

2002-07-16 Thread joakim . andersson

> I feel the idea is not accurate. My ip address (a static one from my 
> isp) would remain the same if I went to ADSL from my current 
> dial-up access.
> 
> HTH
> Chris

Yes. And how about all corporate networks? If I'm accessing your site from
our office I would get the low-speed version until you added our domainname
to your list. Then what if I connect to our modem-pool from home... Then you
wouldn't know I connected through a modem.

And my ISP at home doesn't have anything in their dns-names to differentiate
adsl from dial-up users.
Just my thoughts...
Regards
Joakim Andersson


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




RE: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?

2002-07-16 Thread joakim . andersson

I really think you should read the user comments in the online PHP-manual
before doing anything else...

Look here: http://www.php.net/manual/en/function.header.php

Regards
Joakim Andersson

> -Original Message-
> From: gilles [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 7:19 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] outputting a pdf file to IE browser? POST/GET 
> method bug
> or not?
> 
> 
> hi,
> 
> i've run in to a strange problem,
> 
> i'm trying to output a pdf file from disk to the browser.
> 
> this is fine under netscape but IE has problems.
> 
> consider the following code:
> ---
>  error_reporting(E_ALL);
> 
> session_start();
> if (!isset($_SESSION['download'])) {
>  @$_SESSION['download'] = $_GET['download'];
> }
> 
> if(isset($_GET["download"])){
>   $file_name=$_SESSION['download'];
>   header("Content-type:application/pdf");
>   header("Content-Disposition: inline;filename=\"mypdf.pdf\"");
>   header("Content-length:".(string)(filesize($file_name)));
>   header("location: $file_name");
> exit;
> }
> ?>
> 
> 
> 
> --
> 
> the above code runs fine on NS and IE,
> IE immediately loads and opens the pdf file inline.
> 
> but this code which only has the difference of using the POST method 
> instead of the GET metod results in a "file is corrupt" message!
> 
> --
>  error_reporting(E_ALL);
> 
> session_start();
> if (!isset($_SESSION['download'])) {
>  @$_SESSION['download'] = $_POST['download'];
> }
> 
> if(isset($_POST["download"])){
>   $file_name=$_SESSION['download'];
>   header("Content-type:application/pdf");
>   header("Content-Disposition: inline;filename=\"mypdf.pdf\"");
>   header("Content-length:".(string)(filesize($file_name)));
>   header("location: $file_name");
> exit;
> }
> ?>
> 
> 
> 
> --
> 
> 
> can anyone explain to me why you can't use the POST method?
> is this a bug or is this as expected (i didn't).
> 
> tnx,
> 
> gilles
> 
> i'm running php 4.2.1 on win2000 with IIS5
> 
> 
> -- 
> 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] Create Thumbnail from Blob online

2002-07-16 Thread joakim . andersson

> From: Tommi Trinkaus [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 16, 2002 1:25 PM
> Hi,
> 
> i stored some jpegs in an mysql-database (one field for data, 
> one for type)
> and i'm able to download them and to show them in an  tag.
> But wat i want is to use the stored data to create a 
> thumbnail to show it
> within the browser without creating a file - how can i pass 
> the mysql-blob
> directly to a gd-function like imagecreate() or imagejpg() ?? 
> (gd-library is
> working well)

Take a look at imagecreatefromstring()

> 
> thank you for any answer, tommi
> 

You're welcome!

Regars
Joakim Andersson

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




RE: [PHP] Purpose of $$var ?????

2002-07-16 Thread joakim . andersson

The cause for your problem would be that register_globals defaults to off in
PHP 4.2.x and greater.
The solution? Start using the new superglobals ($_POST, $_GET, $_SESSION
etc) or (not recomended) set register_globals = on in php.ini

Read more here:
http://www.php.net/manual/en/language.variables.predefined.php

Regards
Joakim Andersson


> -Original Message-
> From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 16, 2002 3:54 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Purpose of $$var ?
> 
> 
> The script was working great before PHP 4.2.x and not after 
> that.  So, I
> looked through the code and came upon this variable, "$$var". 
>  I have no
> idea what the purpose of the double "$" is for a variable.  
> Anyone know?
> 
> --clip--
> $var = "v".$counter."_high_indiv";
> $val3 = $$var;
> --clip
> 
> Thanks,
>  FletchSOD
> 
> 
> 
> -- 
> 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] Upload File Problem

2002-07-18 Thread joakim . andersson

> From: Mark Colvin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 10:09 AM
>
>   -- upload.php --
>  
> if ('img1' != "") {
This will allways be true! 'img1' is a string and will never be empty.
You probably mean if($img1 != "")
However, I'm not sure this will work in this case.

Try this instead. (Taken straight from the PHP-manual. A real good
resource!)



If you use PHP < 4.1.0 you must exchange $_FILES to $HTTP_POST_FILES

Regards
Joakim Andersson

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




RE: [PHP] draw statistics

2002-07-18 Thread joakim . andersson

> From: Jose Morales [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 11:34 AM
> 
> Hi!
> 
> Im looking for some class that alow me to draw an histogram, 
> or a piechar, for display statistics. 
> 
> thx!

http://www.hotscripts.com/PHP/Scripts_and_Programs/Graphs_and_Charts/

Regards
Joakim Andersson

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




RE: [PHP] Sessions: watertight?

2002-07-18 Thread joakim . andersson

Taken straigh from the manual:
(http://www.php.net/manual/en/ref.session.php)

[quote]
There are two methods to propagate a session id: 

- Cookies 

- URL parameter 

The session module supports both methods. Cookies are optimal, but since
they are not reliable (clients are not bound to accept them), we cannot rely
on them. The second method embeds the session id directly into URLs. 

PHP is capable of doing this transparently when compiled with
--enable-trans-sid. If you enable this option, relative URIs will be changed
to contain the session id automatically. Alternatively, you can use the
constant SID which is defined, if the client did not send the appropriate
cookie. SID is either of the form session_name=session_id or is an empty
string. 
[/quote]

Regards
Joakim Andersson


> -Original Message-
> From: PHPCoder [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 11:17 AM
> To: php-general
> Subject: [PHP] Sessions: watertight?
> 
> 
> Hi
> I'm doing some reading on sessions and how it works etc, and have a 
> concern (which is probably fed by my ignorance on the topic).
> The couple of "simple session examples" I have found in the PHP/MySQL 
> book by Luke Welling & Laura Thompson gives a simple 3 page session 
> example where the session is started on the first page, a variable is 
> registered as a session var and then has a link to the next 
> page where 
> the session_start() is called and the session_var is echoed to 
> illustrate the workings of a session.
> My understanding is that PHP will either use cookies to store the 
> session ID on the client's pc, or send it via URL, so, assuming that 
> cookies is a no-go, can I now assume that PHP will attach 
> it's session 
> ID to each and every URL located on my .php page?
> The reason I'm asking is as follow:
> I did the little excersise, and then deliberately rejected my 
> browsers 
> call to process the cookie, and then the script didn't return the 
> variable as it did previously...
> And now, assuming that I can assume that PHP will attach the 
> SID to all 
> URL's , how does it know to which URL's to attach, or am I 
> supposed to 
> manually attach them, leaving me with another question, If I have to 
> manually code the SID into the URL, then the whole session 
> "coockies if 
> possible" approach doesn't seem to work???
> 
> Can someone explain it in more detail for me plz?
> Thanks
> 
> 
> 
> -- 
> 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] PHP & HASP

2002-07-18 Thread joakim . andersson

[Snip]
> Can I use PHP to monitor the status HASP parallel port keylock in the
> client side?
[/Snip]

No you can't. PHP is server-side and has no access to client machines. You
could _maybe_ do it with JavaScript and then pass on the info to PHP with a
redirect or something like that.

Regards
Joakim Andersson

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




RE: [PHP] Sessions: watertight?

2002-07-18 Thread joakim . andersson

> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 11:46 AM
> 
> Joakim, please don't take offence, I know you're being helpful but ...

None taken.

> ... do we really need quotes from the manual? You've already 
> given the pointer 
> which is sufficient in itself for any interested parties to 
> look up the 
> relevant information.

You're right about this. Wont happen again... :-)

/Joakim

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




RE: [PHP] Upload File Problem

2002-07-18 Thread joakim . andersson

> From: Mark Colvin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 18, 2002 12:41 PM
> To: [EMAIL PROTECTED]
> 
> Joakim,
> 
> Thank you for your reply. I tried your example and get 
> 'Possible file upload
> attack: filename.' meaning that 'if
> (is_uploaded_file($_FILES['img1']['tmp_name']))' returns 
> false. I put a
> couple of echo statements in before the if statement to check 
> '$img1_name'
> '$img1_size and '$img1_type' and these all returned the 
> correct values. I
> have my upload_tmp_dir in php.ini set to /var/www/html/img 
> and this folder
> has 777 permissions. Do you think the file is not getting to 
> temp directory
> and if so any idea why?

Have you tried echoing $_FILES['img1']['tmp_name'] or
$HTTP_POST_FILES['img1']['tmp_name']?
If the first doesn't work, you may have to exchange $_FILES to
$HTTP_POST_FILES or $_FILES['img1']['tmp_name'] to $img1_tmp_name etc.

/Joakim

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




RE: [PHP] best way to delete char# 4-7 from a string?

2002-07-19 Thread joakim . andersson

> From: Justin French [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 19, 2002 7:39 AM
> To: php
> Subject: [PHP] best way to delete char# 4-7 from a string?
> 
> 
> Hi,
> 
> Let's say I have the following string:
> 
> $str = 'abcdefghijklmnop';
> 
> ...and I want to strip out char #'s 4 through to 7 (d,e,f,g)
> 
> $strip_start = 4;
> $strip_end = 7;
> 
> ($str would now be 'abchijklmnop';)
> 
> THEN I want to plug a new string $filler at position 4
> 
> $filler = '4567';
> 
> ($str would now be 'abc4567hijklmnop')

Hi,

substr_replace() does exactly what you want.

$newstring = substr_replace($str, "4567", 4, 4);

Regards
Joakim Andersson

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




RE: [PHP] Why won't this work?

2002-07-19 Thread joakim . andersson

> From: René Moonen [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 19, 2002 11:01 AM
  
> $result = mysql_query("SELECT COUNT(DISTINCT IP) AS ips FROM ma_counter");

You _might_ need to add "GROUP BY ip" (without quotes) to the end of that
query.

> Disclaimer: code not tested. You might want to check the MySQL manual 

Still not tested :-)

Regards
Joakim Andersson

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




RE: [PHP] Help is_dir command driving me crazy!

2002-01-24 Thread joakim . andersson

Try to add the following line above all code:

clearstatcache();

This clears the status from previous is_dir()'s.

Good luck,
Joakim


> -Original Message-
> From: Dean Dunn [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 22, 2002 6:11 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Help is_dir command driving me crazy!
> 
> 
> Can anyone tell me why this script doesn't work properly. 
> I've coded it
> several others ways including using is_dir pointing to the full path.
> Nothing works reliably, it works sometimes/sometimes not.
> 
> One interesting thing is that my PHP ecommerce app 
> (osCommrce) is run and
> then my script is run it always seems to work. This to me 
> points to some
> form of initialisation I'm missing.
> 
> Any advice would be gratefully received.
> 
> Regards,
> 
> Dean (a new PHP user)
> 
> Code Follows
> 
>  
> $dir_path = "\Inetpub\wwwroot\catalog\images";
> $dir = "abc";
> $complete_path = "$dir_path\\$dir";
> $dir_exists = "Directory already exists...can not create again";
> $dir_not_exist = "Directory does not exist...will try and create new
> directory";
> $dir_create_success = "Directory created";
> $dir_create_failure = "Could not create directory";
> 
> print ("Checking to see if subdirectory \"$dir_path\\$dir \"
> exists");
> 
> if (is_dir($complete_path) == true)
>  {
>  print $dir_exists;
>  }
> 
> else
>  {
>  print $dir_not_exist;
>  chdir ($dir_path);
>  if (mkdir ("abc",0700) == true) {
>  print $dir_create_success; }
>   else { print $dir_create_failure; }
>   }
> ?>
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Guestbook question

2002-02-25 Thread joakim . andersson

This example generates previous/next links but could be modified to make
links to page 1, 2, 3, 4, etc.

This code is not tested what so ever, but it should look something like
this:

-

 $rows_to_show = 10;

 $total_rows = mysql_num_rows(mysql_query("select name, post from guestbook
order by id desc", $db));
 $result = mysql_query("select name, post from guestbook order by id desc
LIMIT $offset, $rows_to_show", $db);
 
 while ($myrow = mysql_fetch_row($result)) {
echo "$myrow[0]\n";
echo "$myrow[1]\n";
++$counter;
 }

 if ($offset > 0)
   echo "Previous";

 if ($offset < $total_rows)
   echo "Next";

-
Call the page with myscript.php?offset=0

Good luck
Joakim


> -Original Message-
> From: James Taylor [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 22, 2002 8:40 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Guestbook question
> 
> 
> I have a really simple guestbook that allows someone to post 
> to the book, 
> then it displays all the entries.  Well, there are too many 
> entries now for 
> just one page and it looks kinda wacky, so I wanted to do 
> something where it 
> only displays 10 entries per page, then there are links for 
> pages say 11-20, 
> 21-30, etc.   I have no idea how to do this - I only know how 
> to limit the 
> number of entries per page.  So, the script that displays all 
> the entries 
> looks something like this:
> 
> 
> $counter = 0;
> $result = mysql_query("select name, post from guestbook order 
> by id desc", 
> $db);
> 
> while (($myrow = mysql_fetch_row($result)) && ($counter < 10)) {
>echo "$myrow[0]\n";
>echo "$myrow[1]\n";
>++$counter;
> }
> 
> 
> Well, that shows only the latest 10 alright, but what if I 
> wanted to show 
> entries 11-20?  I figure I could get the number of posts through 
> mysql_num_rows, I just can't piece it all together.  Any 
> suggestions would be 
> really helpful.
> 
> -- 
> 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] php - assigning date variables

2002-02-26 Thread joakim . andersson

I think you can't achieve this with the example you've provided.
Perhaps something like this will work:

query = "";
mysql_query("SELECT * FROM table ". $query );

query = "WHERE date = '2001-01-01'"; // This should return all rows with
2001-01-01 as date.
query = "WHERE date > '1995-01-01'"; // All items newer than 1995-01-01.
query = "WHERE date < '1995-01-01'"; // All items older than 1995-01-01.
query = "WHERE date > '1995-01-01' AND date < '1998-01-01'"; // All items
between 1995-01-01 and 1998-01-01.


Hope this helps
/Joakim

> -Original Message-
> From: Craig Westerman [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 25, 2002 7:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] php - assigning date variables
> 
> 
> $query = ""
> mysql_query("SELECT * FROM table WHERE date LIKE '%". $query ."%'");
> // returns all items in database
> 
> 
> $query = "2001-01-01"
> mysql_query("SELECT * FROM table WHERE date LIKE '%". $query ."%'");
> // returns all rows that have 2001-01-01 as the date
> 
> 
> What is proper way to define a variable to include all dates 
> newer than
> 1995-01-01?
> $query = "???"
> 
> What is proper way to define a variable to include all dates 
> older than
> 1995-01-01?
> $query = "???"
> 
> What is proper way to define a variable to include all  dates between
> 1995-01-01 and 1998-12-31?
> $query = "???"
> 
> 
> Everything I tried gives me a error. This has to be simple, 
> but I must be
> overlooking something. Where would I find the answer?
> 
> Thanks
> 
> Craig ><>
> [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] Unable to display images on browser

2002-02-27 Thread joakim . andersson

Well, you probably need to do something like this:

file1.php (where you want to display an image)



end file1


getimage.php (the  
---end getimage.php

Good Luck
/Joakim


> -Original Message-
> From: Narvaez, Teresa [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 27, 2002 2:08 AM
> To: 'Dean Householder'; [EMAIL PROTECTED]
> Subject: [PHP] Unable to display images on browser
> 
> 
> Hello, 
>   I do not understand why I can't display images 
> retrieved from MySQL
> on my browser(IE 4.0).  When I retrieve the image from MYSQL I set the
> Header function to change the type of content(image/gif) I am 
> sending to the
> browser. However, the browser displays an box with an X in 
> it.  I would
> greatly appretiate any ideas/help.  Here is the piece of 
> code:  Thanks in
> advance! -Teresa
> 
>   Code to connect and selected DB not included
> -
> $dbQuery = "Select PicNum, size, type, description, Image";
> $dbQuery .= " FROM Images WHERE PicNum = $fileId";
> 
> $result = mysql_query($dbQuery)
> or die ("Could not get file list: " . mysql_error() );
> echo "Sent Query successfully";
> 
> if ( mysql_num_rows($result) == 1)
> {
> $fileType = @mysql_result($result,0, "type");
> $fileContent = @mysql_result($result, 0, "Image");
> $filedesc = @mysql_result($result,0, "description");
> $filenum = @mysql_result($result,0, "PicNum");
> //  Header("Content-type: $fileType"); 
> Header("Content-type: image/gif");
> echo $fileContent;
> }   
> else
> {
> echo "Record does not exist";
> } // else
> ?> 
> 

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




RE: [PHP] Unable to display images on browser

2002-02-28 Thread joakim . andersson

You need to insert the following lines after this line:
Header("Content-type: image/gif");

$im = ImageCreateFromString ($fileContent); 
ImageGif ($im); 

and then remove this line: echo $fileContent;
That should do it.

/Joakim

-Original Message-
From: Narvaez, Teresa [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 8:32 PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] Unable to display images on browser


Hello, Thanks for your help.  This is what I have for file1.php and
ddownloadfile.php.  What I want is to click on "Donwnload now" link and be
able to get the file out of the database and display it on the browser.
Thank you in adavance, -Teresa
file1.php 
--- 
 
  SOME_HTLM_CODE_TO_DISPLAY_DB_FIELDS_GOES_HERE; 
//  \"
> 
  " > 
 Download Now 
   
   
   
"; 
if ( mysql_num_rows($result) == 1) 
{ 
$fileType = @mysql_result($result,0, "type"); 
$fileContent = @mysql_result($result, 0, "Image"); 
$filedesc = @mysql_result($result,0, "description"); 
$filenum = @mysql_result($result,0, "PicNum"); 
Header("Content-type: image/gif"); 
echo $fileContent; 
} 
else 
{ 
echo "Record does not exist"; 
} // else 
?> 

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




RE: [PHP] exists?

2002-03-05 Thread joakim . andersson

Perhaps something like this:

if(strpos($searchenquiry, "%"))
{   
do
}else{
don't
}

/Joakim


> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 05, 2002 9:29 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] exists?
> 
> 
> It's late, I'm tired.
> I want to parse $searchenquiry
> 
> if("%" exists in $searchenquiry)
> {
> do ...
> }else{
> do ...
> }
> 
> 
> 
> -- 
> 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] Directory

2002-03-05 Thread joakim . andersson

mkdir()

http://www.php.net/manual/en/function.mkdir.php


> -Original Message-
> From: Roman Duriancik [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 05, 2002 9:45 AM
> To: PHP-General
> Subject: [PHP] Directory
> 
> 
> Help me, I want create directory on local disc in php script, 
> do you know
> how ?
> 
> 
> -- 
> 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] Copying file to a network drive (in WinNT4)

2001-10-01 Thread joakim . andersson

Yes, but when you run it from command line it is run with your account that
has H:\ mapped.
The scheduler is run as the account 'System' and that doesn't know anything
about H:\.

/Joakim

> -Original Message-
> From: Warren Vail [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, September 29, 2001 7:27 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Copying file to a network drive (in WinNT4)
> 
> 
> I'll give this a try and let you know.  PHP seems to be able 
> to get to my H
> drive when I execute via the command line;
> 
> >c:/apache/php/php.exe backup.php
> 
> but seems to not be able to find the H drive when run as a 
> timed process;
> 
> >at 7:00pm each(M,T,W,T,F) "c:/apache/php/php.exe backup.php" 
>(not sure
> about the exact syntax here)
> 
> perhaps the UNC path will do it.
> 
> Thanks,
> 
> Warren Vail
> 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 28, 2001 1:14 AM
> To:   [EMAIL PROTECTED]
> Subject:  SV: [PHP] Copying file to a network drive (in WinNT4)
> 
> My best bet is that PHP doesn't know that h:\ exists. I have 
> seen similar
> things before,
> though not in PHP. Have you tried using the UNC path instead
> (\\COMPUTER\SHARE)?
> 
> >I also tried to execute a direct copy command via command prompt:
> >$cmd = "cmd /c copy $src $dest";
> >passthru($cmd);
> 
> Try mounting the network drive in PHP then copy the file:
> 
> $cmd = "cmd /c net use h: \\COMPUTER\SHARE"; //Mount drive
> passthru($cmd);
> 
> //Copy the file here
> 
> $cmd = "cmd /c net use h: /delete"; //Unmount the drive
> passthru($cmd);
> 
> 
> /Joakim
> 
> > -Ursprungligt meddelande-
> > Från: Warren Vail [mailto:[EMAIL PROTECTED]]
> > Skickat: fredag den 28 september 2001 03:37
> > Till: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Kopia: [EMAIL PROTECTED]
> > Ämne: RE: [PHP] Copying file to a network drive (in WinNT4)
> >
> >
> > Let me know what you find, if anything.  Seems I may be 
> encountering a
> > similar problem executing mysqldump from a php script as a
> > scheduled command
> > on nt4.  I can execute the command writing to a local drive
> > and a remote
> > drive when I execute from the DOS command line, but when 
> running as a
> > scheduled (the AT command), the copy to the local drive 
> works, but the
> > remote mounted drive fails.  Does this sound similar?
> >
> > Good Luck,
> >
> > Warren Vail
> >
> > -Original Message-
> > From:   Joe Kaiping [mailto:[EMAIL PROTECTED]]
> > Sent:   Thursday, September 27, 2001 12:30 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject:RE: [PHP] Copying file to a network drive (in WinNT4)
> >
> >
> >
> > > -Original Message-
> > > From: Ville Mattila [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, September 27, 2001 11:10 AM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Copying file to a network drive (in WinNT4)
> > >
> > > > Also, make sure that you have permission to create/modify
> > > the $dest file.
> > >
> > > Should be, because I can copy the file via "normal way" in
> > Windows
> > >
> > >
> >
> > Hi again,
> >
> > Not sure what you're up against.  I searched
> > http://www.php.net to confirm
> > h:\file is the correct Windows file system syntax to use.
> > Seems to be.
> > Also there is no mention of copy() not working on windows,
> > (except for when
> > using a sharename instead of a mapped drive name. (But you're
> > using a mapped
> > drive name, h))
> >
> > The apache daemon on unix runs under the permissions of a
> > certain system
> > user, usually "nobody".  Not sure how NT does it, but if it
> > also runs under
> > a specific user, maybe that user doesn't have permission to
> > write to the
> > file?
> >
> > However, the version of PHP I'm running gives a "Permissions"
> > error message
> > when it doesn't have permission to write to the file.  You
> > got the following
> > error instead, but I'm not sure about the behavior of PHP on
> > windows, maybe
> > a different error message is output when you don't have permission.
> >
> > Warning: Unable to create 'h:\redhouse.jpg': Invalid argument in
> > c:\apache\htdocs\copypic.php on line 14
> >
> > Anyway, I was unable to reproduce the "Invalid argument"
> > error on Unix. I
> > would doubt that there in a bug with copy() for Windows
> > without it already
> > appearing on the PHP site.  So I'd guess that it is caused 
> because PHP
> > doesn't like the format of the contents of either $src or
> > $dest. I'd suggest
> > going over those again with a magnifying glass.  It sounds
> > like you already
> > have, though, so I'm out of thoughts for right now.
> >
> > Sorry for not being able to help any more.  Best of luck!
> >
> > -Joe
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL