php-general Digest 18 Mar 2005 13:07:01 -0000 Issue 3345

Topics (messages 211004 through 211039):

download files with header
        211004 by: helene malamoud

Re: Setting cookies for other domains
        211005 by: Chris W. Parker
        211006 by: Chris Shiflett
        211009 by: Brian Dunning
        211016 by: Scott Haneda

Re: getting text with strange encodng
        211007 by: Jim Plush

Re: can you help me ??
        211008 by: Wahyu SP
        211013 by: M. Sokolewicz

New Website for PHP Coders.. www,lifenit.com
        211010 by: freshersworld .com
        211012 by: Stephen Johnson

Visit www.Merchantii.com
        211011 by: freshersworld .com

passing return value from fucntion
        211014 by: William Stokes
        211015 by: Forest Liu
        211018 by: William Stokes
        211020 by: Ford, Mike
        211021 by: Forest Liu

How from an html/web form I may go to a php script output(of form values)
        211017 by: Leonidas Savvides
        211024 by: Forest Liu

Custom errors handling class problem
        211019 by: Mihai Frisan

change the font color of a string variable in PHP
        211022 by: babu
        211023 by: Chris Ramsay
        211025 by: babu
        211026 by: Chris Ramsay
        211027 by: babu
        211029 by: Chris Ramsay

More function troubles
        211028 by: AndreaD
        211030 by: Chris Ramsay
        211031 by: Chris Ramsay

Re: Files upload - Encrypt into a variable - Do not inject into db 
(PHP/Apache/MySQL)
        211032 by: Marek Kilimajer

Reading all headers sent
        211033 by: martin
        211035 by: Jesper Goos
        211036 by: martin
        211037 by: M. Sokolewicz

Referer checking is able to be referer spoofed
        211034 by: dan rossi

does your mail() base64 encode messages?
        211038 by: John W. List

sessioncookies?
        211039 by: William Stokes

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
I tryed the function that aarondunlap.com sent the 28 dec 2004.
The browser open the window for download, I get the file on the client , same 
size as the original but 
when I want to open the file , it's corrupted.
It's like if the script file is mixed with the file I sent
(I tryed with IE and FIREFOX, and different extension)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"<?php

function dl_file($file){

   //First, see if the file exists
   if (!is_file($file)) { die("<b>404 File not found!</b>"); }

   //Gather relevent info about file
   $len = filesize($file);
   $filename = basename($file);
   $file_extension = strtolower(substr(strrchr($filename,"."),1));

   //This will set the Content-Type to the appropriate setting for the file
   switch( $file_extension ) {
         case "pdf": $ctype="application/pdf"; break;
     case "exe": $ctype="application/octet-stream"; break;
     case "zip": $ctype="application/zip"; break;
     case "doc": $ctype="application/msword"; break;
     case "xls": $ctype="application/vnd.ms-excel"; break;
     case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
     case "gif": $ctype="image/gif"; break;
     case "png": $ctype="image/png"; break;
     case "jpeg":
     case "jpg": $ctype="image/jpg"; break;
     case "mp3": $ctype="audio/mpeg"; break;
     case "wav": $ctype="audio/x-wav"; break;
     case "mpeg":
     case "mpg":
     case "mpe": $ctype="video/mpeg"; break;
     case "mov": $ctype="video/quicktime"; break;
     case "avi": $ctype="video/x-msvideo"; break;

     //The following are for extensions that shouldn't be downloaded (sensitive 
stuff, like php files)
     case "php":
     case "htm":
     case "html":
     case "txt": die("<b>Cannot be used for ". $file_extension ." files!</b>"); 
break;

     default: $ctype="application/force-download";
   }

   //Begin writing headers
   header("Pragma: public");
   header("Expires: 0");
   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
   header("Cache-Control: public"); 
   header("Content-Description: File Transfer");
   
   //Use the switch-generated Content-Type
   header("Content-Type: $ctype");

   //Force the download
   $header="Content-Disposition: attachment; filename=".$filename.";";
   header($header );
   header("Content-Transfer-Encoding: binary");
   header("Content-Length: ".$len);
   @readfile($file);
   exit;
}

?>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""




--- End Message ---
--- Begin Message ---
Brian Dunning <mailto:[EMAIL PROTECTED]>
    on Thursday, March 17, 2005 4:45 PM said:

