php-general Digest 5 Nov 2002 12:35:31 -0000 Issue 1686

Topics (messages 122719 through 122766):

Re: Authentication with PHP and HTTP
        122719 by: silver
        122722 by: Chris Shiflett
        122754 by: silver
        122762 by: ed.home.homes2see.com

Re: [PHP-DEV] When my PHP file opens, I want it to automatically submit
        122720 by: Chris Shiflett
        122749 by: Marek Kilimajer
        122755 by: Petre Agenbag

Radiator && PHP
        122721 by: Chris Kay

Upload permission on a web_user space...
        122723 by: Benjamin Tr閜anier
        122728 by: rija

Re: Battling with highlighting search criteria
        122724 by: Michael Sims

Re: 4.2.3 compile problem on OSX
        122725 by: Adam Atlas

about @ in php
        122726 by: Alex
        122727 by: John Nichel

Re: Cookies disabled, new session ID each click!
        122729 by: Jason Wong

checkboxes and selection lists
        122730 by: marco_bleeker.hetnet.nl
        122731 by: John Nichel
        122732 by: rija
        122734 by: Brendon G

php help for project!!
        122733 by: Karl James
        122739 by: Khalid El-Kary

Re: php / ldap
        122735 by: Stig Venaas

Re: HELP COOKIES !
        122736 by: Shaun
        122738 by: Shaun
        122740 by: Erwin
        122745 by: Shaun

PHP driven frame
        122737 by: Chris Rehm
        122748 by: Marek Kilimajer
        122765 by: Justin French
        122766 by: John W. Holmes

Re: Php "Ready-to-go"
        122741 by: Alexander Kuznetsov

Interfacing with Perl Modules
        122742 by: Derek Belrose

php/extensions directory
        122743 by: Pierre Vaudrey

general cookies
        122744 by: Shaun
        122750 by: Marek Kilimajer
        122756 by: Shaun
        122760 by: Marek Kilimajer

Re: Strange error!
        122746 by: Marek Kilimajer

Re: Calendar script - help
        122747 by: Kerry Kobashi

how to get all "HTTP CONTENT"?
        122751 by: nice_boy

Variable Value 2 Session Name
        122752 by: Stephen of Blank Canvas Group
        122757 by: silver

Spawning a background process
        122753 by: kevin
        122758 by: Erwin

Format Currency
        122759 by: dark rotter
        122761 by: Petr Tomenend醠
        122763 by: Rudolf Visagie

MYSQL and PHP Storing and retrieving images getting corrupted
        122764 by: Darren McPhee

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 - I'm not quite sure if this will help you, but lets give it a try:

you could use this URL syntax:
 http://user:password@;www.site.com to automatically log your user in to the
htaccess protected area. the bad thing about it is that user / password show
up in the URL, but you could hide this information with using frames...
are PHP/MySQL usernames + passwords the same like in Apache/HTTP?

greets,
_andi






"Phillip Erskine" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:F13i7M4BAyxJMXehYSo00004e46@;hotmail.com...
>
> I have a site that uses PHP/MySQL authentication for one section and
> Apache/HTTP authentication for another.  Eventually I would like to use
only
> PHP and MySQL for authenticating users, but in the meantime, I have to use
> both.
>
> First, users will log in to the main section of the site and I will use
PHP
> session variables to maintain state for that section.  What I would like
to
> be able to do is allow users to click a link that would redirect them to
the
> other section of the site and automatically log them in.
>
> The section of the site that users will be redirected to uses .htaccess
and
> .htpassword files to enforce HTTP authentication.
>
> Is this possible?  If so, how?
>
>
> =========================
> http://www.pverskine.com/
>
>
>
>
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>


--- End Message ---
--- Begin Message ---
You can "hide" URLs by fetching them with one of your own PHP scripts:

<base href="www.site.com">
<?
readfile("http://user:password@;www.site.com/");
?>

I think it might be at least better than frames. :-)

Chris

silver wrote:

you could use this URL syntax:
http://user:password@;www.site.com to automatically log your user in to the
htaccess protected area. the bad thing about it is that user / password show
up in the URL, but you could hide this information with using frames...
are PHP/MySQL usernames + passwords the same like in Apache/HTTP?


--- End Message ---
--- Begin Message ---
very true :)
thx - I will keep that in mind...


"Chris Shiflett" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:3DC71CBE.2050703@;php.net...
> You can "hide" URLs by fetching them with one of your own PHP scripts:
>
> <base href="www.site.com">
> <?
> readfile("http://user:password@;www.site.com/");
> ?>
>
> I think it might be at least better than frames. :-)
>
> Chris
>
> silver wrote:
>
> >you could use this URL syntax:
> >http://user:password@;www.site.com to automatically log your user in to
the
> >htaccess protected area. the bad thing about it is that user / password
show
> >up in the URL, but you could hide this information with using frames...
> >are PHP/MySQL usernames + passwords the same like in Apache/HTTP?
> >
>


--- End Message ---
--- Begin Message ---
 I've tried both methods without success.

header("Location: http://(user):(pass)@www.mysite.com"); does the transfer
but I still get prompted for a username and password by Apache

readfile("http://(user):(pass)@www.mysite.com"); brings a warning message.
Warning: readfile("http://...@;www.mysite.com/") - Success in
redirect.php on line 2

It's a warning but says Success?

Ed


On Mon, 4 Nov 2002, Chris Shiflett wrote:

> You can "hide" URLs by fetching them with one of your own PHP scripts:
> 
> <base href="www.site.com">
> <?
> readfile("http://user:password@;www.site.com/");
> ?>
> 
> I think it might be at least better than frames. :-)
> 
> Chris
> 
> silver wrote:
> 
> >you could use this URL syntax:
> >http://user:password@;www.site.com to automatically log your user in to the
> >htaccess protected area. the bad thing about it is that user / password show
> >up in the URL, but you could hide this information with using frames...
> >are PHP/MySQL usernames + passwords the same like in Apache/HTTP?
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message --- This type of question should be addressed to [EMAIL PROTECTED] I am forwarding it there.

Also, please correct your reply-to address.

Chris

Luke wrote:

Hello,

On my website, I have a php form which submits the global Ip address of the
computer its on to a specific email address, I want it to automatically
"click" the submit button on the website without questions, it already has
an email address specified in it, but you have to open the document and
click "submit"..

any ideas?

Thanks,

Luke


--- End Message ---
--- Begin Message --- <body onload="yourForm.submit()">
<form name="yourForm" action="mailto:address@;server.net">
<input type="hidden" name="ip" value="<?= $_SERVER['REMOTE_ADDR'] ?>">
</form>
</body>

