php-general Digest 20 May 2001 12:41:02 -0000 Issue 697

Topics (messages 53570 through 53607):

echo question
        53570 by: Louis Brooks
        53573 by: Jason Lotito

Re: Global variables? (unset/set or what?)
        53571 by: Richard

Re: Global varia........ **Sorry, I mean... **
        53572 by: Richard

Re: Reports in web browser
        53574 by: Richard
        53578 by: Markus Fischer
        53589 by: John Monfort

Re: Mailserver?!
        53575 by: Plutarck
        53603 by: FredrikAT

Re: get all defined constants?
        53576 by: Chris Lee

Re: count() multidimensional array
        53577 by: Hugh Bothwell

An excellant example of what PHP can do
        53579 by: Plutarck

Accessing data from a localhost proxy
        53580 by: Plutarck

Re: A universal Database Class
        53581 by: Manuel Lemos

Re: Lookin For Programmer
        53582 by: Plutarck

is mod_php4 faster than mod_perl?
        53583 by: Christopher Leigh
        53586 by: Steven Haryanto

Email form
        53584 by: ddogbruce.home.com
        53605 by: FredrikAT

Browscap.ini
        53585 by: Weston Houghton
        53587 by: Chris Adams

Broken ip2long and long2ip?
        53588 by: Sean Cazzell
        53606 by: Jorg Krause

problem with cookies
        53590 by: Peter Knif
        53591 by: Peter Knif

Max execution time exceeded in Unknown on line 0
        53592 by: David De Graff

Re: Unix problem
        53593 by: Christian Reiniger

Re: The performance of sleep() and usleep()
        53594 by: Christian Reiniger

Re: Include Paths
        53595 by: Christian Reiniger

comparison operators
        53596 by: Heidi Belal
        53597 by: Heidi Belal
        53598 by: Heidi Belal
        53601 by: Diego Pérez Rández

Uploading files
        53599 by: Diego Pérez Rández

Problem using unpack
        53600 by: Craig Vincent
        53602 by: Zak Greant

Multiple emails
        53604 by: Tom Carter

PHP claims that class was defined twice
        53607 by: Jens Kisters

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]


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


Hi All:

I need to print out several paragraphs of information stored in a MySql 
field to a web page. To do this I am using:

$db = mysql_connect("localhost", "dbase", "password");
mysql_select_db("dbase",$db);
$sql = "SELECT update FROM members WHERE username = 'Don'";
$query = mysql_query($sql);
$results = mysql_fetch_array($query);
$text = $results["update"];

echo "$text";

but it does not insert the returns between the paragraphs. I think I need 
to tell it to insert a <p> in place of the return. There is a way to do 
this as I have seen it on the PHP site when I was searching for something 
else. Of course now that I need it I can't find the example. Can someone 
please help me figure this out?

Thank you,

Louis Brooks





You are looking for the function nl2br()

Information here: http://www.newbienetwork.net/article.php?sid=70
And here: http://www.php.net/manual/en/function.nl2br.php

See echo statement below for example implementation.

Jason Lotito
www.NewbieNetwork.net

> -----Original Message-----
> From: Louis Brooks [mailto:[EMAIL PROTECTED]] 
> Sent: Saturday, May 19, 2001 8:01 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] echo question
> 
> 
> Hi All:
> 
> I need to print out several paragraphs of information stored 
> in a MySql 
> field to a web page. To do this I am using:
> 
> $db = mysql_connect("localhost", "dbase", "password"); 
> mysql_select_db("dbase",$db); $sql = "SELECT update FROM 
> members WHERE username = 'Don'"; $query = mysql_query($sql); 
> $results = mysql_fetch_array($query); $text = $results["update"];
> 

echo nl2br($text);

> 
> but it does not insert the returns between the paragraphs. I 
> think I need 
> to tell it to insert a <p> in place of the return. There is a 
> way to do 
> this as I have seen it on the PHP site when I was searching 
> for something 
> else. Of course now that I need it I can't find the example. 
> Can someone 
> please help me figure this out?
> 
> Thank you,
> 
> Louis Brooks
> 
> 
> -- 
> 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]
> 
> 