> Question: why didn't this work, is it supposed to work the way I was
> trying, and if not, then what is that domain variable there for???

Answer:
> Seems to me that browsers wouldn't allow this as it could
> create any number of security problems.


Nonetheless, I've never really used the domain option but I suspect it's
for sub-domains of sites you administer and not completely different
domains altogether.

Read here: http://wp.netscape.com/newsref/std/cookie_spec.html


HTH,
Chris.

--- End Message ---
--- Begin Message --- Brian Dunning wrote:
I've always known that you can specify a domain when you set a cookie,
and for kicks I experimented with a test page setting a cookie for the
yahoo.com. Seems to me that browsers wouldn't allow this as it could
create any number of security problems.

This is why the specification mentions, "Only hosts within the specified domain can set a cookie for a domain."


Question: why didn't this work, is it supposed to work the way I was
trying, and if not, then what is that domain variable there for?

It allows you to specify the domain for which the cookie is valid. When a browser makes a request, it checks for cookies to be included in the Cookie header. Only those that meet the requirements (domain, path, expiry, etc.) are included.


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--- End Message ---
--- Begin Message ---
I suspect it's
for sub-domains of sites you administer and not completely different
domains altogether.

If this is true, and it's not possible for a site to set a cookie for a completely different domain, then why do browsers have security options to allow or prevent this specific action? I'm thinking it must be possible, and that there's a reason for the domain option in setcookie() other than subdomains. Would just love to know how to make it work...


- Brian
--- End Message ---
--- Begin Message ---
on 3/17/05 6:32 PM, Brian Dunning at [EMAIL PROTECTED] wrote:

>> I suspect it's
>> for sub-domains of sites you administer and not completely different
>> domains altogether.
> 
> If this is true, and it's not possible for a site to set a cookie for a
> completely different domain, then why do browsers have security options
> to allow or prevent this specific action? I'm thinking it must be
> possible, and that there's a reason for the domain option in
> setcookie() other than subdomains. Would just love to know how to make
> it work...

The domain option exists in scripting implementations solely for the purpose
of sub domains.  It is not there to imply you can use it for more than one
domain, but to allow you to secure your sub domains.  If you set a cookie
for .example.com then test.example.com and *.example.com etc will be able to
read it.  This is not always what you want, in some cases, you may have
intranet.example.com and www.example.com and you would not want to set the
domain parameter to .example.com as that would allow one to read your
intranet cookies.

You will simply never make it work, it is designed to never allow this.
There has been one security issue I can think of to date that allowed it,
but it was patched promptly.

The day someone figured out how to set a cookie for amazon.com and read it
while under some other domain is the day all the news sites will be covering
that topic.

Cross domain cookies are indeed possible, look at microsoft.com, msn.com and
msnbc.com which indeed do share your cookies from one site to the next,
however, they do it by redirects and get/post methods, which is perfectly
legit since they control those domains.  No one outside someone with access
to those servers could implement it.

You are misinterpreting the prefs in browsers, they can not do what you ask.
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.

--- End Message ---
--- Begin Message ---
Where did the string come from?



Jim
PHP WebBlog =
http://www.litfuel.net/plush/


Diana Castillo wrote:
Does anyone know what kind of string encoding this is :
&reg&reg
mA&reg
and how can I decode this?


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




--- the forwarded message follows ---
========================================================================================
Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826)
========================================================================================
--- Begin Message ---
hello ..

dear webmaster i would like to ask few questions :
1. can php determine the mime type of file without uploading a file ??
2. if it can how is it ??


thanks very much

best regard's

wahyu sp
malang
indonesia
========================================================================================
Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826)
========================================================================================

--- End Message ---

--- End Message ---
--- Begin Message --- Wahyu SP wrote:




--- the forwarded message follows ---
========================================================================================


Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826)
========================================================================================


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

Subject:
can you help me ??
From:
"Wahyu SP" <[EMAIL PROTECTED]>
Date:
Wed, 16 Mar 2005 16:57:07 +0700
To:
[EMAIL PROTECTED]

To:
[EMAIL PROTECTED]


hello ..

dear webmaster i would like to ask few questions :
1. can php determine the mime type of file without uploading a file ??
of course not
2. if it can how is it ??

thanks very much

best regard's