is this what you want? This is too complicated, why not sending it from the server?

Chris Shiflett wrote:

This type of question should be addressed to [EMAIL PROTECTED] I am forwarding it there.

Also, please correct your reply-to address.

Chris

Luke wrote:

Hello,

On my website, I have a php form which submits the global Ip address of the
computer its on to a specific email address, I want it to automatically
"click" the submit button on the website without questions, it already has
an email address specified in it, but you have to open the document and
click "submit"..

any ideas?

Thanks,

Luke



--- End Message ---
--- Begin Message ---
Are you just interested in getting the IP address of the visitor?
IF so, this info is already added to the website's apache log, so you
actually only need to go look through the log, or, if you want to make
it a bit more "surgical", you can write the 'REMOTE_ADDR' variable
straight into a mysql table, without the added trouble of mailing ,
specially with using mailto: ; this actually opens up a "new message"
window on the client's side's e-mail program, and the user has to click
on "send", if he doesn't, you won't get the mail.... So, if it's crucial
stuff, don't rely on the client ( that's actually the golden rule for
all apps...)

On Tue, 2002-11-05 at 13:05, Marek Kilimajer wrote:
> <body onload="yourForm.submit()">
> <form name="yourForm" action="mailto:address@;server.net">
> <input type="hidden" name="ip" value="<?= $_SERVER['REMOTE_ADDR'] ?>">
> </form>
> </body>
> 
> is this what you want? This is too complicated, why not sending it from 
> the server?
> 
> Chris Shiflett wrote:
> 
> > This type of question should be addressed to 
> > [EMAIL PROTECTED] I am forwarding it there.
> >
> > Also, please correct your reply-to address.
> >
> > Chris
> >
> > Luke wrote:
> >
> >> Hello,
> >>
> >> On my website, I have a php form which submits the global Ip address 
> >> of the
> >> computer its on to a specific email address, I want it to automatically
> >> "click" the submit button on the website without questions, it 
> >> already has
> >> an email address specified in it, but you have to open the document and
> >> click "submit"..
> >>
> >> any ideas?
> >>
> >> Thanks,
> >>
> >> Luke
> >>
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Anyone ever used PHP instead of Hooks in radiator, or even if it could
be done...

I have no idea just thought I would give it ago

Before u tell me to goto ask on the radiator list I have I just thought
I would get some comments from the PHP community.

---------------------------------------------------------
Chris Kay (Systems Development)
Techex Communications
Website: www.techex.com.au Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: (02) 9970 5788
--------------------------------------------------------- 

--- End Message ---
--- Begin Message ---
Hello, I'm trying again to ask you that question because I was not
understand.

I have a unix server hosting service, my hosting service allow me to create
web_server. Those are create for my client who have to upload differents
things. So when people are connecting to my ftp (example  on IE...) they can
see any folder in their web_user space and can upload stuff in any folder of
their level... So the set upload permission is not working... What can I do

Is it possible to create a upload page (php) that allow user to see every
folder of his web_user space??

Thanks!


Ben

