php-general Digest 29 Jul 2001 14:21:49 -0000 Issue 784

Topics (messages 60084 through 60100):

Re: Stripping single quotes
        60084 by: Matt Stone

automatic deallocation
        60085 by: Erick Calder

END block
        60086 by: Erick Calder
        60087 by: Philip Murray

VERY   URGENT
        60088 by: edwardnike louis

Re: Sessions Question
        60089 by: Rasmus Lerdorf

:(
        60090 by: LDL Enterprise
        60091 by: Erick Calder

Re: Oh and addition to "Emailing Files"
        60092 by: B. van Ouwerkerk

PHP4, Flash and tab characters
        60093 by: Nolan
        60094 by: Tim

limiting lines
        60095 by: dan
        60096 by: James, Yz

return value from recursive function
        60097 by: Jaskirat
        60098 by: Dave
        60100 by: Rainer Rosenberger

Get Operating System
        60099 by: Rainer Rosenberger

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]


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


Thanks for your help everyone, I feel pretty embarrassed to have made a
mistake like that! :o

-----Original Message-----
From: Bojan Gajic [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 29 July 2001 12:44 AM
To: Matt Stone
Subject: Re: [PHP] Stripping single quotes



you are not assigning stripslashes($fldemail) to the $fldemail, you are
maching
them. use '=' instead of  '= ='

hth,
bojan


Matt Stone wrote:

> Darn, it still 'aint working. Ok, let's say $fldemail contains
> "o\'[EMAIL PROTECTED]"
> I then run these:
> $fldemail == stripslashes($fldemail);
> $fldemail == ereg_replace("'","",$fldemail);
> And I get "o\'[EMAIL PROTECTED]" ... damn.
>
> Any ideas? Thanks,
>
> Matt Stone
>
> -----Original Message-----
> From: Chris Fry [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, 28 July 2001 2:15 PM
> To: Matt Stone
> Cc: PHP list
> Subject: Re: [PHP] Stripping single quotes
>
> Matt,
>
> Try ereg_replace:-
>
> $fldemail == ereg_replace("'","",$fldemail);
>
> Chris
>
> Matt Stone wrote:
>
> > Hi all,
> > I am trying to validate some email addresses before they are entered
into
> > the database.
> > The problem is, some thick or malicious people are entering single
quotes
> > into their email addresses.
> > I need to strip out all these single quotes but a little ole'
str_replace
> > doesn't seem to be working.
> > Here it is:
> >
> > $fldemail == str_replace("'","",$fldemail);
> >
> > Nice and basic :)
> > Can anyone please enlighten me on this?
> > Thanks in advance,
> >
> > Matt Stone
> >
> > --
> > 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]
>
> --
>
> Chris Fry
> Quillsoft Pty Ltd
> Specialists in Secure Internet Services and E-Commerce Solutions
> 10 Gray Street
> Kogarah
> NSW  2217
> Australia
>
> Phone: +61 2 9553 1691
> Fax: +61 2 9553 1692
> Mobile: 0419 414 323
> eMail: [EMAIL PROTECTED]
> http://www.quillsoft.com.au
>
> You can download our Public CA Certificate from:-
> https://ca.secureanywhere.com/htdocs/cacert.crt
>
> **********************************************************************
>
> This information contains confidential information intended only for
> the use of the authorised recipient.  If you are not an authorised
> recipient of this e-mail, please contact Quillsoft Pty Ltd by return
> e-mail.
> In this case, you should not read, print, re-transmit, store or act
> in reliance on this e-mail or any attachments, and should destroy all
> copies of them.
> This e-mail and any attachments may also contain copyright material
> belonging to Quillsoft Pty Ltd.
> The views expressed in this e-mail or attachments are the views of
> the author and not the views of Quillsoft Pty Ltd.
> You should only deal with the material contained in this e-mail if
> you are authorised to do so.
>
> This notice should not be removed.
>
> --
> 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]






I've searched through the manuals and newsgroups but haven't found an
answer.  maybe someone on this list can tell me whether PHP will
automatically de-allocate filehandles and database connections upon script
termination?  i.e. do I always need to call fclose() and mysql_close()
before the script ends when I've called fsockopen() and mysql_connect()?