wahyu sp
malang
indonesia
========================================================================================


Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826)
========================================================================================



--- End Message ---
--- Begin Message ---
Hi All,

 This is a very interesting website.

Visit www.lifenit.com

Also I can refer one more sebsite for you..

www.merchantii.com

Hope these were Useful.

Rgds,
 Freshersworld

First Job..... Dream Job.......  Freshersworld.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
What is with all the crap india programming sites spamming this list?

I for one, am not interested in web sites that are competing to take my clients. If I have to explain one more time why it is NOT better to pay less to deal with a company across the a few oceans versus' paying more for local services, I think I might scream.

Can't they just move to the US and take our jobs the old fashioned way. J/K

Stephen


On Mar 17, 2005, at 8:22 PM, freshersworld .com wrote:

Hi All,

 This is a very interesting website.

Visit www.lifenit.com

Also I can refer one more sebsite for you..

www.merchantii.com

Hope these were Useful.

Rgds,
 Freshersworld

First Job..... Dream Job.......  Freshersworld.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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


*********
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com

--continuing the struggle against bad code--
*********

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


Visit www.Merchantii.com




--- Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote:
> hi
> i use this code to send email from mysite
> but when it sends to some accounts it repeats the
> body part twice in
> the same email while to other accounts it sends the
> body one time only
> can anyone help in that plz ?
> 
> 
>       if ($email_to != "") {
>               $to = array();
>               $to = explode (",", $email_to);
>               $to_mum = count($email_to);
>               for ($i=0; $i<$to_mum ; $i++){
>                       $to_email = $to[$i];
>                       $subject = $email_subject;
>                       $body .= $HTTP_POST_VARS['message'];
>                       $body .= "\n---------------------------\n";
>                       $body .= "Article Name :";
>                       $body .= "\n---------------------------\n";
>                       $body .= $Article_Name;
>                       $body .= "\n---------------------------\n\n";           
>                       $body .= "\nStory :\n\n";
>                       $body .= $TheStory;                             
>                       $body .= "\n\n\n---------------------------\n";
>                       $body .= "Sent By: " .
> $HTTP_POST_VARS['email_address'] . "\n";
>                       $header = "From: " .
> $HTTP_POST_VARS['email_address'] . " <" .
> $HTTP_POST_VARS['email_address'] . ">\n";
>                       $header .= "Reply-To: " .
> $HTTP_POST_VARS['email_address'] . " <" .
> $HTTP_POST_VARS['email_address'] . ">\n";
>                       $header .= "X-Mailer: PHP/" . phpversion() .
> "\n";
>                       $header .= "X-Priority: 1";
>                       mail($to_email, $subject, $body, $header);
> 
> -- 
> Ahmed Abdel-Aliem
> Web Developer
> www.ApexScript.com
> 0101108551
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

First Job..... Dream Job.......  Freshersworld.com


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

--- End Message ---
--- Begin Message ---
Hello,
Just simple question (I think?)

How to pass return value from function to the main program?

Here's example:
do some code in funtion to set the $res value:

} elseif ($rightsid == $oik6) {
   $res = ok;
   return $res;
} elseif ($rightsid == $oik7) {
   $res = notok;
   return $res;
}

How can I get to use the  $res in the main program. The return $res; doesn't 
pass the variable to the main program right?

Thanks
-Will

--- End Message ---
--- Begin Message ---
I donot understand your problem clearly yet.
I think there must be a caller and a callee (called function) when we
talking about "passing arguments". That is to say, you write in your
main program:

...
echo calc($rs)."<br>";
...

and make sure there is a function named "calc":

function calc($rightsid){
...
if(...){
} elseif ($rightsid == $oik6) {
  $res = ok;
  return $res;
} elseif ($rightsid == $oik7) {
  $res = notok;
  return $res;
}
...
}

then the result calculated in the function would be passed to the
point you calling in your main program.

Certainly,"ok" and "notok", I think they should be boolean, as "true"
and "false". If you really write your code like that exactly, the two
words "ok" and "notok" wont have any effective meaning.

wish it helps to you.

On Fri, 18 Mar 2005 09:33:13 +0200, William Stokes <[EMAIL PROTECTED]> wrote:
> Hello,
> Just simple question (I think?)
> 
> How to pass return value from function to the main program?
> 
> Here's example:
> do some code in funtion to set the $res value:
> 
> } elseif ($rightsid == $oik6) {
>   $res = ok;
>   return $res;
> } elseif ($rightsid == $oik7) {
>   $res = notok;
>   return $res;
> }
> 
> How can I get to use the  $res in the main program. The return $res; doesn't
> pass the variable to the main program right?
> 
> Thanks
> -Will
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
           Sincerely,
                     Forest Liu(åäè)