--- End Message ---
--- Begin Message ---
Hi Ben,
I am not sure to understand exactly what do you want to do.
But I am going to try to answer you about something,
First, If you need to create your own ftp software using php, check out ftp library 
(http://www.faqs.org/rfcs/rfc959.html)
there are several  function about it, and you can allow visitors to
upload, download, rename, delete, move files, create directory, rename directory chop 
directory etc... through 2 differents webservers using ftp parameters
like domain (ip), username, password, int port etc...

You can also create your own php software to allow user to view, upload,
modify and delete files in your webserver from their browser, and you don't
need activating ftp library, but you should set up (php.ini):
file_uploads to on
upload_tmp_dir to your upload directory
upload_max_size = 2M or I don't know. --> check out the documentary
(Documentary is also available in french.)

If you want allow people to see some file from their browser and download
it right_clicking and "save target as" to their computer, there are several
possibility, first you can set it up through your webhosting setting (for
example for IIS/Windows 2000) you can check on button browse directory- So when 
visitors write your directory URL, the browser shows every files in your webserver.

Secondly, you can also use your own php file to do it using function such as
dir(), opendir(), readdir()--> check out the documentary.
and it is better to use HEADER() to download files into visitors browser.

Well, I hope helping you as I can.

----- Original Message -----
From: "Benjamin Tr閜anier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 12:55 PM
Subject: [PHP] Upload permission on a web_user space...


> Hello, I'm trying again to ask you that question because I was not
> understand.
>
> I have a unix server hosting service, my hosting service allow me to
create
> web_server. Those are create for my client who have to upload differents
> things. So when people are connecting to my ftp (example  on IE...) they
can
> see any folder in their web_user space and can upload stuff in any folder
of
> their level... So the set upload permission is not working... What can I
do
>
> Is it possible to create a upload page (php) that allow user to see every
> folder of his web_user space??
>
> Thanks!
>
>
> Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On Mon, 4 Nov 2002 11:59:20 +0200, you wrote:

>Ok, this works.
>
>Just one more thing,
>
>How can I get the return in the same case as it was originally?

Use backreferences to capture what matched and use that in the replace
string.  Example:

<?
$search = "is";

$str = "This is a test, isn't it?";
$str = preg_replace("/($search)/i", "<font color=\"red\">$1</font>",
$str);

echo $str;
echo "<br>";

$str = "Is this also a test?  Yes, it is!";
$str = preg_replace("/($search)/i", "<font color=\"red\">$1</font>",
$str);

echo $str;
echo "<br>";
?>
--- End Message ---
--- Begin Message --- PHPmac (http://www.phpmac.com/) has some excellent articles on the subject. If all else fails, you can also grab a pre-compiled binary at http://www.entropy.ch/software/macosx/php/.

On Mon Nov 4, 2002 5:12:38 PM, Kristopher Yates wrote:

Hello,

I'm trying to compile PHP4.2.3 for Mac OSX 10.2 (Jaguar). Has anyone else had this problem (see below)?


./configure --with-apxs=/usr/sbin/apxs
make

ld: multiple definitions of symbol _virtual_stat
TSRM/.libs/libtsrm.al(tsrm_virtual_cwd.lo) definition of _virtual_stat in sectio
n (__TEXT,__text)
TSRM/.libs/libtsrm.al(tsrm_virtual_cwd.lo) definition of _virtual_stat in sectio
n (__TEXT,__text)
ld: multiple definitions of symbol _virtual_unlink
TSRM/.libs/libtsrm.al(tsrm_virtual_cwd.lo) definition of _virtual_unlink in sect
ion (__TEXT,__text)
TSRM/.libs/libtsrm.al(tsrm_virtual_cwd.lo) definition of _virtual_unlink in sect
ion (__TEXT,__text)
ld: multiple definitions of symbol _virtual_utime
TSRM/.libs/libtsrm.al(tsrm_virtual_cwd.lo) definition of _virtual_utime in secti
on (__TEXT,__text)
TSRM/.libs/libtsrm.al(tsrm_virtual_cwd.lo) definition of _virtual_utime in secti
on (__TEXT,__text)
/usr/bin/libtool: internal link edit command failed
make[1]: *** [libphp4.la] Error 1
make: *** [all-recursive] Error 1

Forgive my ignorance but HUH? WTF?

I have done this countless times on i386 boxes under RedHat and FreeBSD.
Unfortunately, I have never encountered this problem before.

Just FYI, before attempting to compile/install PHP, I successfully compiled/installed Apache 1.3.27,
which seems to work as expected. I also upgraded to the latest Apple Developers Kit, and related update
patches.

Any ideas?

Thanks,

Kris
--
Adam Atlas

"640K of computer memory ought to be enough for anybody." - Bill Gates, 1981

(2001: What? Did I say 640K? I meant 640MB.)

--- End Message ---
--- Begin Message ---
this day ,I read somebody else's program in php,found that in that one's
page ,with such as "if (!($recordnum=@pg_numrows($rs))){
      echo '命令处理完毕!';  "  using,I don't know how the @ refer
to.somebody help me?thanks.


--- End Message ---
--- Begin Message ---
The @ symbol supresses error messages.

Alex wrote:
this day ,I read somebody else's program in php,found that in that one's
page ,with such as "if (!($recordnum=@pg_numrows($rs))){
      echo '命令处理完毕!';  "  using,I don't know how the @ refer
to.somebody help me?thanks.




--- End Message ---
--- Begin Message ---
On Tuesday 05 November 2002 05:15, Steve Fatula wrote:
> What you describe is what SHOULD happen and does on that web site, that
> does NOT happen on my web site, with the exact same code I posted in the
> original message.

Presumably the test website and your website are on different servers -- try 
comparing php.ini.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
That's life.
        What's life?
A magazine.
        How much does it cost?
Two-fifty.
        I only have a dollar.
That's life.
*/

--- End Message ---
--- Begin Message ---
Hi, as a beginner I find the way you declare variables through HTML-forms quite 
straightforward. But the reverse, to put the same variables back into a form field is 
not so obvious for selection lists and checkboxes. Would for instance this be the best 
way:

        <SELECT CLASS="select" NAME="qual">
                <OPTION VALUE="A" <?=if($qual=='A'){return 'SELECTED'}?>>A</OPTION>
                <OPTION VALUE="B" <?=if($qual=='B'){return 'SELECTED'}?>>B</OPTION>
                <OPTION VALUE="C" <?=if($qual=='C'){return 'SELECTED'}?>>C</OPTION>
        </SELECT>

or would there be something more elegant?

Thanks, Marco


--------------------------------------------------------------------------------
Internet wordt pas leuk als je mee kunt doen. Ga naar http://www.hetnet.nl
--- End Message ---
--- Begin Message --- For something like this, instead of doing all the HTML, I would set up and array, and then loop through the array to output the HTML...

<SELECT CLASS="select" NAME="qual">
<?php

for ( $i = 0; $qual_array[$i]; $i++ ) {
if ( $_POST['qual'] == $qual_array[$i] ) {
echo ( "<OPTION VALUE=\"" . $qual_array[$i] . "\" SELECTED>" . $qual_array[$i] . "</OPTION>\n" );
} else {
echo ( "<OPTION VALUE=\"" . $qual_array[$i] . "\">" . $qual_array[$i] . "</OPTION>\n" );
}
}

?>
</SELECT>

[EMAIL PROTECTED] wrote:
Hi, as a beginner I find the way you declare variables through HTML-forms quite straightforward. But the reverse, to put the same variables back into a form field is not so obvious for selection lists and checkboxes. Would for instance this be the best way:

	<SELECT CLASS="select" NAME="qual">
		<OPTION VALUE="A" <?=if($qual=='A'){return 'SELECTED'}?>>A</OPTION>
		<OPTION VALUE="B" <?=if($qual=='B'){return 'SELECTED'}?>>B</OPTION>
		<OPTION VALUE="C" <?=if($qual=='C'){return 'SELECTED'}?>>C</OPTION>
	</SELECT>

or would there be something more elegant?

Thanks, Marco


--------------------------------------------------------------------------------
Internet wordt pas leuk als je mee kunt doen. Ga naar http://www.hetnet.nl


--- End Message ---
--- Begin Message ---
If you have hundred thousand elements for example if you rob up for some
country select within tierce code-

I thinks doing like the following is better

echo "<select>
    <option>a
    <option>b
    ...
    <option>zz
    <option selected>$value
</option>
</select>" ;

And I don't care if it could have 2 same value in the select case...

And if there aren't many value, I think the following  sounds better:

echo "
<SELECT CLASS=select NAME=qual>
<OPTION ".($qual==A?" SELECTED":"").">A
<OPTION ".($qual==B?" SELECTED":"").">B
<OPTION ".($qual==C?" SELECTED":"")." >C</OPTION>
</SELECT>" ;



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 5:06 PM
Subject: [PHP] checkboxes and selection lists


Hi, as a beginner I find the way you declare variables through HTML-forms
quite straightforward. But the reverse, to put the same variables back into
a form field is not so obvious for selection lists and checkboxes. Would for
instance this be the best way:

<SELECT CLASS="select" NAME="qual">
<OPTION VALUE="A" <?=if($qual=='A'){return 'SELECTED'}?>>A</OPTION>
<OPTION VALUE="B" <?=if($qual=='B'){return 'SELECTED'}?>>B</OPTION>
<OPTION VALUE="C" <?=if($qual=='C'){return 'SELECTED'}?>>C</OPTION>
</SELECT>

or would there be something more elegant?

Thanks, Marco


----------------------------------------------------------------------------
----
Internet wordt pas leuk als je mee kunt doen. Ga naar http://www.hetnet.nl

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


--- End Message ---
--- Begin Message ---
I use the following function for my check boxes in forms in PHP.

Putting your form element creation into functions or even classes makes life
so much easier when you have to validate / change code.

you'll be glad you did it

Cheers

Brendon



function fncwriteformcheckbox($strname, $strid, $strvalue, $varcheckedvalue)
{
/*
 fncWriteFormCheckbox
 Returns HTML for a <checkbox> element
 Accepts form element name as string
 Accepts form element ID as string
 Accepts form element value as string
 Accepts form element checked value as string or array.
 If checked value = default value then "checked" is written
 to the HTML stream

 Adapted from ASP functions by Ken Schaefer.
*/
define("PROC", "fncwriteformcheckbox");
$strtemp = "<input type=\"checkbox\" name=\"" . $strname . "\" ID=\"" .
$strid . "\" value=\"" . $strvalue . "\"";

if (is_Array($varcheckedvalue)) {
        foreach ($varcheckedvalue as $varcheckedvalueelement) {
           if ($varcheckedvalueelement == $strvalue) {
                        $strtemp .= " checked";
                        break;
           }
        }
} else {
        if ($varcheckedvalue == $strvalue) {
                $strtemp .= " checked";
        }
}
$strtemp .= ">\n";
return $strtemp;
}



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 5:06 PM
Subject: [PHP] checkboxes and selection lists


Hi, as a beginner I find the way you declare variables through HTML-forms
quite straightforward. But the reverse, to put the same variables back into
a form field is not so obvious for selection lists and checkboxes.

--- End Message ---
--- Begin Message ---
Hello 
 
I need help with 
A project that I'm doing for a fantasy football league..
Where I'm doing auto add/delete of players of a roster 
With maintaing a salary cap of $40.000.00
 
I have done the mysql database.. I just need help with
Code and forms
I want to use check boxes to do the add and delete 
And show reports as well of players stats and other things.
 
karl
--- End Message ---
--- Begin Message --- hi,

check the PHP Manual about MySQL functions:

http://www.php.net/manual/en/ref.mysql.php

you can also check for HTML forms (including checkboxes) here:

http://www.w3schools.com/html/html_forms.asp

and tables (for the reports):

http://www.w3schools.com/html/html_tables.asp

if you face a particular problem, send here again

khalid



_________________________________________________________________
Unlimited Internet access for only $21.95/month. Try MSN! http://resourcecenter.msn.com/access/plans/2monthsfree.asp

--- End Message ---
--- Begin Message ---
On Wed, Oct 30, 2002 at 09:28:00AM -0500, GC wrote:
> Hi, using php_ldapadd, I get this error in ldap.log:
> 
> Oct 30 09:23:43 Lunar slapd[10714]: conn=202 op=1 RESULT tag=105 err=65
> text=object class 'posixAccount' requires attribute 'uidNumber'
> 
> How do I get the next available uid number from my ldap database and then
> use that number for uidnumber?

This is a classic LDAP problem. If you have server side sorting you can
ask for uidNumber in sorted order, and set sizelimit to 1. Not all
servers support it though, and it's not easy to specify this in PHP.
Another possibility might be to remember last max, and only search for
larger values (of course you could search for all). Finally if you can
control how data is updated, you could have a special attribute in a
special object containing the highest uid, and update that whenever
you add a higher one.

Stig
--- End Message ---
--- Begin Message ---
"Erwin" <[EMAIL PROTECTED]> wrote in message
news:20021104153413.19848.qmail@;pb1.pair.com...
> Shaun wrote:
> > Hi,
> >
> > I tried some advice you gave , i tried to destroy the session cookie
> > wiht setcookie(session_name()); and setcookie(session_name(),-3600);
> > but the cookie is still there . Instead , there are now 2 cookies
> > with the same name , the one has the session id , the other has no
> > contents! HOW CAN I DELETE THESE THINGS !!!
>
> Heh...LOL
> My mistake...at first you destroy the session, then you are using
> session_name(). The session_name() function will then (of course) return
an
> empty string. Try setting the cookie (with -3600) before
session_destroy().
>
> First question: why are you using a cookie??? If you use session_start(),
a
> cookie is automaticaly send to the client.
>
> Grtz Erwin
>

Hi Grtz Erwin,

let me tell you wat i need to do.

1.) I have a login page - if the user logs in correctly i create
session(with session_start()) , a cookie is written to client + session file
to server.
2.)When the user logs off - i call the logOff.php page . The contents are as
follows :

    <?php
    session_start();
    setcookie(session_name(),-3600);
    session_unset();
    session_destroy();
    ect.
    ?>