thx - e





is there an equivalent to Perl's END block? i.e some way to automatically
run certain code when a page is about to end?

1k thx - e





Hi Erick, 

It's all in the manual...

http://php.net/manual/en/function.register-shutdown-function.php

Cheers

-------------------------------- -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
------------- -  -- -   -

----- Original Message ----- 
From: "Erick Calder" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Sunday, July 29, 2001 3:50 PM
Subject: [PHP] END block


> is there an equivalent to Perl's END block? i.e some way to automatically
> run certain code when a page is about to end?
> 
> 1k thx - e
> 
> 
> -- 
> 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]
> 
> 





Mr. Robert Harvesy,
5 – 8 Milton Obote,
Avenue BLED
Kinshasha,
Congo – Zaire,
 
 Sir,
                         
I got your contact from the Internet and I know that
this letter will come to you as a big surprise but
don’t ignore it. The profit will not only be for you
but for generations, this matter is very  important 
and  needs utmost  trust  and  confidence.
 
I  am  Mr. Robert Harvesy, a business consultant
and a close confidant  of former most powerful
first family in Zaire, now Democratic Republic  of
Congo.
  
The former first lady told me that they have lost
their oil wells and their gold mines have been shut
down and confiscated by the new government and
they don’t want to loose their cash again.
 
The family wishes to move out of the country the sum
of US$168 million  [ one hundred and sixty eight
million United states Dollars]  she wants to nvestthe 
aforementioned  sum  in  viable  businesses 
overseas.
  
My client does not wish to place this fund with
established financial institutions in the family's
name for security reasons.  It is her desire that
thedeal be handled as quietly as possible without
possibility of any leakage to the public or
government.  She has therefore instructed and
empowered me to look for a reliable foreigner who
can arrange and receive this money in his account
overseas and assist to invest the fund properly for
the
family.
  
If you know that you are capable and have the
facilities to handle this large amount or knows a
trusted friend or organizations who can handle this
project in strict confidence, my client is willing
to give you and such entity  25%  of  the total sum 
received on behalf of the family for overseas
investments.    
 
To  act  as  a fund  manager  for my  client  and 
her  family  in overseas  I  shall  release  the  sum 
of  US$168 million [one hundred and sixty eight
million]  to you  if  you  meet  my  requirements. 
The  money  is  available  in  cash  in  a  safe 
trunk deposited with a security company,  and  upon  a
 favorable  response  from you,  I  shall  let  you 
know  how you shall receive it.
  
Your  commission  shall  be   25% of  the  total 
sum,  and  an  annual  10%  of  theafter  tax  returns
 on  investment  for  the first five  years. 
Thereafter,  the  terms  shall  bevaried.
  
Sir,  if  you  are  capable  and reliable,  reach 
me  by  email address soonest.
  
Best  regards,

Robert Harvesy
 


_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca




> session_register("$refresh");
> session_register("$seconds");
> session_register("$title");

You probably want to remove the $ signs in the above.

-Rasmus





     I cannot figure out why this button does not work any suggestions
are appreciated. Thanks. 




$table = "inventory";
$sql = "SELECT * FROM $table where category='$category'";
$result = mysql_query($sql);
   