--- End Message ---
--- Begin Message ---
Never mind I got it figured out. Had to set a global variable to make it 
visible.
Thanks anyway

-Will

"Forest Liu" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
I donot understand your problem clearly yet.
I think there must be a caller and a callee (called function) when we
talking about "passing arguments". That is to say, you write in your
main program:

...
echo calc($rs)."<br>";
...

and make sure there is a function named "calc":

function calc($rightsid){
...
if(...){
} elseif ($rightsid == $oik6) {
  $res = ok;
  return $res;
} elseif ($rightsid == $oik7) {
  $res = notok;
  return $res;
}
...
}

then the result calculated in the function would be passed to the
point you calling in your main program.

Certainly,"ok" and "notok", I think they should be boolean, as "true"
and "false". If you really write your code like that exactly, the two
words "ok" and "notok" wont have any effective meaning.

wish it helps to you.

On Fri, 18 Mar 2005 09:33:13 +0200, William Stokes <[EMAIL PROTECTED]> 
wrote:
> Hello,
> Just simple question (I think?)
>
> How to pass return value from function to the main program?
>
> Here's example:
> do some code in funtion to set the $res value:
>
> } elseif ($rightsid == $oik6) {
>   $res = ok;
>   return $res;
> } elseif ($rightsid == $oik7) {
>   $res = notok;
>   return $res;
> }
>
> How can I get to use the  $res in the main program. The return $res; 
> doesn't
> pass the variable to the main program right?
>
> Thanks
> -Will
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
           Sincerely,
                     Forest Liu(???) 

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: William Stokes
> Sent: 18/03/05 07:33
> 
> Hello,
> Just simple question (I think?)
> 
> How to pass return value from function to the main program?
> 
> Here's example:
> do some code in funtion to set the $res value:
> 
> } elseif ($rightsid == $oik6) {
>    $res = ok;
>    return $res;
> } elseif ($rightsid == $oik7) {
>    $res = notok;
>    return $res;
> }
> 
> How can I get to use the  $res in the main program. The return $res;
> doesn't 
> pass the variable to the main program right?

The return statement sets the value of the function call in the main
program, so you need to do something with the value of the function call to
use the return value.  For example:

   $is_ok = your_function($argument);

or

   echo your_function($argument);

Cheers!

Mike


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message ---
No...I think it is not a proper way to program.If you have programming
experiences with  any other language, you'll understand this
naturally.
The original purpose of making a function is tell it some arguments,
and you get a result. It should have the fewest relationship with the
environment which, just like "a global variable" for instance, outside
of it.
So, we should understand the relation between caller and callee(I make
this word) as your main program as your function.

...
 echo calc($rs)."<br>";//at this point,the function will work,and give a result.
 ...
 
//a function named "calc":
 
 function calc($rightsid){
 ...
 if(...){
 } elseif ($rightsid == $oik6) {
  $res = ok;
  return $res;
 } elseif ($rightsid == $oik7) {
  $res = notok;
  return $res;
 }
 ...
 }