Now , when the user logs in again , i want a NEW COOKIE to be sent with a
new id , to the client! This does not happen as the first cookie was never
deleted.
So when the user logs in again the same cookie is used ! why ?

Thanks alot
    Shaun



--- End Message ---
--- Begin Message ---
"Erwin" <[EMAIL PROTECTED]> wrote in message
news:20021104153413.19848.qmail@;pb1.pair.com...
> Shaun wrote:
> > Hi,
> >
> > I tried some advice you gave , i tried to destroy the session cookie
> > wiht setcookie(session_name()); and setcookie(session_name(),-3600);
> > but the cookie is still there . Instead , there are now 2 cookies
> > with the same name , the one has the session id , the other has no
> > contents! HOW CAN I DELETE THESE THINGS !!!
>
> Heh...LOL
> My mistake...at first you destroy the session, then you are using
> session_name(). The session_name() function will then (of course) return
an
> empty string. Try setting the cookie (with -3600) before
session_destroy().
>
> First question: why are you using a cookie??? If you use session_start(),
a
> cookie is automaticaly send to the client.
>
> Grtz Erwin
>

Hi Grtz Erwin,

let me tell you wat i need to do.

1.) I have a login page - if the user logs in correctly i create
session(with session_start()) , a cookie is written to client + session file
to server.
2.)When the user logs off - i call the logOff.php page . The contents are as
follows :

    <?php
    session_start();
    setcookie(session_name(),-3600);
    session_unset();
    session_destroy();
    ect.
    ?>

Now , when the user logs in again , i want a NEW COOKIE to be sent with a
new id , to the client! This does not happen as the first cookie was never
deleted.
So when the user logs in again the same cookie is used ! why ?

Thanks alot
    Shaun



--- End Message ---
--- Begin Message ---
> Hi Grtz Erwin,
> 
> let me tell you wat i need to do.
> 
> 1.) I have a login page - if the user logs in correctly i create
> session(with session_start()) , a cookie is written to client +
> session file to server.
> 2.)When the user logs off - i call the logOff.php page . The contents
> are as follows :
> 
>     <?php
>     session_start();
>     setcookie(session_name(),-3600);
>     session_unset();
>     session_destroy();
>     ect.
>     ?>
> 
> Now , when the user logs in again , i want a NEW COOKIE to be sent
> with a new id , to the client! This does not happen as the first
> cookie was never deleted.
> So when the user logs in again the same cookie is used ! why ?