while ($myrow = mysql_fetch_array($result))
{ 
printf("<tr><td border=1 bgcolor=#A0AAB9><font face=Lucida Sans Unicode
size=4><form><input type=button value=%s
onclick=javascript:window.open('view_pict.php?picture_id=%s.gif','MyWind
ow','width=450,height=600,menubar=no,scrollbars=yes,toolbar=no,location=
no,directories=no,resizable=yes,top=0,left=0')></form></font></td></tr>
\n", $myrow["product"], $myrow["product"]);
} 





your code works for me.  it would be helpful to know how your code doesn't
work. does it pop the window at all?

couple of suggestions: use "onClick" instead of "onclick" - if I recall
correctly case matters in Javascript event names depending on your browser.
also, you don't need to use the "javascript:" specifier within event
handlers.  additionally you might want to quote the handler code.

- e

-----Original Message-----
From:   LDL Enterprise [mailto:[EMAIL PROTECTED]]
Sent:   Sunday, July 29, 2001 12:48 AM
To:     *PHP-General mail list
Subject:        [PHP] :(

     I cannot figure out why this button does not work any suggestions
are appreciated. Thanks.




$table = "inventory";
$sql = "SELECT * FROM $table where category='$category'";
$result = mysql_query($sql);

while ($myrow = mysql_fetch_array($result))
{
printf("<tr><td border=1 bgcolor=#A0AAB9><font face=Lucida Sans Unicode
size=4><form><input type=button value=%s
onclick=javascript:window.open('view_pict.php?picture_id=%s.gif','MyWind
ow','width=450,height=600,menubar=no,scrollbars=yes,toolbar=no,location=
no,directories=no,resizable=yes,top=0,left=0')></form></font></td></tr>
\n", $myrow["product"], $myrow["product"]);
}


--
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]





At 01:37 29-7-01 -0700, you wrote:
>email the file

Read the manual:
http://www.php.net/manual/en/function.mail.php

Bye,


B.






>-legokiller666-
>http://www.StupeedStudios.f2s.com
>New address.... new site
>
>ICQ: 115852509
>MSN: [EMAIL PROTECTED]
>AIM: legokiller666
>
>
>----- Original Message -----
>From: "B. van Ouwerkerk" <[EMAIL PROTECTED]>
>To: "Kyle Smith" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Saturday, July 28, 2001 3:09 PM
>Subject: Re: [PHP] Oh and addition to "Emailing Files"
>
>
> > At 22:15 28-7-01 -0700, Kyle Smith wrote:
> > >Also how do i make it so that when it sends the email the picture is an
> > >attatchment?
> >
> > I just don't get it anymore. First you ask about uploading files and now
> > about sending files as attachment?? And this second (this) mail is
>supposed
> > to make something clear??
> >
> > Please explain what you want to do. Upload or send them via e-mail.. You
> > subject is emailing files..
> >
> > Browsing a few PHP helpsites should make everything more clear. Both
> > subject can be found on that kind of website..
> >
> > Bye,
> >
> >
> > B.
> >
> >





Hi all,

Apologies if this has been asked before, I'm new here.  I've got a PHP
script that's returning a formatted string of variables to a Flash movie.
The string getting returned looks like so (currently it's just the 1 variable):

&bAcquired=Y

Flash's debugger seems to think that there is a tab character after the
'Y', so in the debugger, the variable bAcquired looks like so:

Y\t

I've done everything I can think of on the PHP side to make sure that's not
happening there.  Perhaps it's some sort of buffer-padding that the server
does before sending text back to Flash?  I'm looking into more things now,
but wanted to ask here and see if anyone else has had this happen?  The
usual flush(), chop() or trim() functions don't seem to be helping.  Any
other ideas?

Thanks in advance,
Nolan
[EMAIL PROTECTED]







Change your output string to look like

&bAcquired=Y&

and you should be ok.

You may find as you get further into this that you need a delay loop to
make sure that flash has read all of your data, since it happens
asychronously (at least in Flash 4 it did) so you'll want a sentinel
value at the end:

&bAcquired=Y&ok=1&

in the flash movie, set ok=0 and wait/loop until you see ok=1 and you'll
know the data reading is complete.   (This may have been fixed in Flash
5, but I haven't tested it).

- Tim
  http://www.phptemplates.org

> The string getting returned looks like so (currently it's just the 1 variable):
> 
> &bAcquired=Y
> 
> Flash's debugger seems to think that there is a tab character after the
> 'Y', so in the debugger, the variable bAcquired looks like so:
> 
> Y\t






Hi,

I would like to run a variable of unlimited length through a filter that
would limit its length to 55 lines (ie limiting it's length to less than 1
printed page).  Does anyone know of an easy way to do this?

thanks.

Regards,

Dan Barber
Mojolin
 
---------------
Mojolin: The Open Source/Linux Employment Site
http://www.mojolin.com






Hiya Dan,

If you're expecting new lines, you could do this:

$length = explode("\n", $message);

if (sizeof($length) > 55) {
    // error
}

And also limit the number of characters, using strlen()

James

"Dan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I would like to run a variable of unlimited length through a filter that
> would limit its length to 55 lines (ie limiting it's length to less than 1
> printed page).  Does anyone know of an easy way to do this?
>
> thanks.
>
> Regards,
>
> Dan Barber
> Mojolin
>
> ---------------
> Mojolin: The Open Source/Linux Employment Site
> http://www.mojolin.com
>
>






Hi,
How to get return value from a recursive function .. here is the test code 
which I was trying

<?
function abc_recurse()
{
        static $i = 1;
        echo $i;
        $i++;
        if ($i == 4) return ("xyz");
        abc_recurse();

}

$returnvalue = abc_recurse();
echo $returnvalue;

?>
Its printing "123" where as I was expecting "123xyz"
what is happening to $returnvalue

TIA
Jaski





maybe it is just me and my preferred syntax/style...

        if ($i < 4) {
                abc_recurse();
        }
        return 'xyz';  # NOTICE REMOVED ()'s

Did not look to closely at your shortcut symantics to verify legitimacy
Also, unless I am mistaken, people generally advise against having a function do
output.  A more appropriate syntax might be

<?
function abc_recurse($r) {
        global $r;
        static $i = 1;
        $r.=$i;
        $i++;
        if ($i < 4) {
                abc_recurse($r);
        }
        return $r.'xyz';
}
$returnvalue = abc_recurse(0);
echo $returnvalue;
?>

messy but a quick example.

>-----Original Message-----
>From: Jaskirat [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, July 29, 2001 8:47 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP] return value from recursive function
>
>
>Hi,
>How to get return value from a recursive function .. here is the test code
>which I was trying
>
><?
>function abc_recurse()
>{
>       static $i = 1;
>       echo $i;
>       $i++;
>       if ($i == 4) return ("xyz");
>       abc_recurse();
>
>}
>
>$returnvalue = abc_recurse();
>echo $returnvalue;
>
>?>
>Its printing "123" where as I was expecting "123xyz"
>what is happening to $returnvalue
>
>TIA
>Jaski
>
>
>--
>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,

your call to abc_recurse returns the return value of the FIRST call. You
forgot to pass the result back to the calling funtions (below corrected
code).

<?php

function abc_recurse($imax) {
 static $i=1;
 if ($i == $imax) {
  return "xyz";
 } else {
       $i++;
     return abc_recurse($imax);
 }
}
 echo "\n\nFinal Return:" .  abc_recurse(4);
?>

Regards
--

Rainer Rosenberger
__________________________________________________________
NetAktiv, Beratung & Realisierung
Dr. Rainer Rosenberger, Fürholzer Weg 6b, D-85375 Neufahrn
Fon:+49 8165 66506, Fax:+49 8165 66507, Mobil:+49 172 7789381
mailto:[EMAIL PROTECTED] http://www.NetAktiv.de/
__________________________________________________________


"Jaskirat" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
> How to get return value from a recursive function .. here is the test code
> which I was trying
>
> <?
> function abc_recurse()
> {
> static $i = 1;
> echo $i;
> $i++;
> if ($i == 4) return ("xyz");
> abc_recurse();
>
> }
>
> $returnvalue = abc_recurse();
> echo $returnvalue;
>
> ?>
> Its printing "123" where as I was expecting "123xyz"
> what is happening to $returnvalue
>
> TIA
> Jaski
>






I tried to detect the Web-Servers operating system. Under Windows it's easy
to read the environment variable "OS" (or one of the relatet Server
Varaibles). Under Linux I found the following very strange behaviour:

system("echo \$OSTYPE") correctly returns "linux-gnu" whereas
getenv("OSTYPE") returns nothing

Any idea why the simple getenv-solution does not work. Any simpler solution
than calling the shell "echo"?

Regards
--

Rainer Rosenberger
__________________________________________________________
NetAktiv, Beratung & Realisierung
Dr. Rainer Rosenberger, Fürholzer Weg 6b, D-85375 Neufahrn
Fon:+49 8165 66506, Fax:+49 8165 66507, Mobil:+49 172 7789381
mailto:[EMAIL PROTECTED] http://www.NetAktiv.de/
__________________________________________________________






Reply via email to