On Fri, 18 Mar 2005 10:43:30 +0200, William Stokes <[EMAIL PROTECTED]> wrote:
> Never mind I got it figured out. Had to set a global variable to make it
> visible.
> Thanks anyway
> 
> -Will
> 
> "Forest Liu" <[EMAIL PROTECTED]> kirjoitti
> viestissÃ:[EMAIL PROTECTED]
> I donot understand your problem clearly yet.
> I think there must be a caller and a callee (called function) when we
> talking about "passing arguments". That is to say, you write in your
> main program:
> 
> ...
> echo calc($rs)."<br>";
> ...
> 
> and make sure there is a function named "calc":
> 
> function calc($rightsid){
> ...
> if(...){
> } elseif ($rightsid == $oik6) {
>  $res = ok;
>  return $res;
> } elseif ($rightsid == $oik7) {
>  $res = notok;
>  return $res;
> }
> ...
> }
> 
> then the result calculated in the function would be passed to the
> point you calling in your main program.
> 
> Certainly,"ok" and "notok", I think they should be boolean, as "true"
> and "false". If you really write your code like that exactly, the two
> words "ok" and "notok" wont have any effective meaning.
> 
> wish it helps to you.
> 
> On Fri, 18 Mar 2005 09:33:13 +0200, William Stokes <[EMAIL PROTECTED]>
> wrote:
> > Hello,
> > Just simple question (I think?)
> >
> > How to pass return value from function to the main program?
> >
> > Here's example:
> > do some code in funtion to set the $res value:
> >
> > } elseif ($rightsid == $oik6) {
> >   $res = ok;
> >   return $res;
> > } elseif ($rightsid == $oik7) {
> >   $res = notok;
> >   return $res;
> > }
> >
> > How can I get to use the  $res in the main program. The return $res;
> > doesn't
> > pass the variable to the main program right?
> >
> > Thanks
> > -Will
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
>           Sincerely,
>                     Forest Liu(???)
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
         Sincerely,
                   Forest Liu(åäè)

--- End Message ---
--- Begin Message ---
How from an html/web form I may go to a php script output(of form
values) ? I mean the programming for the result : 
 
A visitor to webpage-A.php when press submit of a webform go to a
webpage-B.php where as a php script uses the previous form data , and
for example there's output of these data the exactly words the visitor
enters ? 
 
May this done in MS-FrontPage2002 ? 
 
THE SCRIPT IN MS-FrontPage2002 HTML MODE NO EXECUTED BUT IS LIKE NO
EXIST , UNLIKE THE CODE HAS ALREADY SCRIPT COLOR IN HTML MODE OF
FRONTPAGE AND ALSO PHP SCRIPT FILE NAME xxx.php IS IN THE WEB FORM
PROPERTIES ? ... I INSERT PHP SCRIPT IN <SCRIPT> ..... </SCRIPT> TAGS ?
AND ALSO I TRY DELETE PHP SCRIPT INSERTING ONLY ONE COMMAND THE: 
<Script> 
echo "this operate till here"; 
</Script> 
BUT AGAIN THE SAME RESULT .... ? 
After press SUBMIT the php script file shows in address bar and all
viewed area is white (nothing on screen) ? 
 
Leonidas Savvides 
[EMAIL PROTECTED]
 

--- End Message ---
--- Begin Message ---
I donot know what happened in Frontpage. I just use Dreamweaver to
design the page layout, and then UltraEdit to add php code.

I think you are asking about the page submit. You can find the exact
example in the php manual, which can be obtained from php.net

a.php:
<form method=post action="b.php">
      <input name=usrinfo value="Input your info here">
      <input type=submit>
</form>

b.php:
echo "your input just now is:".$_POST[usrinfo];

it will work.

On Fri, 18 Mar 2005 10:38:45 +0200, Leonidas Savvides
<[EMAIL PROTECTED]> wrote:
> How from an html/web form I may go to a php script output(of form
> values) ? I mean the programming for the result :
> 
> A visitor to webpage-A.php when press submit of a webform go to a
> webpage-B.php where as a php script uses the previous form data , and
> for example there's output of these data the exactly words the visitor
> enters ?
> 
> May this done in MS-FrontPage2002 ?
> 
> THE SCRIPT IN MS-FrontPage2002 HTML MODE NO EXECUTED BUT IS LIKE NO
> EXIST , UNLIKE THE CODE HAS ALREADY SCRIPT COLOR IN HTML MODE OF
> FRONTPAGE AND ALSO PHP SCRIPT FILE NAME xxx.php IS IN THE WEB FORM
> PROPERTIES ? ... I INSERT PHP SCRIPT IN <SCRIPT> ..... </SCRIPT> TAGS ?
> AND ALSO I TRY DELETE PHP SCRIPT INSERTING ONLY ONE COMMAND THE:
> <Script>
> echo "this operate till here";
> </Script>
> BUT AGAIN THE SAME RESULT .... ?
> After press SUBMIT the php script file shows in address bar and all
> viewed area is white (nothing on screen) ?
> 
> Leonidas Savvides
> [EMAIL PROTECTED]
> 
> 