That's weird indeed. OK, try this instead:

<?
$name = session_name();
session_unset();
session_destroy();
setcookie( $name, '', '', '/' );
?>

Regards
Erwin
--- End Message ---
--- Begin Message ---
"Erwin" <[EMAIL PROTECTED]> wrote in message
news:20021105082624.74531.qmail@;pb1.pair.com...
> > Hi Grtz Erwin,
> >
> > let me tell you wat i need to do.
> >
> > 1.) I have a login page - if the user logs in correctly i create
> > session(with session_start()) , a cookie is written to client +
> > session file to server.
> > 2.)When the user logs off - i call the logOff.php page . The contents
> > are as follows :
> >
> >     <?php
> >     session_start();
> >     setcookie(session_name(),-3600);
> >     session_unset();
> >     session_destroy();
> >     ect.
> >     ?>
> >
> > Now , when the user logs in again , i want a NEW COOKIE to be sent
> > with a new id , to the client! This does not happen as the first
> > cookie was never deleted.
> > So when the user logs in again the same cookie is used ! why ?
>
> That's weird indeed. OK, try this instead:
>
> <?
> $name = session_name();
> session_unset();
> session_destroy();
> setcookie( $name, '', '', '/' );
> ?>
>
> Regards
> Erwin

hi ,

Still not working !

After i run the commands above i do the [    print phpinfo();   ]  statement
, when i go down to php variable and look at cookies , there are now two
identical named cookies eg.       PHPSESSID = 2%C something  and
                                    PHPSESSID = 234313414837418374813748dfaj
(long id number)

Instead of deleting the damn cookie , i create a new one it seems ! wat is
there to do ?

Thanks
    Shaun


--- End Message ---
--- Begin Message --- I'd just like to see if I can get some feedback from PHP pros to see if anyone is doing anything like this.

I've got a request to build a two part form, I was thinking it would be a page built with frames, when the top portion is filled out, the selections there would determine what page would fill the bottom portion. But since the bottom would also be a form for submission, I just thought I'd build it with PHP so that hidden fields on it would store the data from the top portion. Then, a submit gets all the data on one form.

Is anyone doing this? Any problems I'm overlooking? I was thinking of a simple javascript action on the upper form to kick off the php for the lower frame.

I'd appreciate any feedback regarding this. Is this something I should be using PHP for?

--
Chris Rehm
[EMAIL PROTECTED]

For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself.
Gal. 5: 14



--- End Message ---
--- Begin Message --- Did you get a request for a two part form, or for a form on 2 pages? The problem I see is with browsers
without javascript (either turned of or not implemented)

Chris Rehm wrote:

I'd just like to see if I can get some feedback from PHP pros to see if anyone is doing anything like this.

I've got a request to build a two part form, I was thinking it would be a page built with frames, when the top portion is filled out, the selections there would determine what page would fill the bottom portion. But since the bottom would also be a form for submission, I just thought I'd build it with PHP so that hidden fields on it would store the data from the top portion. Then, a submit gets all the data on one form.

Is anyone doing this? Any problems I'm overlooking? I was thinking of a simple javascript action on the upper form to kick off the php for the lower frame.

I'd appreciate any feedback regarding this. Is this something I should be using PHP for?


--- End Message ---
--- Begin Message ---
Yuk.  I'll admit I don't like frames at the best of times, but is there any
reason why the two-part form can't be two *pages* rather than two *frames*?

The way I usually do that stuff is get them to fill in part a, then part b:

1) validates part a
2) decides what the part b form should look like
3) includes the contents of part a as hidden fields


But if you *have* to have the form split into two frames, then javascript
would submit the first form contents to the second frame, which would then
act like "part b" as above.

You would need to ask a javascript list about that tho :)


Justin




on 05/11/02 5:18 PM, Chris Rehm ([EMAIL PROTECTED]) wrote:

> I'd just like to see if I can get some feedback from PHP pros to see if
> anyone is doing anything like this.
> 
> I've got a request to build a two part form, I was thinking it would be
> a page built with frames, when the top portion is filled out, the
> selections there would determine what page would fill the bottom
> portion. But since the bottom would also be a form for submission, I
> just thought I'd build it with PHP so that hidden fields on it would
> store the data from the top portion. Then, a submit gets all the data on
> one form.
> 
> Is anyone doing this? Any problems I'm overlooking? I was thinking of a
> simple javascript action on the upper form to kick off the php for the
> lower frame.
> 
> I'd appreciate any feedback regarding this. Is this something I should
> be using PHP for?

--- End Message ---
--- Begin Message ---
Just store the results of the first page into the session, get the
results from the second page, and then process everything.

Or serialize $_POST from the first page and pass it through the second
page in a hidden field.

I'd advise against using frames, just use two pages to get your results.

---John Holmes...

> -----Original Message-----
> From: Chris Rehm [mailto:chris@;javadisciple.com]
> Sent: Tuesday, November 05, 2002 2:18 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP driven frame
> 
> I'd just like to see if I can get some feedback from PHP pros to see
if
> anyone is doing anything like this.
> 
> I've got a request to build a two part form, I was thinking it would
be
> a page built with frames, when the top portion is filled out, the
> selections there would determine what page would fill the bottom
> portion. But since the bottom would also be a form for submission, I
> just thought I'd build it with PHP so that hidden fields on it would
> store the data from the top portion. Then, a submit gets all the data
on
> one form.
> 
> Is anyone doing this? Any problems I'm overlooking? I was thinking of
a
> simple javascript action on the upper form to kick off the php for the
> lower frame.
> 
> I'd appreciate any feedback regarding this. Is this something I should
> be using PHP for?
> 
> --
> Chris Rehm
> [EMAIL PROTECTED]
> 
> For all the law is fulfilled in one word, even in this; Thou shalt
love
> thy neighbour as thyself.
> Gal. 5: 14
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hello Paul,

Monday, November 04, 2002, 10:00:15 PM, you wrote:

PN> http://pear.php.net/bcompiler ?
PN> ~Paul

super!
thnx a lot
I will try it

-- 
Best regards,
Alexander Kuznetsov


--- End Message ---
--- Begin Message ---
Hey guys I have a weird question.  We are building a set of Perl modules
to edit system configuration and I've been given the job of writing a
PHP interface for it.  Here's the situation:

Users.pm has all the functionality needed to safely add users to the
system. There are modules for dns, apache, etc, etc...

The frontend should interface with these modules, calling their
functions when needed.

Does anyone have any ideas how I can do this? 

Derek