So this will do then:

    $GLOBALS["userPassword"] = "whatever";

And when I need to use it, I use
    echo userPassword;

and such alike?

What if I would like to change it? Can I simply use
'userPassword="whatever"';

?

Thanks,
Richard







Wrong examples written in my past post.

    $GLOBALS["userPassword"] = "whatever";
    global $userPassword;


    and then write/read from it?

- Richard







You need to be more specific than that.

You cannot demand the browser to start printing, only thing is to write the
contents of the report to a webpage and then the visitor/user can print it
out if she/he likes.

It depends on how you have stored the reports.

- Richard

""Mihailo Dzigurski"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I have written some accounting application using PHP, and now I need to
> create some reports. Those reports need to be printed from web browser.
>
> What can I do?
>
> Thanks
> Mihailo.
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.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]
>






On Sun, May 20, 2001 at 02:11:04AM +0200, Richard wrote : 
> You need to be more specific than that.
> 
> You cannot demand the browser to start printing, [...]

Not true if JavaScript is enabled (and most browsers do).

window.print();

prints the document (but in fact, it will popup a printing
dialog)

- Markus






   I believe there is a  window.print() JavaScript code, that lets you
   print a document. I've never used it, so I'm not sure.

   <a href=# onClick="window.print();">Print Document </a>
   //or something like that...

  good luck !!


__________John Monfort_________________
_+-----------------------------------+_
     P E P I E  D E S I G N S
       www.pepiedesigns.com
"The world is waiting, are you ready?"
-+___________________________________+-

On Sun, 20 May 2001, Richard wrote:

> You need to be more specific than that.
>
> You cannot demand the browser to start printing, only thing is to write the
> contents of the report to a webpage and then the visitor/user can print it
> out if she/he likes.
>
> It depends on how you have stored the reports.
>
> - Richard
>
> ""Mihailo Dzigurski"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> >
> > I have written some accounting application using PHP, and now I need to
> > create some reports. Those reports need to be printed from web browser.
> >
> > What can I do?
> >
> > Thanks
> > Mihailo.
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.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]
> >
>
>
>
> --
> 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]
>
>





Check out http://webgadgets.com/phpost/

That's a good way to get started on handling emails with PHP.

I'd need to know more about what you want to do to tell you if PHP is the
way to do it.

If you want to run a mail server which takes incoming emails and directly
writes them to a database, PHP probably isn't the way to go. A Java Servlet
would probably be a more appropriate application for that.

But I don't think that's what you're wanting to do.


Plutarck

""FredrikAT"" <[EMAIL PROTECTED]> wrote in message
9e6gud$eie$[EMAIL PROTECTED]">news:9e6gud$eie$[EMAIL PROTECTED]...
> Hi!
>
> I want to have a mailapp on my server (win32) wich writes all incoming
mails
> to a MySQL db.
>
> Is this possible?
>
> ---------------------------------
> Fredrik A. Takle
> [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]
>






What I look for is a POP/IMAP server that writes incoming mails to a MySQL
db! (WIN32)

Fredrik Takle
Bergen, Norway


""Plutarck"" <[EMAIL PROTECTED]> skrev i melding
9e73vh$95f$[EMAIL PROTECTED]">news:9e73vh$95f$[EMAIL PROTECTED]...
> Check out http://webgadgets.com/phpost/
>
> That's a good way to get started on handling emails with PHP.
>
> I'd need to know more about what you want to do to tell you if PHP is the
> way to do it.
>
> If you want to run a mail server which takes incoming emails and directly
> writes them to a database, PHP probably isn't the way to go. A Java
Servlet
> would probably be a more appropriate application for that.
>
> But I don't think that's what you're wanting to do.
>
>
> Plutarck
>
> ""FredrikAT"" <[EMAIL PROTECTED]> wrote in message
> 9e6gud$eie$[EMAIL PROTECTED]">news:9e6gud$eie$[EMAIL PROTECTED]...
> > Hi!
> >
> > I want to have a mailapp on my server (win32) wich writes all incoming
> mails
> > to a MySQL db.
> >
> > Is this possible?
> >
> > ---------------------------------
> > Fredrik A. Takle
> > [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]
> >
>
>
>
> --
> 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]
>