-- 
          Sincerely,
                    Forest Liu(åäè)

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

I need some help, this is my problem:

I use a custom errors handling class, which set one of its methods as the php errors handler.
All works well when I use this class in a file with only procedural code (all errors are caught by the custom errors handling class), but if I instantiate another class in this file, and in this class I have a error, this error is not caught by the custom errors handling class that I defined, instead is caught by the implicit php error handler.
My question is what can I do to make my custom error handling class catch all the errors, even if they are in another class that I have instantiated?


thanks,
Mihai

--- End Message ---
--- Begin Message ---
Hi all i am newbie,
 
I have a php code like this
 
<?php
 foreach($_SESSION['history'] as $item) {
     $item = str_replace(";","",$item);
     
     echo "<option >$item</option>";
     //echo "<option>$item</option>";
 }//foreach
?>
 
I want to set the color of the srting in $item.
Are there any PHP functions available.
 
Thanks
babu.
 

Send instant messages to your online friends http://uk.messenger.yahoo.com 

--- End Message ---
--- Begin Message ---
On Fri, 18 Mar 2005 09:42:13 +0000 (GMT), babu <[EMAIL PROTECTED]> wrote:
> Hi all i am newbie,
> 
> I have a php code like this
> 
> <?php
> foreach($_SESSION['history'] as $item) {
>     $item = str_replace(";","",$item);
> 
>     echo "<option >$item</option>";
>     //echo "<option>$item</option>";

If I understand your question, you are wanting to change the text
colour of an option item...

Do this with css classes...

Cheers

> }//foreach
> ?>
> 
> I want to set the color of the srting in $item.
> Are there any PHP functions available.
> 
> Thanks
> babu.
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>

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

Chris Ramsay <[EMAIL PROTECTED]> wrote:On Fri, 18 Mar 2005 09:42:13 +0000 
(GMT), babu wrote:
> Hi all i am newbie,
> 
> I have a php code like this
> 
> > foreach($_SESSION['history'] as $item) {
> $item = str_replace(";","",$item);
> 
> echo "$item";
> //echo "$item";

If I understand your question, you are wanting to change the text
colour of an option item...

Do this with css classes...

Cheers

> }//foreach
> ?>
> 
> I want to set the color of the srting in $item.
> Are there any PHP functions available.
> 
> Thanks
> babu.
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>

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



Send instant messages to your online friends http://uk.messenger.yahoo.com 

--- End Message ---
--- Begin Message ---
Babu,

Check out:
http://www.trans4mind.com/personal_development/StyleSheets/formElements.htm
or google
http://www.google.com/search?hl=en&q=option+text+colour&meta=

HTH

Chris

--- End Message ---
--- Begin Message ---
Hi chris,
 
i am using mssql and php, so i trying to get the query result when the user 
enters the query and submits the execute button.

i want to differentiate the syntactically correct query and the incorrect query 
with differ colors.

here i am posting my code
if (-1 == $connection) 
                 $result = mssql_query($query);// or die("Fehler beim Schreiben 
in die Datenbank");
               else
                 $result = mssql_query($query, $connection);// or die("Fehler 