--- End Message ---
--- Begin Message ---
I would like know the use of the following directory :
/usr/lib/php/extensions/no-debug-non-zts-20010901

Thanks for your help.


Pierre Vaudrey
email [EMAIL PROTECTED]

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

When is create a session , and the browser refuses cookie i display an error
the the user. There was no cookie created on the clients pc (i know this)
but there is still a session file created on the server. When i use
session_destroy() the session was not deleted , why ?

Thanks
        Shaun


--- End Message ---
--- Begin Message --- Because the client did not supply you with the session id, so session_destroy() doesn't know what file
to erase

Shaun wrote:

hi

When is create a session , and the browser refuses cookie i display an error
the the user. There was no cookie created on the clients pc (i know this)
but there is still a session file created on the server. When i use
session_destroy() the session was not deleted , why ?

Thanks
Shaun





--- End Message ---
--- Begin Message ---
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:3DC7A6C3.7030105@;webglobe.sk...
> Because the client did not supply you with the session id, so
> session_destroy() doesn't know what file
> to erase
>
> Shaun wrote:
>
> >hi
> >
> >When is create a session , and the browser refuses cookie i display an
error
> >the the user. There was no cookie created on the clients pc (i know this)
> >but there is still a session file created on the server. When i use
> >session_destroy() the session was not deleted , why ?
> >
> >Thanks
> >        Shaun
> >
> >
> >
> >
> >
>

in this case , how do i remove the session from the server then , withour
deleting it of course ?


--- End Message ---
--- Begin Message ---
No way, you have to wait till garbage collector erases it

Shaun wrote:

"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:3DC7A6C3.7030105@;webglobe.sk...

Because the client did not supply you with the session id, so
session_destroy() doesn't know what file
to erase

Shaun wrote:


hi

When is create a session , and the browser refuses cookie i display an

error

the the user. There was no cookie created on the clients pc (i know this)
but there is still a session file created on the server. When i use
session_destroy() the session was not deleted , why ?

Thanks
Shaun






in this case , how do i remove the session from the server then , withour
deleting it of course ?





--- End Message ---
--- Begin Message --- I have heard about a bug in this version that also included some first 4 characters loss. Try searching

Daniele Baroncelli wrote:

Hi guys,

I have very weird problem.

I have installed the PHP version 4.2.3 on the LINUX virtual server of my web
project.
Previously I had the PHP version 4.0.6.

The error I get is very weird.
When I insert a record with the phpMyAdmin, the first 4 characters of each
field don't get saved.
Same thing happened with some data entry interfaces I coded!


The only difference I can see in the two installation (provided the php.ini
file is in the same location):

The old version 4.0.6 was installed by the server provider and my virtual
server space I can only see the .so file.
The new version 4.2.3 is actually inside my virtual server space.
Hence, the path I provided in the php configuration is different (I don't
have idea if this can influence something).

NEW VERSION (4.2.3) configuration run by me
'./configure' '--with-apxs=/usr/local/apache/1.3/bin/apxs'
'--prefix=/usr/home/rockit/usr/local'
'--with-mysql=/usr/home/rockit/usr/local/mysql' '--with-xml' '--enable-xslt'
'--with-xslt-sablot=/usr/home/rockit/usr/local' '--with-regex=system'
'--with-expat-dir=/usr/home/rockit/usr/local'
'--with-iconv=/usr/home/rockit/usr/local' '--enable-inline-optimization'
'--disable-debug' '--enable-memory-limit' '--enable-sigchild'
'--without-pear' '--enable-mbstring' '--enable-mbstr-enc-trans'
'--with-gdbm=/usr/local' '--enable-sockets' '--enable-versioning'
'--with-ttf=/usr/local' '--enable-ftp' '--with-gd=/usr/local' '--with-zlib'
'--enable-gd-native-ttf'

OLD VERSION (4.0.6) configuration run by the server provider
'./configure' '--enable-inline-optimization'
'--with-apxs=/usr/local/apache/1.3/bin/apxs'
'--with-config-file-path=/usr/local/lib' '--disable-debug'
'--enable-memory-limit' '--enable-sigchild' '--with-gettext'
'--without-pear' '--with-regex=system' '--enable-mbstring'
'--enable-mbstr-enc-trans' '--with-iconv=/usr/local'
'--with-gdbm=/usr/local' '--with-dbm=/usr/local' '--enable-sockets'
'--enable-versioning' '--with-freetype-dir=/usr/local'
'--with-ttf=/usr/local' '--enable-ftp' '--with-curl=/usr/local/curl'
'--with-openssl=/usr/local/openssl' '--with-gd=/usr/local'
'--with-freetype-dir=/usr/local' '--with-ttf=/usr/local'
'--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local'
'--with-t1lib=/usr/local' '--with-zlib' '--enable-gd-native-ttf'
'--with-imap' '--with-mcrypt=/usr/local' '--with-mhash=/usr/local'
'--with-dom=/usr/local' '--with-mysql=/usr/local/mysql' '--with-zlib'
'--with-zlib'


I must admit that I didn't not include all parameter as the old
installation, as I didn't know most options and thought is not needed. In
the new installation I instead provided additional XML parameter (after
installing the correspond modules, which all seem to work fine).


Hints on problem are very well welcome!


Daniele





--- End Message ---
--- Begin Message ---
Your better off writing it from scratch than taking some pre-existing calendar/events 
code. Break the problem up into two seperate pieces and solve for each - the creation 
of a calendar view and the creation of a events view.

"I am a calendar and I know how to:"
  Show a monthly view of myself
  Move forward one month
  Move backward one month
  When a day is clicked I ask the events viewer to show an event

"I am a events viewer and I know how to:"
  Show a event
  Add a event
  Edit a event
  Delete a event

Create two classes, Calendar (calendar.php) and Events (events.php) that do the above.

The schema of the mySQL database is simple:

create table CalendarEvents
(
   eventId int unsigned NOT NULL auto_increment primary key,
   title varchar(64) NOT NULL,
   eventDateStart DATE default '0000-00-00',
   eventDateEnd DATE default '0000-00-00',
   event text NOT NULL
);

