php-general Digest 17 Dec 2001 10:15:05 -0000 Issue 1057
Topics (messages 77884 through 77924):
large object problem
77884 by: David H
77907 by: Manuel Lemos
URL checking
77885 by: trx
77903 by: Phillip Oertel
Question for you MySQL gurus...
77886 by: Deron
77887 by: Deron
77914 by: David
Re: Searching for a new provider
77888 by: Indera
PHP object-oriented features
77889 by: Colin Tucker
77891 by: Martin Towell
Re: using variables
77890 by: Gerard Onorato
php.ini
77892 by: Jeremiah Jester
77895 by: jtjohnston
mysql_query() problem
77893 by: Brian Rue
77916 by: Yasuo Ohgaki
Re: i get a warning after upgrading to 4.1.0 (repost)
77894 by: Phillip Oertel
Re: pictures width and height
77896 by: Phillip Oertel
picture gallery
77897 by: Jeremiah Jester
77912 by: steph.philedom2k.com
Re: Opinions, please
77898 by: Ray Gaylog
Re: problem finding out original filename while using php to upload.
77899 by: Ray Gaylog
77909 by: Daniel Grace
printf()?
77900 by: Ray Gaylog
77901 by: Jason Murray
77902 by: Mark Charette
Re: Problem with Code
77904 by: Phillip Oertel
Re: how to reinitialise an MySQL_fetch_array
77905 by: Frederick L. Steinkopf
Re: Unable to return object references from functions
77906 by: Manuel Lemos
77908 by: Tom Rogers
77911 by: Manuel Lemos
HTTP Authentication problems
77910 by: Daniel Grace
User Authentication
77913 by: Daniel Grace
Re: PHP4.1.0 & Apache1.3.22 under WinXP
77915 by: Daniel Grace
Goofy interactions between $this and vars in classs. 4.1.0
77917 by: Mark
77921 by: Maxim Derkachev
TN3270?
77918 by: brendan
PHP as a web browser?
77919 by: David Yee
77922 by: Lawrence.Sheed.dfait-maeci.gc.ca
77924 by: Stefan Rusterholz
postgres session handling
77920 by: James Gregory
Checking a frames url..
77923 by: Necro
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi all,
I am trying to findout what is wrong with this script
can anyone help?
$dbconn = pg_connect ("cnnection string")
or die ( "Error: ".pg_errormessage
($dbconn)) ;
pg_exec ($dbconn, "begin") ;
$oid = pg_locreate ($dbconn) ;
$fd = pg_loopen ($dbconn, $oid, "w") ;
pg_lowrite ( $fd, $img ) ;
pg_loclose ( $fd ) ;
$strqry = "INSERT INTO tblImg ( myname, mytype,
myimg, myfilesize ) VALUES ( '$img_name', '$img_type',
'$oid', $img_size )";
$result = pg_exec ( $dbconn, $strqry ) ;
pg_exec ($dbconn, "commit") ;
pg_exec ($dbconn, "end") ;
The output that I am getting is this
/tmp/phpQPUyx2
by pg_loreadall function.
Thanks,
David
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---
Hello,
David H wrote:
>
> Hi all,
>
> I am trying to findout what is wrong with this script
> can anyone help?
>
> $dbconn = pg_connect ("cnnection string")
>
> or die ( "Error: ".pg_errormessage
> ($dbconn)) ;
>
> pg_exec ($dbconn, "begin") ;
> $oid = pg_locreate ($dbconn) ;
> $fd = pg_loopen ($dbconn, $oid, "w") ;
> pg_lowrite ( $fd, $img ) ;
> pg_loclose ( $fd ) ;
> $strqry = "INSERT INTO tblImg ( myname, mytype,
> myimg, myfilesize ) VALUES ( '$img_name', '$img_type',
> '$oid', $img_size )";
> $result = pg_exec ( $dbconn, $strqry ) ;
> pg_exec ($dbconn, "commit") ;
> pg_exec ($dbconn, "end") ;
>
> The output that I am getting is this
>
> /tmp/phpQPUyx2
>
> by pg_loreadall function.
Similarly, you need to do pg_loopen on a OID returned by a select query.
Anyway, if you want to try something that works with easier to
understand interface, maybe you would like to try Metabase which is a
database abstraction PHP package that provides a single and portable
interface to BLOBs that supports PostgreSQL among many other databases.
Metabase is free and you may download it from here:
http://phpclasses.UpperDesign.com/browse.html/package/20
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
Hi, I'm very much a newbie!
I'm trying to set up a site which will automatically test links in a large
link directory and show date and time of last check and whether or not a
link to the external URL was dead or alive at the time.
On looking at the PHP manual it is not completely obvious which function I
should be using, does fopen achieve this; how does it handle a site such as
http://www.bloggs.com where the default file might be index.htm or
default.php and what does it do if a 404 error is encountered, does it
recognize that in fact no file has been found?
I hope this makes sense and that someone can point me in the right direction
:}
Many thanks,
TonyK
--- End Message ---
--- Begin Message ---
Trx wrote:
> Hi, I'm very much a newbie!
> I'm trying to set up a site which will automatically test links in a large
> link directory and show date and time of last check and whether or not a
> link to the external URL was dead or alive at the time.
the curl library will let you do this. query the link, and then evaluate
the server's response. but first of all check if you have curl enabled.
<?php phpinfo(); ?>
then check out the example, two functions i happened to write a few days
ago, no kidding. ;-)
make sure you are prepared for that the remote server doesn't respond at
all.
phil.
<?php
echo getHttpStatusCode("http://www.phillipoertel.com/index.html");
function getHttpHeader($url) {
ob_start(); // send all output to a buffer instead of being displayed
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
// you could probably achieve the same with the following line.
# curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "HEAD / HTTP/1.0");
curl_exec($ch);
curl_close ($ch);
// put all buffered output into $header
$header = ob_get_contents();
ob_end_clean();
return $header;
}
function getHttpStatusCode($url) {
$header = getHttpHeader($url);
// grab only first line of the header
list($status) = explode("\n",$header);
$code = explode(" ",$status);
return $code[1];
}
?>
HTTP Status Codes:
*************
100 Continue
101 Switching Protocols
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily / Found
303 See Other
304 Not Modified
305 Use Proxy
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Time-Out
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URL Too Large
415 Unsupported Media Type
500 Server Error
501 Not Implemented
502 Bad Gateway
503 Out of Resources
504 Gateway Time-Out
505 HTTP Version not supported
--- End Message ---
--- Begin Message ---
I have a huge project I am in the midst of developing (something similar to
www.allmusicguide.com except exclusively for Metal/Hard Rock). I have set up
my MySQL tables/PHP code for the most part. My question is 2 part:
Of you all, do you use a GUI platform such as MySQL Manager or MySQLGUI,
etc. or do you hard core it via Telnet and command line?
Secondly, I hope I can explain this easy enough.... Comparing to like Access
DB... you know if you have multiple tables, you can take one table... put in
your data... then in subsequent tables... you can set it up so that certain
fields create dropdowns and "display" the data from the first table's field,
so that you don't have to use any guesswork and so that if you change the
data in the first table, it updates subsequent other tables (I hope that
makes sense). Is there anythin in/for MySQL that acts like that? I have read
up on the "join table" command in MySQl but that isn't exactly what I am
referring to. Any help/knowledge on this appreciated!
Pretty much... I have around 12 tables or so.. band, album, producers,
logos, etc.. and I have recurring fields between themm such as a field
called "bandname". I am just looking to see if I have to manually add this
field's data to it or if there is a solution to "tie" these other tables to
one source table. thanks!
Deron
www.metalages.com
--- End Message ---
--- Begin Message ---
Let me add that I do currently use PHPMyAdmin. As cool as it is I juts want
to see what others are using to make sure I am not missing out on anything!
Deron
www.metalages.com
"Deron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a huge project I am in the midst of developing (something similar
to
> www.allmusicguide.com except exclusively for Metal/Hard Rock). I have set
up
> my MySQL tables/PHP code for the most part. My question is 2 part:
>
> Of you all, do you use a GUI platform such as MySQL Manager or MySQLGUI,
> etc. or do you hard core it via Telnet and command line?
>
> Secondly, I hope I can explain this easy enough.... Comparing to like
Access
> DB... you know if you have multiple tables, you can take one table... put
in
> your data... then in subsequent tables... you can set it up so that
certain
> fields create dropdowns and "display" the data from the first table's
field,
> so that you don't have to use any guesswork and so that if you change the
> data in the first table, it updates subsequent other tables (I hope that
> makes sense). Is there anythin in/for MySQL that acts like that? I have
read
> up on the "join table" command in MySQl but that isn't exactly what I am
> referring to. Any help/knowledge on this appreciated!
>
> Pretty much... I have around 12 tables or so.. band, album, producers,
> logos, etc.. and I have recurring fields between themm such as a field
> called "bandname". I am just looking to see if I have to manually add this
> field's data to it or if there is a solution to "tie" these other tables
to
> one source table. thanks!
>
> Deron
> www.metalages.com
>
>
--- End Message ---
--- Begin Message ---
have you tried MySQL Front? it\'s a really nice win32 client, check it out from:
http://www.anse.de/mysqlfront/
screenshot: http://www.anse.de/mysqlfront/images/mysqlfront.gif
>I have a huge project I am in the midst of developing (something similar to
>www.allmusicguide.com except exclusively for Metal/Hard >Rock). I have set up
>my MySQL tables/PHP code for the most part. My question is >2 part:
>Of you all, do you use a GUI platform such as MySQL >Manager or MySQLGUI,
>etc. or do you hard core it via Telnet and command line?
--- End Message ---
--- Begin Message ---
Ah,
I thought that I may have missed something when I was reviewing the features.
Thank you.
Indera
R'Twick Niceorgaw wrote:
> Just name of one of Aletia's servers
> -------------------------------------------
> R'twick Niceorgaw
> 98C Cedar Lane
> Highland Park, NJ 08904
> USA
> 732-246-1434 (R)
> 732-801-3826 (M)
> --------------------------------------------
>
> ---------- Original Message ----------------------------------
> From: Indera <[EMAIL PROTECTED]>
> Date: Sat, 15 Dec 2001 23:33:39 -0500
>
> >Hello,
> >
> >This may sound like a weird question, but since I've seen two posts on it, I have
>to ask, what is a
> >stingray server?
> >
> >Indera
> >
> >
> >
> >R'Twick Niceorgaw wrote:
> >
> >> cool.. I'm also on stingray:)
> >> ----- Original Message -----
> >> From: "Nuitari" <[EMAIL PROTECTED]>
> >> To: "PHP LIST" <[EMAIL PROTECTED]>
> >> Sent: Thursday, December 13, 2001 2:19 PM
> >> Subject: RE: [PHP] Searching for a new provider
> >>
> >> > I switched to Aletia in April I believe, and have been pleased. I asked
> >> for
> >> > pdflib to be compiled on the server my site is on (stingray), and they
> >> did.
> >> > It took about 3 days. My server has been up for 52 days 15 minutes, so
> >> that
> >> > is good...however, 2 times in the last 6 months I have been denied access
> >> > because the server had run out of harddrive space...It seemed like the
> >> > matter was taken care of relatively promptly though.
> >> >
> >> > All in all, Aletia is good bang for the buck. I'm going to stick with
> >> them.
> >> >
> >> > -Jamison.
> >> >
> >> > -----Original Message-----
> >> > From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]]
> >> > Sent: Tuesday, November 13, 2001 12:35 AM
> >> > To: 'Indera'; [EMAIL PROTECTED]
> >> > Subject: RE: [PHP] Searching for a new provider
> >> >
> >> >
> >> > Welcome abroad Indrea.
> >> >
> >> > But, their support is not the very best in industry. Lately I have seen
> >> some
> >> > detoriation but usually my emails are answered in 1-2 days. Earlier I used
> >> > to find them almost 24x7 on ICQ and AIM but haven't seen them on line for
> >> > almost a month now. But all my emails are answered in a day or two. One
> >> more
> >> > thing, I'm very happy with their server up time though. My server has been
> >> > up for more than 51 days now :)
> >> >
> >> >
> >> >
> >> > --
> >> > 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]
> >
> >
--- End Message ---
--- Begin Message ---
Hi there,
Just wondering if there is any plans for more work on the PHP OO features,
and/or the parser in relation to these features. Generally I find the PHP
OO features to be quite useful, but there is some major limitations which
often frustrate me at times, for example:
$result = $object->method()->returnedObject->anotherMethod();
That won't work with PHP as it is now. Instead, you'd have to do this:
$returnedObject = $object->method();
$result = $returnedObject->anotherMethod();
:(
Seems like a simple annoyance, right? Well some code I'm working on would
work best like this:
$object->getSomething()->getSomething()->getSomething()->addSomething("foo")
;
Instead, all you can do is this:
$result = $object->getSomething();
$result = $result->getSomething();
$result = $result->getSomething();
$result->addSomething("foo");
Again, not good. :(
Another thing is multiple inheritance, or 'implementing' an object, rather
than extending just one. Like this:
class Foo extends Bar implements Eep
{
}
Foo is a subclass of Bar, but *uses* the methods/attributes of Eep.
Yeah, I know, PHP is not at heart an OO language, but I really LIKE PHP! I
don't want to use JSP or something because I think Java is slow and over
complicated. So, is there any chance that these features could be added in
the future at some stage? Please? ;)
Cheers,
Colin.
--- End Message ---
--- Begin Message ---
I totally agree with you!!
>From what someone told me, the new version of the Zend engine will fully
support OOP (but don't quote me on this as I haven't had time to look at the
Zend site to confirm this) - I'm looking forward to seeing it. This would
make PHP a really powerful language then!!
Martin
-----Original Message-----
From: Colin Tucker [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 17, 2001 11:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP object-oriented features
Hi there,
Just wondering if there is any plans for more work on the PHP OO features,
and/or the parser in relation to these features. Generally I find the PHP
OO features to be quite useful, but there is some major limitations which
often frustrate me at times, for example:
$result = $object->method()->returnedObject->anotherMethod();
That won't work with PHP as it is now. Instead, you'd have to do this:
$returnedObject = $object->method();
$result = $returnedObject->anotherMethod();
:(
Seems like a simple annoyance, right? Well some code I'm working on would
work best like this:
$object->getSomething()->getSomething()->getSomething()->addSomething("foo")
;
Instead, all you can do is this:
$result = $object->getSomething();
$result = $result->getSomething();
$result = $result->getSomething();
$result->addSomething("foo");
Again, not good. :(
Another thing is multiple inheritance, or 'implementing' an object, rather
than extending just one. Like this:
class Foo extends Bar implements Eep
{
}
Foo is a subclass of Bar, but *uses* the methods/attributes of Eep.
Yeah, I know, PHP is not at heart an OO language, but I really LIKE PHP! I
don't want to use JSP or something because I think Java is slow and over
complicated. So, is there any chance that these features could be added in
the future at some stage? Please? ;)
Cheers,
Colin.
--
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]
--- End Message ---
--- Begin Message ---
David,
Your code should read:
<html>
<body>
<img src="<? echo($ulo); ?>">
</body>
</html>
-----Original Message-----
From: David Killingsworth [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 16, 2001 2:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP] using variables
I'm trying to determing why this won't work.
I wish to assign graphics to variables then call them
within the HTML on my .php pages.
------test.php----------
<?
$ulo = "/images/ulo.gif";
?>
<html>
<body>
<img src="<?$ulo?>">
</body>
</html>
-------end test.php---------
The resulting output viewing the html source from the
browser is:
----html output----------
<html>
<body>
<img src="">
</body>
</html>
-------end html output-----
there is obviously a programming error here, but after
hours of trying things I'm just missing what it is.
the <img src> tag should read
<img src="/images/ulo.gif">
What am I missing?
David.
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--
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]
--- End Message ---
--- Begin Message ---
Does it matter where my php.ini file is located on a windows2000 system?
Does it always need to be on the root of the volume where the files are
being served or can it be located on another volume?
Thanks,
JJ
--- End Message ---
--- Begin Message ---
In Win98 at least it should be in C:\Windows.
php.ini could also be run out of the directory where the *.php is running.
Jeremiah Jester wrote:
> Does it matter where my php.ini file is located on a windows2000 system?
> Does it always need to be on the root of the volume where the files are
> being served or can it be located on another volume?
> Thanks,
> JJ
--- End Message ---
--- Begin Message ---
Hi,
I'm getting the error
<<Warning: Supplied argument is not a valid MySQL result resource>>
from this code:
function validateUser($username,$password) {
$conn = connectToMySQL();
mysql_select_db($db_name,$conn);
$query="select * from members where username='".$username."' AND
password='".$password."'";
$result = mysql_query($query,$conn);
if (mysql_num_rows($result) != 0) { //*this is the line that returns the
error*
return true;
} else {
return false;
}
}
I've checked that the connection works, and that the query is what it should
be, and the query works when I type it into the terminal. Any ideas?
Thanks,
Brian Rue
--- End Message ---
--- Begin Message ---
Brian Rue wrote:
> Hi,
>
> I'm getting the error
> <<Warning: Supplied argument is not a valid MySQL result resource>>
>
> from this code:
>
> function validateUser($username,$password) {
> $conn = connectToMySQL();
> mysql_select_db($db_name,$conn);
> $query="select * from members where username='".$username."' AND
> password='".$password."'";
> $result = mysql_query($query,$conn);
> if (mysql_num_rows($result) != 0) { //*this is the line that returns the
> error*
> return true;
> } else {
> return false;
> }
> }
>
> I've checked that the connection works, and that the query is what it should
> be, and the query works when I type it into the terminal. Any ideas?
>
> Thanks,
> Brian Rue
>
>
>
I suppose it is fixed in 4.1.1-dev.
--
Yasuo Ohgaki
--- End Message ---
--- Begin Message ---
John Lim wrote:
> This is a known bug with persistent database connections. Switching to
> non-persistent connections or ISAPI avoids this problem.
thanks !
--- End Message ---
--- Begin Message ---
Tommy Straetemans wrote:
> Is there a way to check the height and width from a picture that I upload?
yes, easy.
but you need gdlib installed.
<?php phpinfo(); ?>
will tell you.
from the documentation:
" The GetImageSize() function will determine the size of any GIF, JPG,
PNG, SWF, PSD or BMP image file and return [in an array] the dimensions
along with the file type and a height/width text string to be used
inside a normal HTML IMG tag."
please also consult the php documentation for other (image) functions,
it's excellent.
phil.
--- End Message ---
--- Begin Message ---
does anyobody have a simply php image gallery script they could share with
me? Using for my personal site.
Thanks,
JJ
--- End Message ---
--- Begin Message ---
Jester,
did you try hotscripts.com?? They have plenty of gallery scripts there.
Steph
----- Original Message -----
From: "Jeremiah Jester" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 16, 2001 8:44 PM
Subject: [PHP] picture gallery
> does anyobody have a simply php image gallery script they could share with
> me? Using for my personal site.
> Thanks,
> JJ
>
>
> --
> 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]
--- End Message ---
--- Begin Message ---
Well,
One way is to log that the user is online into a database...or a flat file.
I have done this before using a database (very easy), however I have not
used a file yet..but it is possible. Use fopen() routines and fclose() for
the low level file access.
Another method is to use cookies..the user can turn this off..and it can
still be compromised.
In the end if you can't use sessions, then use a flat file, or a database.
If you don't have either of these, then I would like to hear what you
solution is.
As I'm interested in how you would overcome this problem...
PS: You could also use URL rewriting?..but then, thats not to secure...(or
pass the variable(s) to each page via a GET submission..just tag on the
variable to the end of your "next page" link)
-Ray
Ray Gaylog
[EMAIL PROTECTED]
----- Original Message -----
From: "Gaylen Fraley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 15, 2001 11:49 PM
Subject: [PHP] Opinions, please
> A security question, concerning PHP and overall best practice.
>
> I have an application that is used by users that have no control over what
> version of PHP is on their server. Some versions do not support sessions.
> So, I am attempting to modify the code to accommodate this and minimize,
if
> not eliminate, the risk of a break-in.
>
> Basically, index.php (pageA) can call admin.php (pageB).
> pageB accepts a userid and password ($user/$pass). At this point, these
are
> form variables that will be passed, via $HTTP_POST_VARS.
> pageB calls pageC, which verifies the user/pass against a security file.
If
> validated, then pageC is accessed. If not, user is kicked out.
>
> No problem so far and no variables have been exposed. But, from pageC,
you
> can go down several paths. Now to the question/opinion. How do I
validate,
> w/o sessions, that pageD or pageE has been entered from pageC and not
> forged? I can pass the user/pass via a hidden field on the form of pageC,
> but that exposes it. Philosophically, this may not be a problem, since
the
> user has to go through pageC to get to the other ones anyway. Use
referer?
> That seems like that could easily be forged.
>
> Your thoughts?
>
>
> --
> Gaylen
> [EMAIL PROTECTED]
> Home http://www.gaylenandmargie.com/
> PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/
>
>
>
>
> --
> 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]
>
--- End Message ---
--- Begin Message ---
Well..to determine the format the file file..you may find some sort of
routine to check..but why not create one?
I mean, in windows, the extension determines the file format right?
So do a loop that starts from the last character, and goes back one until
you reach the "." (dot).
Based on that you can determine the format type..
Of course, if the user renamed a .bmp to a .jpeg then you won't be able to
tell that this was originally a .bmp file...
Ray Gaylog
[EMAIL PROTECTED]
----- Original Message -----
From: "Neil M" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 16, 2001 3:22 PM
Subject: [PHP] problem finding out original filename while using php to
upload.
> I am using php to upload image files.
>
> heres my code ..
>
> <?
> if (is_uploaded_file($photo_file))
> {
>
> clearstatcache ();
> $size = filesize ( $photo_file ) ;
> if ( $size > 1024000 )
> {
> print ("<BR> ERROR - File is too big ! File uploads should be below 1024
k
> ( 1mb ) <BR>"); exit ;
> }
> move_uploaded_file($photo_file, "$upload_path$check_nick->nickname");
> }
> else
> {
> echo "<BR> ERROR : File upload was not successfull , please try again
> !<BR>";
> }
> ?>
>
> ------
>
> the problem is that when i look for the original filename ( e.g.
> myphoto.gif ) , $photo_file contains a random file name like 383hr93php
>
> As i mentioned , its image files i am uploading , how do i know what type
of
> image the file was ? like .jpg , .png etc.
>
> Any help appreciatted , i am really stuck on this ;0)
>
> Thanks
>
> Neil M
>
>
>
>
> --
> 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]
>
--- End Message ---
--- Begin Message ---
"Neil M" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am using php to upload image files.
>
> heres my code ..
>
> <?
> if (is_uploaded_file($photo_file))
> {
>
> clearstatcache ();
> $size = filesize ( $photo_file ) ;
> if ( $size > 1024000 )
> {
> print ("<BR> ERROR - File is too big ! File uploads should be below 1024
k
> ( 1mb ) <BR>"); exit ;
> }
> move_uploaded_file($photo_file, "$upload_path$check_nick->nickname");
> }
> else
> {
> echo "<BR> ERROR : File upload was not successfull , please try again
> !<BR>";
> }
> ?>
>
> ------
>
> the problem is that when i look for the original filename ( e.g.
> myphoto.gif ) , $photo_file contains a random file name like 383hr93php
>
> As i mentioned , its image files i am uploading , how do i know what type
of
> image the file was ? like .jpg , .png etc.
>
> Any help appreciatted , i am really stuck on this ;0)
>
> Thanks
>
> Neil M
>
$photo_file will map to the name of the temporary file on the server's HD --
it is NOT the name of the original file. You'll want to use $photo_file_name
to determine the original filename, or better yet, $photo_file_type to
determine the content type. (a gif is image/gif, for instance).
See http://www.php.net/manual/en/features.file-upload.php
--
Daniel Grace
echo make_witty_sig($foo) . "\n";
--- End Message ---
--- Begin Message ---
Hi..
I've been using PHP for just a little while, however I have noticed somthing.
In the doc's I've noticed you can do this:
printf("line1 \n line2 \n");
Now..this should (like C) print two seperate lines..however It doesn't. To print this
on seperate lines I must put a <BR> in there.
Any ideas?
I'm using PHP 4.06
Ray Gaylog
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
HTML doesn't pay attention to line breaks, thats why you're
needing a <BR>...
Jason
--
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"
> -----Original Message-----
> From: Ray Gaylog [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 17, 2001 3:49 PM
> To: PHP_Mailing_List
> Subject: [PHP] printf()?
>
>
> Hi..
>
> I've been using PHP for just a little while, however I have
> noticed somthing.
>
> In the doc's I've noticed you can do this:
> printf("line1 \n line2 \n");
>
> Now..this should (like C) print two seperate lines..however
> It doesn't. To print this on seperate lines I must put a <BR>
> in there.
>
> Any ideas?
>
> I'm using PHP 4.06
>
> Ray Gaylog
> [EMAIL PROTECTED]
>
>
>
>
>
>
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ray Gaylog [mailto:[EMAIL PROTECTED]]
> I've been using PHP for just a little while, however I have
> noticed somthing.
>
> In the doc's I've noticed you can do this:
> printf("line1 \n line2 \n");
>
> Now..this should (like C) print two seperate lines..however It
> doesn't. To print this on seperate lines I must put a <BR> in there.
>
> Any ideas?
Yes, and not facetiously - read the HTML specs.
If you look at the PHP output, you'll see separate lines. If you read the
HTML spec, you'll find out how HTML is supposed to handle whitespace, and
you'll discover a whole lot more, too.
Mark C.
--- End Message ---
--- Begin Message ---
Phillip B. Bruce wrote:
> 1. Is there any documentation that explains the differences between
> the versions of PHP?
php4 : much more fun ! go use it !
the documentation will tell you on each function page in which php
version the fuction was first available.
> 2. Does it matter when writing php code that you specifiy the file
> name in the following manner? test.php3 test.php4 or whatever.
since you have PHP v3, .php4 and .php will not be parsed at all (you
will see your code plaintext in the browser).
the webserver can be set up to still have .php3 handled by PHP v3 and
.php4 by PHP v4.
in any case, i think you should ask your ISP to upgrade to PHP v4 ...
3.0.9 !!!! when was that ?
> I have the following error:
> Fatal error: Call to unsupported or undefined function include_once() in
> include_fns.php3 on line 7
from http://www.php.net/manual/en/function.include-once.php :
include_once() was added in PHP 4.0.1pl2
phil.
--- End Message ---
--- Begin Message ---
Use the function mysql_data_seek(result variable, row number)
so in your case it would be: mysql_data_seek($result2, 0);
You should also consider suppressing the warning for an empty set by placing
a '@' in front of the function
----- Original Message -----
From: "Ivan Carey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 15, 2001 7:32 AM
Subject: [PHP] how to reinitialise an MySQL_fetch_array
Hello,
I would like to reinitialise an MySQL_fetch_array. That is, once it has gone
through I would like to be able to go back to the start again.
for eg
while ($myrow=MySQL_fetch_array($result2))
{
$befid=$myrow["beforeid"];
while($myrow5=MySQL_fetch_array($result5))
{
$aftid=$myrow["afteridid"];
if ( $befid == aftid)
{
do something;
}
} //while($myrow5=MySQL_fetch_array($result5))
//now that the inner loop has finished I would like to be able to
restart the inner loop by reinitailsing the MySQL_fetch_array
} //while ($myrow=MySQL_fetch_array($result2))
Regards,
Ivan
--- End Message ---
--- Begin Message ---
Hello,
Tom Rogers wrote:
>
> Hi again
> Got a bit sidetracked ... here is your original code :)
Thanks, I managed to make it work for me similarly to that.
Now, a different problem, I already have array variable with a object.
Is there a way to make a function return a reference to that object in a
variable passed by reference to a function?
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
Hi
What is the scope of the array that holds the object ?
Maybe a bit of code to show what you are after :)
Tom
At 03:37 PM 17/12/01, Manuel Lemos wrote:
>Hello,
>
>Tom Rogers wrote:
> >
> > Hi again
> > Got a bit sidetracked ... here is your original code :)
>
>Thanks, I managed to make it work for me similarly to that.
>
>Now, a different problem, I already have array variable with a object.
>Is there a way to make a function return a reference to that object in a
>variable passed by reference to a function?
>
>Regards,
>Manuel Lemos
>
>--
>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]
--- End Message ---
--- Begin Message ---
Hello,
Tom Rogers wrote:
>
> Hi
> What is the scope of the array that holds the object ?
global
> Maybe a bit of code to show what you are after :)
It is to implement another function that will return a reference (not a
copy) of a object stored in a global array passing the index of the
array. It would be like this, except that this code does not work as I
need:
$objects=array();
Function CreateObject(&$index)
{
global $objects;
$index=count($objects);
$objects[$index]=new my_class;
}
Function GetObject($index,&$object)
{
global $objects;
$object= &$objects[$index];
}
CreateObject($index);
GetObject($index,$my_object);
Regards,
Manuel Lemos
> Tom
>
> At 03:37 PM 17/12/01, Manuel Lemos wrote:
> >Hello,
> >
> >Tom Rogers wrote:
> > >
> > > Hi again
> > > Got a bit sidetracked ... here is your original code :)
> >
> >Thanks, I managed to make it work for me similarly to that.
> >
> >Now, a different problem, I already have array variable with a object.
> >Is there a way to make a function return a reference to that object in a
> >variable passed by reference to a function?
--- End Message ---
--- Begin Message ---
Hello,
I'm working on a website for what will eventually be free
PHP/MySQL/Apache/DNS/etc hosting (see: http://hosting.venura.net , no
requests for accounts will be entertained right now), and am having problems
trying to get HTTP Authentication working. I had it working a month or so
ago, but then I put the project on hold for awhile and came back to a mess
that wasn't -- don't know how unless I somehow broke it just before I quit
working on it.
Anyways, I'm running PHP 4.1.0 (had same problems with 4.0.6 earlier so I
know it's not some weird bug with the new version), Apache 1.3.22+mod_ssl
and Linux 2.4. I'm working (for now) with a small test script containing
this (and running on SSL, which I had no problems with earlier.)
---
<?php
header("HTTP/1.0 401 Unauthorized");
header("WWW-Authenticate: Basic realm=\"hosting.venura.net Member Services
U:"
. $PHP_AUTH_USER
. ", P:"
. $PHP_AUTH_PW
. "\""
);
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>[secure]venura.net :: Unauthorized</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>
---
The idea being that I can see the username/password entered in the
authentication box itself.
Anyways, though the 401 part works and actually brings up the typical "Enter
Username/Password" box, $PHP_AUTH_USER and $PHP_AUTH_PW are not being set.
Neither is $REMOTE_USER.
There are no .htaccess files in the directory (or any parent dirs for that
matter), and no AuthType directives all in my httpd.conf file. I have been
unsuccessful in determining what is wrong, and am flat out of ideas.
My php.ini and httpd.conf files are available at
http://hosting.venura.net/fixme/
Any ideas?
-- Daniel Grace
--- End Message ---
--- Begin Message ---
Hello,
I'm working on a website for what will eventually be free
PHP/MySQL/Apache/DNS/etc hosting (see: http://hosting.venura.net , no
requests for accounts will be entertained right now), and am having problems
trying to get HTTP Authentication working. I had it working a month or so
ago, but then I put the project on hold for awhile and came back to a mess
that wasn't -- don't know how unless I somehow broke it just before I quit
working on it.
Anyways, I'm running PHP 4.1.0 (had same problems with 4.0.6 earlier so I
know it's not some weird bug with the new version), Apache 1.3.22+mod_ssl
and Linux 2.4. I'm working (for now) with a small test script containing
this (and running on SSL, which I had no problems with earlier.)
---
<?php
header("HTTP/1.0 401 Unauthorized");
header("WWW-Authenticate: Basic realm=\"hosting.venura.net Member Services
U:"
. $PHP_AUTH_USER
. ", P:"
. $PHP_AUTH_PW
. "\""
);
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>[secure]venura.net :: Unauthorized</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>
---
The idea being that I can see the username/password entered in the
authentication box itself.
Anyways, though the 401 part works and actually brings up the typical "Enter
Username/Password" box, $PHP_AUTH_USER and $PHP_AUTH_PW are not being set.
There are no .htaccess files in the directory (or any parent dirs for that
matter), and no AuthType directives all in my httpd.conf file. I have been
unsuccessful in determining what is wrong, and am flat out of ideas.
My php.ini and httpd.conf files are available at
http://hosting.venura.net/fixme/
Any ideas?
-- Daniel Grace
--- End Message ---
--- Begin Message ---
"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi everyone,
>
> I'm having troubles getting Apache to recognize .php files, and thus parse
> them. I followed the instructions included with the PHP4.1.0 distribution,
> and have PHP loaded as an Apache module, checking my services confirms
this
> as its description reads "Apache/1.3.22 (Win32) PHP/4.1.0". But when I
> attempt to load a .php file, I will get the entire file, unparsed. I added
> the following two lines to my httpd.conf file:
>
> LoadModule php4_module C:\Apache.MySQL.PHP\PHP\sapi\php4apache.dll
> AddType application/x-httpd-php .php
>
> Am I missing something? Thanks,
>
> Christian
>
>
I don't see anything missing, taking a look at my own (working as far as
that goes) config at http://hosting.venura.net/fixme/httpd_conf.txt
Are you sure that you have short_open_tags or the asp style tags enabled in
your php.ini file [if you're using them.] If you don't have them enabled but
are using them in your pages, it'll seem to not work.
The easiest way to check to see if that's the problem, short of checking
php.ini, is to make a quick and dirty test page:
<?php
phpinfo();
?>
<?
/* >If you can see this, then short_open_tags = off. Of course, if phpinfo()
is displayed above, this should be fairly obvious <*/
?>
<%
/* >If you can see this, then asp_style_tags = off. Of course, if phpinfo()
is displayed above, this should be fairly obvious <*/
%>
--
Daniel Grace
"No ASP, ever."
- from the venura.net announcement of hosting.venura.net's hosting services.
--- End Message ---
--- Begin Message ---
Hi!
I'm having some goofy interactions between $this pointers in
classes and variables.
Case in Point:
if I have the following code:
<?php
class Y
{
var $children;
function addValue($in_value)
{
$this->children[] = $in_value;
}
function Y()
{
}
function Zabba()
{
$this->addValue("asdfasdfasdf");
}
}
$abc = new Y();
$abc->Zabba();
var_dump($abc->children);
?>
I will correctly get on output, an array with one item in it.
However, if I Change the Zabba function to:
function Zabba()
{
$localVariable = $this;
$localVariable->addValue("asdfasdfasdf");
}
Then I will get on output, a NULL array.
Why is this? Is there any particular reason this happens?
thanks,
mark.
--- End Message ---
--- Begin Message ---
Hello Mark,
Monday, December 17, 2001, 11:05:15 AM, you wrote:
M> However, if I Change the Zabba function to:
M> function Zabba()
M> {
M> $localVariable = $this;
M> $localVariable->addValue("asdfasdfasdf");
M> }
M> Then I will get on output, a NULL array.
M> Why is this? Is there any particular reason this happens?
Yes, there is. When you do $localVariable = $this, a new object in
$localVariable is born. This object definitely dies at the function
end, so you get nothing in return. To make the things work properly,
you'd need a reference to the $this object, hence the expression
should be $localVariable =& $this.
But don't forget, that the things will change with the new Zend engine
coming and PHP 5 (I suppose).
--
Best regards,
Maxim Derkachev mailto:[EMAIL PROTECTED]
System administrator & programmer,
Symbol-Plus Publishing Ltd.
phone: +7 (812) 324-53-53
www.books.ru, www.symbol.ru
--- End Message ---
--- Begin Message ---
does anyone know of how or where I can find info on, accessing a IBM
mainframe which uses the TN3270 protocol via a socket?
TN3270 isnt ordinary telnet so I assume the existing telnet socket info
isnt helpful
ta
brendan
--- End Message ---
--- Begin Message ---
Is it possible to have PHP act like a web browser, accept cookies and post
data (for login)? I'm not sure exactly where to start- I know you can use
fopen/file to retrieve url's but I'm not too sure about the other steps. I
would like to write and run such a php script as a cron job and have it do
something like log into my web-based email account, retrieve emails, process
them, save them locally, and then delete them on the server. Thanks for any
help.
David
--- End Message ---
--- Begin Message ---
you may want to look at the curl functions as a start.
thats most of the functionality down already. otherwise you'll have to
parse raw data. not too hard, but can be painful to keep stateful info.
you'll also have to rewrite code when the interface changes, you'll probably
want to look at hotscripts or manuel lemos's script archives for prewritten
html parsers.
fopen/fread/fwrite is the way to go, but you'll need to interpret that data
accordingly. Look at the rfc's on cookies and html if you are interested in
going that route.
been there done that myself (for a sms autosend script using mtnsms, but its
a pia to start from scratch...)
Lawrence
-----Original Message-----
From: David Yee [mailto:[EMAIL PROTECTED]]
Sent: December 17, 2001 3:49 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP as a web browser?
Is it possible to have PHP act like a web browser, accept cookies and post
data (for login)? I'm not sure exactly where to start- I know you can use
fopen/file to retrieve url's but I'm not too sure about the other steps. I
would like to write and run such a php script as a cron job and have it do
something like log into my web-based email account, retrieve emails, process
them, save them locally, and then delete them on the server. Thanks for any
help.
David
--
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]
--- End Message ---
--- Begin Message ---
if you want a php-only solution, you should probably also consider
fsockopen.
http://www.php.net/manual/en/function.fsockopen.php
best regards
Stefan Rusterholz
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, December 17, 2001 9:26 AM
Subject: RE: [PHP] PHP as a web browser?
> you may want to look at the curl functions as a start.
>
> thats most of the functionality down already. otherwise you'll have to
> parse raw data. not too hard, but can be painful to keep stateful info.
>
> you'll also have to rewrite code when the interface changes, you'll
probably
> want to look at hotscripts or manuel lemos's script archives for
prewritten
> html parsers.
>
> fopen/fread/fwrite is the way to go, but you'll need to interpret that
data
> accordingly. Look at the rfc's on cookies and html if you are interested
in
> going that route.
>
> been there done that myself (for a sms autosend script using mtnsms, but
its
> a pia to start from scratch...)
>
>
> Lawrence
>
> -----Original Message-----
> From: David Yee [mailto:[EMAIL PROTECTED]]
> Sent: December 17, 2001 3:49 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP as a web browser?
>
>
> Is it possible to have PHP act like a web browser, accept cookies and post
> data (for login)? I'm not sure exactly where to start- I know you can use
> fopen/file to retrieve url's but I'm not too sure about the other steps.
I
> would like to write and run such a php script as a cron job and have it do
> something like log into my web-based email account, retrieve emails,
process
> them, save them locally, and then delete them on the server. Thanks for
any
> help.
>
> David
>
>
> --
> 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]
>
>
>
--- End Message ---
--- Begin Message ---
I have need to get php to use postgres to store session information.
I've changed the directive in php.ini and written a set of functions
that should do the job and I've made the call to set the session
handler. The following simple test case works:
<?
require_once ('database.php');
require_once ('sess_handler.php');
//session_start ();
session_register ('asdf');
$asdf = 123;
print $asdf;
?>
the idea being that the line where $asdf is assigned is commented out in
the second execution of it and the value is still there upon reloading.
That works fine. But, when I try to use it with the code for which it
was originally intended I get this error:
*Fatal error*: Failed to initialize session module in
*/usr/local/apache/vhosts/600xl/httpdocs/fe_login.php* on line *44*
Keep in mind that this is all code which worked perfectly with the bulit
in session handler before. Any ideas?
Thanks,
James.
--- End Message ---
--- Begin Message ---
Lo all,
I am trying to write a script that will output to a frame the current
location within a site..
like Home :: Contact
I need PHP to be able to check the url of the frame "main" and then parse
out anything after the domain to decide what to output as the location.
e.g. http://domain.com/contact/index.html
(http://domain.com) <<-- forgotten
(contact/index.html)
If URL = contact/index.html {
echo('Home :: Contact'); }
If URL = business/index.html {
echo('Home :: Business'); }
Am I on the correct track with most of it?? I just cant work out how to grab
the URL of a single frame.
Thanx
Andrew
--- End Message ---