beim Schreiben in die Datenbank");
               
                          if (!$result) {
          print "<p style=\"color:red;\">MS-SQL-Fehler: 
".mssql_get_last_message()."</p>\n";
          $error=1;  //my changes}

what i am trying to do is intialising a global variable "$error=0" and changing 
it to 1 if error occurs.

when displaying i am writing like this

foreach($_SESSION['history'] as $item) {
                 $item = str_replace(";","",$item);
                 if(error==0)
                 echo "<option >$item</option>";
                 else
                 echo "<option style=\"color: red;\">$item</option>";

but it doe not work can you pls tell me.


Chris Ramsay <[EMAIL PROTECTED]> wrote:Babu,

Check out:
http://www.trans4mind.com/personal_development/StyleSheets/formElements.htm
or google
http://www.google.com/search?hl=en&q=option+text+colour&meta=

HTH

Chris


Send instant messages to your online friends http://uk.messenger.yahoo.com 

--- End Message ---
--- Begin Message ---
Babu,

> but it doe not work can you pls tell me.

for example you can define 'red' as a css class either in the head of
your document output (within <style> tags) or as an external linked
.css document. 'red' is defined so:

.red {
        color:#FF0000;
}

Then your option html is like:

echo "<option class=\"red\">$item</option>";

The advantage of using classes is of course that you can make a change
globally rather than having to rewrite N instances of inline code.

Cheers

CHris 

p.s. can you please send plaintext mails to the list, not html ;)

--- End Message ---
--- Begin Message ---
Still strugglin through with the PHP stuff......

I keep getting a Warning: Missing argument 2 for check_zero() in 
c:\Inetpub\wwwroot\ecurry\order.php on line 5

if ($name == "andrea") {
$experience= 2;
$age= 24
check_zero($age, $experience);

}

This calls check which is at the very top of the page

function check($age, $experience){ // this is line 5

$total= $age * $experience;

if (total > 50) {
echo "you have enough experience";
   }
   }

What is the usual reason for this?

Thanks for your replies,

AD 

--- End Message ---
--- Begin Message ---
On Fri, 18 Mar 2005 10:15:08 -0000, AndreaD
<[EMAIL PROTECTED]> wrote:
> Still strugglin through with the PHP stuff......
> 
> I keep getting a Warning: Missing argument 2 for check_zero() in
> c:\Inetpub\wwwroot\ecurry\order.php on line 5
> 
> if ($name == "andrea") {
> $experience= 2;
> $age= 24

where's the semicolon @ the end of line 3?

> check_zero($age, $experience);
> 
> }
> 
> This calls check which is at the very top of the page
> 
> function check($age, $experience){ // this is line 5
> 
> $total= $age * $experience;
> 
> if (total > 50) {
> echo "you have enough experience";
>   }
>   }
> 
> What is the usual reason for this?
> 
> Thanks for your replies,
> 
> AD
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
Cheers...

--- End Message ---
--- Begin Message ---
Sorry, didn't actually answer your question!

Missing argument 2 for check_zero() in
> c:\Inetpub\wwwroot\ecurry\order.php on line 5

 means that you have not supplied all the neccessary arguments to the
function you are calling - is it check($arg1, $arg2) or
check_zero($arg1, $arg2)?...

CHeers


On Fri, 18 Mar 2005 10:21:00 +0000, Chris Ramsay <[EMAIL PROTECTED]> wrote:
> On Fri, 18 Mar 2005 10:15:08 -0000, AndreaD
> <[EMAIL PROTECTED]> wrote:
> > Still strugglin through with the PHP stuff......
> >
> > I keep getting a Warning: Missing argument 2 for check_zero() in
> > c:\Inetpub\wwwroot\ecurry\order.php on line 5
> >
> > if ($name == "andrea") {
> > $experience= 2;
> > $age= 24
> 
> where's the semicolon @ the end of line 3?
> 
> > check_zero($age, $experience);
> >
> > }
> >
> > This calls check which is at the very top of the page
> >
> > function check($age, $experience){ // this is line 5
> >
> > $total= $age * $experience;
> >
> > if (total > 50) {
> > echo "you have enough experience";
> >   }
> >   }
> >
> > What is the usual reason for this?
> >
> > Thanks for your replies,
> >
> > AD
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Cheers...
>

--- End Message ---
--- Begin Message --- Steven Altsman wrote:
Yes, the link is http://www.radinks.com/upload/config.php

file_uploads = On
upload_max_filesize = 40M
max_input_time = 9000 (seconds)
memory_limit (not limited, per handload config, from source)
max_execution_time = 9000 (seconds)
post_max_size = 40M

also, hidden INPUT tag MAX_FILE_SIZE with value="40000", which I'm guessing
needs it in kilobytes.

It's in bytes.

Check apache's config, namely LimitRequestBody directive.
--- End Message ---
--- Begin Message ---
Hi,
I wanted to know if there is some way to expose the full headers sent to a php page.
I found in google that for windows there is $_SERVER['ALL_HTTP'] to read all the headers sent but I'm using php on linux/apache.


There is any way to get in a variable the full headers sent to a page ?


Best regards, MARTIN

--- End Message ---
--- Begin Message ---
The $SERVER variable is an array, so try this:

<?
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>

regards Jesper

martin wrote:


Hi,
I wanted to know if there is some way to expose the full headers sent to a php page.
I found in google that for windows there is $_SERVER['ALL_HTTP'] to read all the headers sent but I'm using php on linux/apache.


There is any way to get in a variable the full headers sent to a page ?


Best regards, MARTIN


--

--- End Message ---
--- Begin Message --- Thanks for the answer,
what I'm trying to achieve is a php proxy that receives any GET/POST request with correspoding headers and brings back the results to the caller.


Let's say I do a google search request with curl:
// I would like all this to be sent by another page --- (header + xml)
$data ="soapreq.xml";
$handle = fopen ($data, "r");
$send = fread ($handle, filesize($data) );
fclose($handle);
$header[] ="MessageType:CALL";
$header[] ="Content-Type:text/xml";
// -------------------------------------- I don't know if what I want can be achieved this way, but maybe this explains better the idea.


$ch      = curl_init();
curl_setopt($ch, CURLOPT_URL,        "http://api.google.com/search/beta2";);
curl_setopt($ch, CURLOPT_POST,        1);
curl_setopt($ch, CURLOPT_POSTFIELDS,    $send);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);