Instead of entering in a date, why not click on the calendar's day to take you to a 
form that will let you enter in the information. Here's some functions to helpin 
generating the calendar, which is nothing more than a 6 row by 7 column table. Figure 
out the start of the first day in the month via the FirstDayofMonth() function below. 
Create blank cells up to that day, then generate the numbered days, along with 
numbered day hyperlinks that when clicked, contain the month, day, year (e.g. 
hyperlink for the day contains Events.php?m=11d=5y=2002). This will create your 
context for the day. You will be able to $_GET the params from within Events.php. This 
will allow you to insert/delete/edit the record for that day in the database.


    function IsLeapYear($year)
    {
        return(date("L", mktime(0,0,0,1,1,$year)));
    }

    function FirstDayofMonth($month, $year)
    {
        // 0 - Sunday.... 6 - Saturday
        return(date("w", mktime(0,0,0,$month,1,$year)));
    }

    function DaysInMonth($month, $year)
    {
        return(date("t", mktime(0,0,0,$month,1,$year)));
    }


Good luck,


Kerry Kobashi
Kobashi Computing

---------------------------------------------------------

"Ray Healy )" <[EMAIL PROTECTED]> wrote in message 
news:001a01c2835e$f9234d40$601786d9@;mainserver...
Dear All

I spent days and days on this little project but still cannot get it to work (new to 
PHP as you might guess).

I have a script which is a combination of tutorial scripts and free code to display a 
calendar with colour coded cells for the events on each day.

The only way to enter events is to enter them one at a time. What I want to do is to 
be able to enter either a start date and end date or start date and the number of 
days. This will then enter a new line in the mySQL database for each day. There would 
only ever be one vent per day.

I have the following fields at present in the database and would probably need another 
field (say number of days)
id int (auto_increment) - eventdate date ('0000-00-00') - title (varchar) - event 
(blob)

Can anyone help me as I have searched them web and mail lists to no avail. Everything 
that is available is excellent but does too much for what I need.

Summary:- a calendar that can colour code the background cells if there is an event 
title in the mySQL database and to be able to enter the event for multiple days.

Any help would be very much appreciated.

Thanks for your time

Ray

--- End Message ---
--- Begin Message ---
hi,

who knows how to get all contents when i use javascript to get bookmark of
IE
ex:

window.external.ImportExportFavoritesfalse,"http://localhost/test.php";);

because  i use $_POST to get that data,but it can't get all data.

if it has 27593 bytes ,then only get 7XXX bytes. that means so many data was
not geted.

i got some informations when use $HTTP_SERVER_VARS, then data is

[key=COMSPEC]=value[C:\\WINDOWS\\COMMAND.COM]
[key=CONTENT_LENGTH]=value[27593]
[key=CONTENT_TYPE]=value[application/x-www-form-urlencoded]
[key=DOCUMENT_ROOT]=value[c:/windows/desktop/web]
[key=HTTP_CACHE_CONTROL]=value[no-cache]
[key=HTTP_CONNECTION]=value[Keep-Alive]
[key=HTTP_HOST]=value[localhost]
[key=HTTP_USER_AGENT]=value[PostFavorites]
[key=PATH]=value[C:\\WINDOWS;C:\\WINDOWS\\COMMAND;C:\\PROGRA~1\\SSHCOM~1\\SS
HSEC~1;C:\\PROGRA~1\\MICROS~4\\80\\TOOLS\\BINN;C:\\PROGRA~1\\ULTRAE~1;C:\\PR
OGRA~1\\BORLAND\\DELPHI5\\BIN;C:\\PROGRA~1\\BORLAND\\VBROKER\\BIN;C:\\PROGRA
~1\\BORLAND\\VBROKER\\JRE\\BIN;C:\\PROGRA~1\\BORLAND\\DELPHI5\\PROJECTS\\BPL
;C:\\PROGRA~1\\ULTRAE~1]
[key=REMOTE_ADDR]=value[127.0.0.1]
[key=REMOTE_PORT]=value[1755]
[key=SCRIPT_FILENAME]=value[c:/windows/desktop/web/test.php]
[key=SERVER_ADDR]=value[127.0.0.1]
[key=SERVER_ADMIN]=value[[EMAIL PROTECTED]]
[key=SERVER_NAME]=value[211.22.80.5]
[key=SERVER_PORT]=value[80]
[key=SERVER_SIGNATURE]=value[<ADDRESS>Apache/1.3.24 Server at 211.22.80.5
Port 80</ADDRESS>
]
[key=SERVER_SOFTWARE]=value[Apache/1.3.24 (Win32) PHP/4.2.2]
[key=WINDIR]=value[C:\\WINDOWS]
[key=GATEWAY_INTERFACE]=value[CGI/1.1]
[key=SERVER_PROTOCOL]=value[HTTP/1.1]
[key=REQUEST_METHOD]=value[POST]
[key=QUERY_STRING]=value[]
[key=REQUEST_URI]=value[/test.php]
[key=SCRIPT_NAME]=value[/test.php]
[key=PATH_TRANSLATED]=value[c:/windows/desktop/web/test.php]
[key=PHP_SELF]=value[/test.php]
[key=argv]=value[Array]
[key=argc]=value[0]

so i know the content length is 27593........

who can tell me how to get all data but not use $_POST variables.........

thanks a lot......^^


--- End Message ---
--- Begin Message ---
I'm trying to create what I believe should be a simple script to help
with logging users into my site.  My problem is that at  the top of my
script I set a variable with it's value and then at later script I
cannot appear to access it.
 
Extract of my code is as follows and fails:
 
$IDField = "loginemail";
$SessionUser = $row['.$IDFeild.'];
session_register('SessionUser');
 
However if I change the second line to

$SessionUser = $row['loginemail'];
 
It works great.
 
Any help would be really appreciated as I think it's just me missing
some basics.
 
Thanks
 
Stephen
--- End Message ---
--- Begin Message ---
well - as far as I understand - this line...
> $SessionUser = $row['.$IDFeild.'];

...should read:
$SessionUser = $row[$IDField];



so - in my eyes just a syntax error. I hope I'm right....
in case you have session_autostart disabled in yout php.ini you first have
to start
the session with the session_start() command.


_andi



"Stephen Of Blank Canvas Group" <[EMAIL PROTECTED]> schrieb im
Newsbeitrag news:003401c284bc$c4a76ce0$0101a8c0@;abstractinternet.net...
> I'm trying to create what I believe should be a simple script to help
> with logging users into my site.  My problem is that at  the top of my
> script I set a variable with it's value and then at later script I
> cannot appear to access it.
>
> Extract of my code is as follows and fails:
>
> $IDField = "loginemail";
> $SessionUser = $row['.$IDFeild.'];
> session_register('SessionUser');
>
> However if I change the second line to
>
> $SessionUser = $row['loginemail'];
>
> It works great.
>
> Any help would be really appreciated as I think it's just me missing
> some basics.
>
> Thanks
>
> Stephen
>


--- End Message ---
--- Begin Message ---
Allo,