phpinfo() allways has a list of variables. but of course every variable is
allways in $GLOBALS too.

--

  Chris Lee
  [EMAIL PROTECTED]



"Alex Black" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi all,
>
> can't find a function for getting a complete list of defined constants.
> this exists for classes, I think it must for constants even if it is
> undocumented.
>
> I'm writing a bit of debug code, and I'd rather not build a bunch of
> implicit knowledge about my set of constants into the code - I'd like to
> just dump everything in my environment onto the page.
>
> please respond to me @ [EMAIL PROTECTED]
>
> tia all,
>
> _alex
>
>
> --
> 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]
>






""Dean Martin"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> My code to list only the rows that were checked is this..
>
> for ($j=1 ; $j=5; $j++)
<SNIP>
> This code is creating an endless loop and times out the server with memory
> overruns.
>
> What am I missing?

In the end-loop condition, you're using assignment ('=') instead of if-equal
('==').

Effectively, the loop runs until 5 == 0  ;-)






Just found this site recently, and after a little playing I found out that
it uses the .php3 extension as it's main feature. I believe it uses PHP for
just about everything it does, which is a great example of how PHP can do
just about anything web technology allows ;)

Here it is (excellant for people at work/in foreign countrys):

https://www.safeweb.com/


Their triangleboy application of course doesn't use PHP as their server has
to spoof packets, but their online site uses it. And they're pretty huge,
showing that PHP really can handle high-load websites.


Enjoy,

Plutarck






I was wondering, when you set your browser's proxy setting to localhost, how
do you access that information through a program?

In PHP would you open a specific stream, or would you open a socket on
127.0.0.1 with the same port as the one you specified in your browser?

Basically when you make your browser use a localhost proxy, where does the
information actually "go"? Does the browser open a socket and send the
information to whatever it connects to? If there has to be something
listening on that port, what happens if two applications are listening to
the same port? Do they both get the same data?


Thanks in advance of my other thank yous,
Plutarck






Hello Brandon,

On 17-May-01 16:23:12, you wrote:

>I am making a suite of online tools.  Right Now I am connecting to a MS SQL
>2000 database.  Is there any class out there that will let you send a query
>to more than just one type of databases?  Like someone could run it off a
>MSSQL server and another could run it off a MySQL database.

You may want to try Metabase.  It supports many database consistently in
such way that you can write fully database independent applications that
work with the supported databases:

http://phpclasses.UpperDesign.com/browse.html/package/20

Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--





I reccommend looking around sourceforge.net for current PHP BB projects, and
if you find something like you want you can join that project, or you can
just create your own project and thus allow people to join in the creation,
should they so choose.


Plutarck

"nicholas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hmmm anyone looking to join me in making a bb called BestBoard? email me
at
> [EMAIL PROTECTED] not thru the list! (note if these are not
supposed to go on this list 1 flame
> will be suffiecent thanks!)
>
>
> --
> 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]
>






i'm wondering if mod_php4 is faster than mod_perl.

thank you,



christopher





apples & oranges. :)

but mod_php without cache (e.g., zend cache) still suffers
from an overhead of recompiling scripts in every request
(serious overhead if the site is complex).

--
sh

On 19/07/2001 11:03, Christopher Leigh wrote:
>i'm wondering if mod_php4 is faster than mod_perl.
>
>thank you,





I've been out of the loop for so long.

I make a normal form, but the action is something.. 

I don't want it to send from the uers email, but use the server.  Some
people don't have an email client configured.  Can yah help?  

Thanks,
Owen




Check: http://www.php.net/mail