$data = curl_exec($ch);




Best regards, MARTIN

Jesper Goos wrote:

The $SERVER variable is an array, so try this:

<?
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>

regards Jesper

martin wrote:


Hi,
I wanted to know if there is some way to expose the full headers sent to a php page.
I found in google that for windows there is $_SERVER['ALL_HTTP'] to read all the headers sent but I'm using php on linux/apache.


There is any way to get in a variable the full headers sent to a page ?


Best regards, MARTIN



--- End Message ---
--- Begin Message ---
Jesper Goos wrote:

The $SERVER variable is an array, so try this:

<?
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>

regards Jesper

martin wrote:


Hi,
I wanted to know if there is some way to expose the full headers sent to a php page.
I found in google that for windows there is $_SERVER['ALL_HTTP'] to read all the headers sent
never seen that one before... maybe only on (crappy) IIS?

but I'm using php on linux/apache.

I don't think PHP exposes any headers "just like that", you need to fetch them in a specific way. As of PHP 5, you can use get_headers(), or with Apache & PHP 4.3.0+, you can use apache_request_headers() and apache_response_headers()
There is any way to get in a variable the full headers sent to a page ?


Best regards, MARTIN



--- End Message ---
--- Begin Message --- Hi there I am building a syndicate feed system for a client, it is based on referer checking and a id is passed over, I could do what I do with the expired url and generate a random string of some sort to login the user automatically, but then it relies on the third party to have php. I have tested with a referer spoofing app, and its true, it will still let you through if you end up putting in the correct referring domain which is join via the database. Is there another way around this ?
--- End Message ---
--- Begin Message ---
I have an unexpected and perplexing problem.
PHP's mail() function is base64 encoding all message bodies as an
ill-formed MIME attachment resulting in the recipient seeing an
uninteligable base64 encoded string. This only happens to my account
with my host and neither I or the sysadmin can see why as there are no
special configuration settings for me. The host is running PHP4.3.10.

Here's what is happening:
This code
<?php
mail ( "[EMAIL PROTECTED]", "test script", "Foo!", ""); 
?>

Results in this mail being recieved.

(message starts here)
Delivered-To: [EMAIL PROTECTED]

<snip all the SMTP Recieved: headers for clarity/>

To: [EMAIL PROTECTED]
Subject: test script
Message-Id: <[EMAIL PROTECTED]>
Date: Fri, 18 Mar 2005 10:33:06 +0000 (GMT)
From: [EMAIL PROTECTED] (httpd)

Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64

Rm9vIQ==
(message ends here)

On every other PHP host I've used I would have expected a simple
string "Foo!" instead of the Mime-version stuff and the base64 encoded
string.

I'm sure I can get round this if I have to by using one of the PHP
mail classes that are out there. But I'd prefer not to as one of the
pieces of software I'm using is commercial and if I alter it I'll
invalidate my support for it.
Has anyone else seen this problem? I'd be interested to know what's happening.
John W. List

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

I have a following line in my code to set a session cookie when user logs 
in. It works fine.
setcookie("sess_id","$sess_id",0,"/");

Can I store more information to the session cookie? I mean other variables. 
Like I tried it like this with no success.
setcookie("sess_id","$sess_id",$another_variable,0,"/");

Thanks
-Will

--- End Message ---

Reply via email to