Basically, my question is.. how do I do this? I am actually (for various .. 
and probably stupid... reasons) trying to spawn a php process to run in the 
background. This process I know will take a couple of hours to run (mailing 
list stuff). I have been playing around with system to try to get it to run 
in the background but I can't seem to work out how to do it.

Any pointers would be a great help

Thanks

Kevin
--- End Message ---
--- Begin Message ---
> Basically, my question is.. how do I do this? I am actually (for
> various .. and probably stupid... reasons) trying to spawn a php
> process to run in the background. This process I know will take a
> couple of hours to run (mailing list stuff). I have been playing
> around with system to try to get it to run in the background but I
> can't seem to work out how to do it.

A process which generates output (or can generate output) will make the
system or exec call in blocking. That means that the PHP script will wait
until your script is finished. This can be simply fooled by adding ">
/dev/null" to your commandline (if you're running on a *nix based machine of
course).

I have a simple background process, which forks itself and then immediately
returns (only the parent process, the child keeps on running). Even then the
exec function was blocking, until I added "> /dev/null" to the commandline.
If you're background process doesn't spawn it's own child, I think you'll
have to add an ampersand (&) also, to make the program run in background.

HTH
Erwin

--- End Message ---
--- Begin Message ---
Hello,


How i format a number in currency ? Try find it on
php.net but i did not see nothing. 

Anyone know this?




Augusto Flavio

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
--- End Message ---
--- Begin Message ---
Hi,
try this function:

number_format -- Format a number with grouped thousands

Description
string number_format ( float number [, int decimals [, string dec_point
[, string thousands_sep]]])


Petr Tomenendal

On Tue, 2002-11-05 at 12:55, dark rotter wrote:
> Hello,
> 
> 
> How i format a number in currency ? Try find it on
> php.net but i did not see nothing. 
> 
> Anyone know this?
> 
> 
> 
> 
> Augusto Flavio
> 
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.sprintf.php

Example 6 shows you how.

Rudolf Visagie
Principal Software Developer
Digital Healthcare Solutions
<mailto:rudolf@;dhsolutions.co.za>
Tel: 011 6901019
Cell: 082 895 1598
 


-----Original Message-----
From: dark rotter [mailto:darkrotter@;yahoo.com]
Sent: Tuesday, November 05, 2002 1:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Format Currency


Hello,


How i format a number in currency ? Try find it on
php.net but i did not see nothing. 

Anyone know this?




Augusto Flavio

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have written 2 programs (which are very common PHP
programs) that A) Allows me to upload image files into a MYSQL database
using a simple form.  And B) Allows me to retrieve and display the image
using a PHP script.  This is my problem:-

I can upload the images ok.  I store the binary code, image type, name, and
size within the MYSQL database.  On checking the database directly using
DBTools, I can see that the files have uploaded.  The file sizes reflect
exactly what was originally on the hard disk of my PC (not sure if this is a
correct gauge).

When I run my PHP program to display the images, maybe only 1 out of 10
actually displays correctly.  The rest are broken up or non displayable
images.  One image even made a prompt window appear and somehow now causes
Windows paint to load the image instead of the browser.  God only knows how
that occurred !!

Below are my (designed by others) 2 programs.  The first program is the
upload form.  This seems to work ok.



<HTML>
<HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
<BODY>

<?php
// code that will be executed if the form has been submitted:

if ($submit) {

    // connect to the database

    require_once('../../Connections/TestServer.php');
    mysql_select_db($database_TestServer, $TestServer);

    $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));

    $result=MYSQL_QUERY("INSERT INTO master_products
(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
ype) ".
        "VALUES
('$data','$form_data_name','$form_data_size','$form_data_type')");

    $id= mysql_insert_id();
    print "<p>This file has the following Database ID: <b>$id</b>";

    MYSQL_CLOSE();

} else {

    // else show the form to submit new data:
?>

    <form method="post" action="<?php echo $PHP_SELF; ?>"
enctype="multipart/form-data">
  <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
    <br>File to upload/store in database:<br>
    <input type="file" name="form_data"  size="40">
    <p><input type="submit" name="submit" value="submit">
    </form>

<?php

}

?>

</BODY>
</HTML>

Here is the code to display the image:-

<?php
if($id) {
    require_once('../Connections/TestServer.php');
    mysql_select_db($database_TestServer, $TestServer);
    $query = "select image_thumbnail,image_thumbnail_type from
master_products where item_id=$id";
    $result = @MYSQL_QUERY($query);
    $data = @MYSQL_RESULT($result,0,"image_thumbnail");
    $type = @MYSQL_RESULT($result,0,"image_thumbnail_type");
    Header( "Content-type: $type");
    echo $data;
};
?>

I run the above program in the following way:
http://192.168.0.11/htdocs/displayimage2.php?id=9  The ID is the item_id
primary key field for whichever record I want to display.

I have tried these programs on a test server here in my room to a test
Apache server and MYSQL test database, and also from my ISP to a MYSQL
database at a server at my ISP.  I get exactly the same problem.  When I run
the display image program, the images being displayed are always being
displayed the same.  Which points the problem towards the upload process
(maybe).  If anybody can tell me what the heck is wrong here, I'll give them
a medal !!  There is basically some kind of binary corruption going on (it
looks like)

For added information, below is my database table structure.  At the moment,
the only part I am actually using relates to the image_thumbnail sections.

Darren.



CREATE TABLE master_products (
 item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
 item_code VARCHAR (10) UNIQUE,
 item_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 item_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',

 category ENUM ("none","single herbs","general
vitality","ageing","arthritis","eyesite","prostate","ahlzheimers",
 "weight
loss","menopause","depression","fatigue","headaches","insomnia","colds and
flues","allergies",
 "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for
women","for men","books"),

 name VARCHAR (30),
 name_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 name_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
 INDEX idx_name (name),

 desc_brief VARCHAR (255),
 desc_brief_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 desc_brief_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
 INDEX idx_desc_brief (desc_brief),

 desc_long TEXT,
 desc_long_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 desc_long_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',

 price DECIMAL (7,2),
 price_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 price_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',

 image LONGBLOB,
 image_name VARCHAR (50),
 image_size INT UNSIGNED,
 image_type VARCHAR (50),
 image_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 image_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',

 image_thumbnail LONGBLOB,
 image_thumbnail_name VARCHAR (50),
 image_thumbnail_size INT UNSIGNED,
 image_thumbnail_type VARCHAR (50),
 image_thumbnail_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
 image_thumbnail_datemodified DATETIME DEFAULT '0000-00-00 00:00:00'
 );




--- End Message ---

Reply via email to