<[EMAIL PROTECTED]> skrev i melding [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I've been out of the loop for so long.
>
> I make a normal form, but the action is something..
>
> I don't want it to send from the uers email, but use the server.  Some
> people don't have an email client configured.  Can yah help?
>
> Thanks,
> Owen
>
> --
> 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]
>







So...

I cannot for the life of me get browscap.ini to work.

Also the browserhawk version of the browscap.ini is sadly out of date.
Anyone have any leads for me on getting this to work? I consistently get an
empty array returned.

Thanks,
Wes





On 19 May 2001 22:13:05 -0700, Weston Houghton <[EMAIL PROTECTED]> wrote:
> I cannot for the life of me get browscap.ini to work.
> 
> Also the browserhawk version of the browscap.ini is sadly out of date.
> Anyone have any leads for me on getting this to work? I consistently get an
> empty array returned.

First, get_browser() seems to break in every other release, particularly on
Windows. You might want to search bugs.php.net to see if it will work at all on
your system & version.

If you are using a build with a functional get_browser(), check out
asptracker.com for a more recent browscap.ini.

Chris




It appears that the integer type being used by these functions is not able
to store the entire 32 bits (4 bytes).  It can only handle up to 31 bits -
my guess is the type is signed when it should be unsigned.

In any case,I'm running PHP 4.0.5 on Linux 2.4.3 on an x86 machine.  I
would appreciate it if a someone can verify this before I submit it as a
bug.


Regards,

Sean Cazzell





> From: Sean Cazzell [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 20, 2001 8:41 AM
[...]
> It appears that the integer type being used by these functions is not able
> to store the entire 32 bits (4 bytes).  It can only handle up to 31 bits -
> my guess is the type is signed when it should be unsigned.
>
> In any case,I'm running PHP 4.0.5 on Linux 2.4.3 on an x86 machine.  I
> would appreciate it if a someone can verify this before I submit it as a
> bug.
>
[...]
You're right. Integers are allways signed and therefore 31 Bit. Use this:

$ip = '192.168.100.102';
$lo = ip2long($ip);
if ($lo < 0) $lo += pow(2,32);

$lo does now contain the right value, PHP internally converts the data type
to double.
BTW, long2ip() accepts both values, a signed integer or a double value.

I think this isn't a bug, it is due to the pure type concept of PHP,
where no real long-values or bigint (like MySQL) are possible.
Put a better type concept on your wishlist for PHP 5.

Joerg
[EMAIL PROTECTED]
www.php.comzept.de





Hi! I'm trying to write a simple script that would set a cookie. I keep
receiving the following message:

Warning: Cannot add header information - headers already sent by (output
started at e:\inetpub\wwwroot\PHP\game.php:85) in
e:\inetpub\wwwroot\PHP\game.php on line 87

Here's the code:

85  echo "showing results\n<BR>";
86  echo "Right answers = $right\n<BR>";
87  setcookie("cookie_value", $right, time()+3600);

Could someone tell me what might cause this problem? Thanks.


--
***** Peter Knif *****

[EMAIL PROTECTED]






never mind, I solved the problem.

--
***** Peter Knif *****

[EMAIL PROTECTED]
""Peter Knif"" <[EMAIL PROTECTED]> wrote in message
9e7ror$mp0$[EMAIL PROTECTED]">news:9e7ror$mp0$[EMAIL PROTECTED]...
> Hi! I'm trying to write a simple script that would set a cookie. I keep
> receiving the following message:
>
> Warning: Cannot add header information - headers already sent by (output
> started at e:\inetpub\wwwroot\PHP\game.php:85) in
> e:\inetpub\wwwroot\PHP\game.php on line 87
>
> Here's the code:
>
> 85  echo "showing results\n<BR>";
> 86  echo "Right answers = $right\n<BR>";
> 87  setcookie("cookie_value", $right, time()+3600);
>
> Could someone tell me what might cause this problem? Thanks.
>
>
> --
> ***** Peter Knif *****
>
> [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]
>






Hi,

I've had php (4.0.5) working fine with postgres and w-agora (forum
software),  but am now having trouble after trying installs of php-nuke and
phpWebSite. These use mysql, which has also been freshly installed.

After a reboot the <? phpinfo(); ?> tag executes immediately, but after
trying to execute a php script from one of the new web apps all php scripts
perform very slowly and the results include the following error at the
bottom of the page:

Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on
line 0

This happens even for a test page with nothing but the <? phpinfo(); ?>
tag.

It does seem like php is connecting to mysql, since the results that are
eventually returned include database-depended content. For phpinfo() most
results are returned immediately but the page hangs after the php variables
heading, and results for this page are not returned until the 30 second time
limit is apparently reached. Then those results are displayed, followed by
the error described above.

Other pages, say the admin.php page for phpWebSite, don't return anything
until the time limit expires. Then what seems to be the entire page is
displayed, followed by the same error line.

Any help would be much appreciated. I've been beating my head against this
for quite a while.

Thanks,

Dave De Graff





On Saturday 19 May 2001 14:22, Urb LeJeune wrote:
> I'm using the follow snippet while traversing a directory.
>
> while ($Directory=readdir($DirHandle)) {
>
>   $IsFile = is_file($Directory);
>   $IsDir = is_dir($Directory);
>   echo " is file=$IsFile - is dir=$IsDir\n";
>
>       Works fine on Windows box, on a Unix box (RedHat) both
> is_file() and is_dir() return null no matter what the contents of
> $Directory is.

readdir returns the file/directory name without path, is_file and is_dir 
expect a complete filenam with path. So unless you only examine your 
current directory, is_file & is_dir won't find the files.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

I saw God --------- and she was black.




On Saturday 19 May 2001 17:26, BlackLord wrote:
> If i use these functions in my script, what will be the system resource
> usage? I know, thread will be open while the script is running but, i
> believe that they will not use extra system resource, won't they?

sleep () does exactly that - putting the process to sleep for the 
specified period. It doesn't use any processing power during that time 
and it might even use less memory (if it is swapped out).

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

I saw God --------- and she was black.




On Saturday 19 May 2001 23:18, Dylan Finney wrote:

> I am fairly new to PHP and so far I love it.  One question I have is
> how to call include files outside of their directory without hard
> coding the real path to the file itself.  Is there map path or a

See the include_path ini directive in the config section of the manual

> similar function in PHP? Also when i use readfile() or fpassthru() when
> I echo the result what I assume is the file size is added to the end of
> the line.  i.e.( blah blah blah will produce a 14 at the end of the
> line ) I was curious as to if there is a flag i'm missing that is
> causing them to do that.  Thank you for the help!

You do a
print (readfile ('foo'));
right?

Well, readfile reads the file *and outputs it*, then returns the number 
of chars read. That is passed to print (). So just use
readfile ('foo');

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

I saw God --------- and she was black.




Hi All!
i'm creating this form for people to upload pictures,
so i want to be able to compare the type of the file,
so that if it's not a .gif or a .jpg i give them an
error message!
What i am using is:

If ($userfile_type == "image/gif") 
   - here it uploads the file
otherwise it sends out an error message!

but the problem i'm having is that even when i try
uploading a .txt it accepts it and uploads it without
giving the error message.
Is there another way to compare strings? or is ==
operater correct? or what am i doing wrong?
thanks!



=====
Heidi Belal
ICQ# 32127109

A bus stops at a bus station.
A train stops at a train station.  On my desk
I have a work station...

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




Hi All!
i'm creating this form for people to upload pictures,
so i want to be able to compare the type of the file,
so that if it's not a .gif or a .jpg i give them an
error message!
What i am using is:

If ($userfile_type == "image/gif") 
   - here it uploads the file
otherwise it sends out an error message!

but the problem i'm having is that even when i try
uploading a .txt it accepts it and uploads it without
giving the error message.
Is there another way to compare strings? or is ==
operater correct? or what am i doing wrong?
thanks!



=====
Heidi Belal
ICQ# 32127109

A bus stops at a bus station.
A train stops at a train station.  On my desk
I have a work station...

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




Hi All!
i'm creating this form for people to upload pictures,
so i want to be able to compare the type of the file,
so that if it's not a .gif or a .jpg i give them an
error message!
What i am using is:

If ($userfile_type == "image/gif") 
   - here it uploads the file
otherwise it sends out an error message!

but the problem i'm having is that even when i try
uploading a .txt it accepts it and uploads it without
giving the error message.
Is there another way to compare strings? or is ==
operater correct? or what am i doing wrong?
thanks!



=====
Heidi Belal
ICQ# 32127109

A bus stops at a bus station.
A train stops at a train station.  On my desk
I have a work station...

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




Hi:

For compare strings you can use strcmp.

$st1 = "hi";
$st2 = "bye";

if (strcmp($st1, $st2)) {
    echo "are different";
    }
else {
    echo "are equal";
    }

The strcmp return 0 when the strings are equal. If the strings are diferent,
return the pos of the char where begin the diference.

I think you can use this without problems.

********************

I can see that you upload files. My problem it's that i can do it. Y use the
form like this.

<form enctype="multipart/form-data" action="subirfichero.php" method="POST">

  <input type="hidden" name="MAX_FILE_SIZE" value="1000">Send this
  file: <input name="dd" type="file"> <input type="submit"  value="Send
File">
</form>

My problem is that i don't know how to do the php program that i upload the
file.

Can you help me?.

Thanks.

Best Regards

                                                    Diego


Heidi Belal escribió:

> Hi All!
> i'm creating this form for people to upload pictures,
> so i want to be able to compare the type of the file,
> so that if it's not a .gif or a .jpg i give them an
> error message!
> What i am using is:
>
> If ($userfile_type == "image/gif")
>    - here it uploads the file
> otherwise it sends out an error message!
>
> but the problem i'm having is that even when i try
> uploading a .txt it accepts it and uploads it without
> giving the error message.
> Is there another way to compare strings? or is ==
> operater correct? or what am i doing wrong?
> thanks!
>
> =====
> Heidi Belal
> ICQ# 32127109
>
> A bus stops at a bus station.
> A train stops at a train station.  On my desk
> I have a work station...
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> 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]






    Hi to all:

    I don`t konw very well php. I do examples everyday and solve some
problems. But in other i need help.

    Today i want to upload a file. I have the form that you can find in
the php manual.

    <form enctype="multipart/form-data" action="_URL_" method="POST">
  <input type="hidden" name="MAX_FILE_SIZE" value="1000">Send this
  file: <input name="userfile" type="file"> <input type="submit"
value="Send File">
</form>

    My problem is that i don´t know how to programe the php program that
upload the file. I do a lot of examples, but not work.

    Can someone give me help.


    Thanks.


    Best regards, Diego





I'm current trying to use PHP's unpack feature to decode a binary string and
am running into a problem.

Here is the unpack command I am using

$playerdata = unpack("czero/A$lengthone/itwo/fthree/A*four", $rest);

basically it is setup so that the hash created has 5 key/value pairs named
zero, one, two, three and four.  However my problem is with the second
key/value pair.  Since the information I need for the second field is
dynamic I need to be able to set a variable there to tell PHP exactly how
many characters are to be parsed for that field.  So say $length = 5 right
now the command would be translated by PHP as

$playerdata = unpack("czero/A5one/itwo/fthree/A*four", $rest);

At least that's what I need =)  The problem I'm experiencing right now is
that PHP translates the variable as $lengthone instead of just $length which
of course always results in 0 and then causes the data to be parsed
incorrectly.  I cannot use whitespace to separate $length and one as then
the unpack feature breaks down thinking that whitespace should be in the
string I'm unpacking which messes things up as well.

Any suggestions/tips for handling this problem would be much appreciated =)
I've been plagued with this problem for a few days now and I'm having no
luck =/

Sincerely,

Craig Vincent





$playerdata = unpack('czero/A'.$length.'one/itwo/fthree/A*four', $rest);

Good Luck!

--Zak

----- Original Message -----
From: "Craig Vincent" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 20, 2001 4:00 AM
Subject: [PHP] Problem using unpack


> I'm current trying to use PHP's unpack feature to decode a binary string
and
> am running into a problem.
>
> Here is the unpack command I am using
>
> $playerdata = unpack("czero/A$lengthone/itwo/fthree/A*four", $rest);
>
> basically it is setup so that the hash created has 5 key/value pairs named
> zero, one, two, three and four.  However my problem is with the second
> key/value pair.  Since the information I need for the second field is
> dynamic I need to be able to set a variable there to tell PHP exactly how
> many characters are to be parsed for that field.  So say $length = 5 right
> now the command would be translated by PHP as
>
> $playerdata = unpack("czero/A5one/itwo/fthree/A*four", $rest);
>
> At least that's what I need =)  The problem I'm experiencing right now is
> that PHP translates the variable as $lengthone instead of just $length
which
> of course always results in 0 and then causes the data to be parsed
> incorrectly.  I cannot use whitespace to separate $length and one as then
> the unpack feature breaks down thinking that whitespace should be in the
> string I'm unpacking which messes things up as well.
>
> Any suggestions/tips for handling this problem would be much appreciated
=)
> I've been plagued with this problem for a few days now and I'm having no
> luck =/
>
> Sincerely,
>
> Craig Vincent
>
>
> --
> 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]
>





Hi all,

I have a list of email addresses pulled from a database and I want to send
out an email to all of them  (they are the registered users of this
particular site). For the first issue of the newsletter I expect to have
about 4000 people, but that will probably go up significantly in future
issues.

I can do the sending email normally and extraction of addresses, but my
question was really a more general one.
Is there anything I should be doing different when sending to so many?
Is it better to send a load of addresses altogether (in bcc for example) for
each mail call? how many?
or is it better to use a mail call for each address? I did a few quick speed
test and mail seemed to be very fast. I guess this way would have the
advantage of being able to personallise for each person.
And is there a possibility that my mails would be blocked my some kind of
spam filtering system? Its not I might add!

Any advice and past experience would be very welcome.

BTW, my system is apache on linux, php 4.0.4pl1 running on a cobalt raq.

Thanks in advance

Tom Carter
Web Architect
roundcorners ltd.






Hey there i noticed sometinh quite odd when trying to include a class
definition:

There are several classes in the project in question.
Every class resides i a separate file that gets included.

When i call the following method

 function mRenderPrintNav($client) {
  show_var("",get_declared_classes());//debugcode

include($this->pApp->pPath."/".$this->pApp->pCommonPath."/layernav.cls.php");
//include the class definition
  $menu=new Menu;
  $this->mRenderNavWalk($client,&$menu);
  $menu->printMenu();
 }

PHP complains

Fatal error: Cannot redeclare class menu in ..//_common/layernav.cls.php
on line 3

ok i started checking if i include the file twice, ich wrote some chars
before the first <?
in the class file, and i see the chars once, but not twicw.
There is no other class called menu in the same project.

So i checked the defined classes with PHP's get_declared_classes().

if i check the declared classes *before* the include it says that the
class Menu is defined.
if i uncomment the include (it is called after get_declared_classes())
the class is not defined at all.

weird.i dont get it.
maybe you do

thank you guys
Jens

--
Grüße aus dem schönen Kleve
Jens Kisters

rosomm et partner
Agentur für neue Medien GmbH
Dienstleistungszentrum am
Weißen Tor - Eingang B
Gocher Landstrasse 2
47551 Kleve / Bedburg-Hau

Telefon: 02821 - 97856-20
Telefax: 02821 - 97856-77
[EMAIL PROTECTED]
http://www.rosomm-partner.de




Reply via email to