php-windows Digest 9 Aug 2004 21:29:33 -0000 Issue 2353

Topics (messages 24363 through 24372):

Re: file self check
        24363 by: Ignatius Reilly
        24365 by: Ragnar

Connecting to a database
        24364 by: PHP MySQL
        24370 by: Nadim Attari

optional function parameters
        24366 by: Ragnar
        24369 by: Henrik Hornemann
        24371 by: Nadim Attari

T_VARIABLE???
        24367 by: Dylan Barber
        24368 by: Dylan Barber

Passing arrays by reference
        24372 by: Jim MacDiarmid

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 ---
You could store a table or a text file associating to each script its MD5
hash string.
check the PHP md5() function

_________________________
----- Original Message -----
From: "Ragnar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 09, 2004 8:09 AM
Subject: [PHP-WIN] file self check


> Hi everyone,
>
> I was just wondering how one would write a php script that would check
> itself, if it has been tempered with before running, and if it has would
not
> work.
>
> I have seen Perl scripts that work in such a why, that is you edit only 1
> char in the file and it will not run anymore, but I couldn't figure out
> how that was done.
>
> Anyone ever done this with PHP before? Is it even possible?
>
> cheers,
>
> Ben
>
> --
> NEU: WLAN-Router f�r 0,- EUR* - auch f�r DSL-Wechsler!
> GMX DSL = superg�nstig & kabellos http://www.gmx.net/de/go/dsl
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
If you put that in the file itself, there is not much point though?

If I do say: 

  if (md5($_SERVER['PHP_SELF'])<>'asda8sd6asd7'){ ...


Anyone with access to the file could just comment that out and the script
self check wouldn't work.

I have honestly no idea how that pearl file did it, but
you couldn't edit it without breaking it.

> You could store a table or a text file associating to each script its MD5
> hash string.
> check the PHP md5() function
> 
> _________________________
> ----- Original Message -----
> From: "Ragnar" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 09, 2004 8:09 AM
> Subject: [PHP-WIN] file self check
> 
> 
> > Hi everyone,
> >
> > I was just wondering how one would write a php script that would check
> > itself, if it has been tempered with before running, and if it has would
> not
> > work.
> >
> > I have seen Perl scripts that work in such a why, that is you edit only
> 1
> > char in the file and it will not run anymore, but I couldn't figure out
> > how that was done.
> >
> > Anyone ever done this with PHP before? Is it even possible?
> >
> > cheers,
> >
> > Ben
> >
> > --
> > NEU: WLAN-Router f�r 0,- EUR* - auch f�r DSL-Wechsler!
> > GMX DSL = superg�nstig & kabellos http://www.gmx.net/de/go/dsl
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
NEU: WLAN-Router f�r 0,- EUR* - auch f�r DSL-Wechsler!
GMX DSL = superg�nstig & kabellos http://www.gmx.net/de/go/dsl

--- End Message ---
--- Begin Message ---
hi list,
 
   I am given a task to connect to a database and display the info there onto the Web. 
So that whatever changes are made in the database...my web page will also show the 
newly changed data. I am planning to try doing this using PHP but as i am new to 
php...i don't know how to go about doing this. I am in the process of learning php and 
i am using a book called"Beginning php4". But i was wondering if any of u guys would 
tell me how it could be done and how i should get started in it.
 
I am sorry if the answer is already in the list..i searched through it but couldn't 
get my desired answer.
 
Thanks..
penjo

Yahoo! India Matrimony: Find your life partneronline.

--- End Message ---
--- Begin Message ---
http://www.hkvstore.com/phpmaker/

--- End Message ---
--- Begin Message ---
Hi guys,

another quick one. I was wondering what you'd have to do 
with a function, so it would be able to have 'optional' parameters
when calling it.

much like:

string substr ( string string, int start [, int length])

where you can just omit the [, in length] part if you want.
What do you have to do in your own functions to allow for
something like that ?

cheers,

Ben

-- 
NEU: WLAN-Router f�r 0,- EUR* - auch f�r DSL-Wechsler!
GMX DSL = superg�nstig & kabellos http://www.gmx.net/de/go/dsl

--- End Message ---
--- Begin Message ---
Very easy, check out 
http://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list

Regards Henrik Hornemann 

-----Oprindelig meddelelse-----
Fra: Ragnar [mailto:[EMAIL PROTECTED] 
Sendt: 9. august 2004 10:59
Til: [EMAIL PROTECTED]
Emne: [PHP-WIN] optional function parameters


Hi guys,

another quick one. I was wondering what you'd have to do with a function, so it would 
be able to have 'optional' parameters when calling it.

much like:

string substr ( string string, int start [, int length])

where you can just omit the [, in length] part if you want.
What do you have to do in your own functions to allow for something like that ?

cheers,

Ben

--
NEU: WLAN-Router f�r 0,- EUR* - auch f�r DSL-Wechsler!
GMX DSL = superg�nstig & kabellos http://www.gmx.net/de/go/dsl

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

--- End Message ---
--- Begin Message ---
> another quick one. I was wondering what you'd have to do
> with a function, so it would be able to have 'optional' parameters
> when calling it.
>
> much like:
>
> string substr ( string string, int start [, int length])
>
> where you can just omit the [, in length] part if you want.
> What do you have to do in your own functions to allow for
> something like that ?

<?php

    function myFunction ($argOne, $argTwo = 'defaultTwo', $argThree =
'defaultThree')
    {
        echo '$argOne: ' . $argOne . ' - ';
        if ($argTwo == 'defaultTwo')
            echo 'probably $argTwo was not provided - ';
        else
            '$argTwo : ' . $argTwo . ' - ';
        if ($argThree == 'defaultThree')
            echo 'probably $argThree was not provided - ';
        else
            '$argThree : ' . $argThree . '<br>';
    }

myFunction ('One' , 'Two', 'Three');
myFunction ('One' , 'Two', '');
myFunction ('One' , '', '');
myFunction ('' , '', '');

myFunction ('One' , 'Two');
myFunction ('One');
?>

--- End Message ---
--- Begin Message ---
I get a parse error and maybe its just me but I cant see what I am doing
wrong maybe someone could cut through my c**p and tell me 
error:
 
Parse error: parse error, unexpected T_VARIABLE in
/hsphere/local/home/dancing/dancingdivaz.net/development_side/layout/code/fu
nctions_video.php on line 41

code (first line is line 41):
 
$var_result = '<object id="mediaPlayer" width="580" height="480"
  classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
 
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.
cab#Version=5,1,52,701"  
  standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
      <param name="AudioStream" value="-1">
      <param name="AutoSize" value="0">
      <param name="AutoStart" value="-1">
      <param name="AnimationAtStart" value="-1">
      <param name="AllowScan" value="-1">
      <param name="AllowChangeDisplaySize" value="-1">
      <param name="AutoRewind" value="0">
      <param name="Balance" value="0">
      <param name="BaseURL" value>
      <param name="BufferingTime" value="3">
      <param name="CaptioningID" value>
      <param name="ClickToPlay" value="-1">
      <param name="CursorType" value="0">
      <param name="CurrentPosition" value="-1">
      <param name="CurrentMarker" value="0">
      <param name="DefaultFrame" value>
      <param name="DisplayBackColor" value="0">
      <param name="DisplayForeColor" value="16777215">
      <param name="DisplayMode" value="0">
      <param name="DisplaySize" value="4">
      <param name="Enabled" value="-1">
      <param name="EnableContextMenu" value="-1">
      <param name="EnablePositionControls" value="-1">
      <param name="EnableFullScreenControls" value="0">
      <param name="EnableTracker" value="-1">
      <param name="Filename" value="videos/' . $row[StageName] . '/' .
$row[VideoPreview] . '">
      <param name="InvokeURLs" value="-1">
      <param name="Language" value="-1">
      <param name="Mute" value="0">
      <param name="PlayCount" value="1">
      <param name="PreviewMode" value="0">
      <param name="Rate" value="1">
      <param name="SAMILang" value>
      <param name="SAMIStyle" value>
      <param name="SAMIFileName" value>
      <param name="SelectionStart" value="-1">
      <param name="SelectionEnd" value="-1">
      <param name="SendOpenStateChangeEvents" value="-1">
      <param name="SendWarningEvents" value="-1">
      <param name="SendErrorEvents" value="-1">
      <param name="SendKeyboardEvents" value="0">
      <param name="SendMouseClickEvents" value="0">
      <param name="SendMouseMoveEvents" value="0">
      <param name="SendPlayStateChangeEvents" value="-1">
      <param name="ShowCaptioning" value="0">
      <param name="ShowControls" value="-1">
      <param name="ShowAudioControls" value="-1">
      <param name="ShowDisplay" value="0">
      <param name="ShowGotoBar" value="0">
      <param name="ShowPositionControls" value="-1">
      <param name="ShowStatusBar" value="-1">
      <param name="ShowTracker" value="-1">
      <param name="TransparentAtStart" value="0">
      <param name="VideoBorderWidth" value="0">
      <param name="VideoBorderColor" value="0">
      <param name="VideoBorder3D" value="0">
      <param name="Volume" value="-600">
      <param name="WindowlessVideo" value="0"><embed
type="application/x-mplayer2"
pluginspage="http://microsoft.com/windows/mediaplayer/en/download/";
src="http://206.165.14.34/ml/bKEQC7o6BNtbsDriFQSR/HFLS/v-hfls022.wmv";
name="mediaPlayer" width="320" height="266" autostart="1" displaysize="4"
autosize="0" bgcolor="darkblue" showcontrols="0" showtracker="0"
showstatusbar="1" showdisplay="0" videoborder3d="0" designtimesp="5311"
loop="0">
    </object>';
 
 return $var_result;
Dylan Barber

 
<file:///C:/Documents%20and%20Settings/Dylan/Application%20Data/Microsoft/Si
gnatures/www.codegalaxy.com> www.codegalaxy.com - A webservices company 

DotNetNuke Portal  Specialists

Simple Affordable & Reliable - Web Design, and Programming 

 

--- End Message ---
--- Begin Message ---
Nevermind I found it

Dylan Barber

www.codegalaxy.com - A webservices company 

DotNetNuke Portal  Specialists

Simple Affordable & Reliable - Web Design, and Programming 

 

> -----Original Message-----
> From: Dylan Barber [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 09, 2004 4:24 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] T_VARIABLE??? 
> 
> I get a parse error and maybe its just me but I cant see what 
> I am doing wrong maybe someone could cut through my c**p and tell me
> error:
>  
> Parse error: parse error, unexpected T_VARIABLE in 
> /hsphere/local/home/dancing/dancingdivaz.net/development_side/
> layout/code/fu
> nctions_video.php on line 41
> 
> code (first line is line 41):
>  
> $var_result = '<object id="mediaPlayer" width="580" height="480"
>   classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
>  
> codebase="http://activex.microsoft.com/activex/controls/mplaye
> r/en/nsmp2inf.
> cab#Version=5,1,52,701"  
>   standby="Loading Microsoft Windows Media Player components..."
> type="application/x-oleobject">
>       <param name="AudioStream" value="-1">
>       <param name="AutoSize" value="0">
>       <param name="AutoStart" value="-1">
>       <param name="AnimationAtStart" value="-1">
>       <param name="AllowScan" value="-1">
>       <param name="AllowChangeDisplaySize" value="-1">
>       <param name="AutoRewind" value="0">
>       <param name="Balance" value="0">
>       <param name="BaseURL" value>
>       <param name="BufferingTime" value="3">
>       <param name="CaptioningID" value>
>       <param name="ClickToPlay" value="-1">
>       <param name="CursorType" value="0">
>       <param name="CurrentPosition" value="-1">
>       <param name="CurrentMarker" value="0">
>       <param name="DefaultFrame" value>
>       <param name="DisplayBackColor" value="0">
>       <param name="DisplayForeColor" value="16777215">
>       <param name="DisplayMode" value="0">
>       <param name="DisplaySize" value="4">
>       <param name="Enabled" value="-1">
>       <param name="EnableContextMenu" value="-1">
>       <param name="EnablePositionControls" value="-1">
>       <param name="EnableFullScreenControls" value="0">
>       <param name="EnableTracker" value="-1">
>       <param name="Filename" value="videos/' . $row[StageName] . '/' .
> $row[VideoPreview] . '">
>       <param name="InvokeURLs" value="-1">
>       <param name="Language" value="-1">
>       <param name="Mute" value="0">
>       <param name="PlayCount" value="1">
>       <param name="PreviewMode" value="0">
>       <param name="Rate" value="1">
>       <param name="SAMILang" value>
>       <param name="SAMIStyle" value>
>       <param name="SAMIFileName" value>
>       <param name="SelectionStart" value="-1">
>       <param name="SelectionEnd" value="-1">
>       <param name="SendOpenStateChangeEvents" value="-1">
>       <param name="SendWarningEvents" value="-1">
>       <param name="SendErrorEvents" value="-1">
>       <param name="SendKeyboardEvents" value="0">
>       <param name="SendMouseClickEvents" value="0">
>       <param name="SendMouseMoveEvents" value="0">
>       <param name="SendPlayStateChangeEvents" value="-1">
>       <param name="ShowCaptioning" value="0">
>       <param name="ShowControls" value="-1">
>       <param name="ShowAudioControls" value="-1">
>       <param name="ShowDisplay" value="0">
>       <param name="ShowGotoBar" value="0">
>       <param name="ShowPositionControls" value="-1">
>       <param name="ShowStatusBar" value="-1">
>       <param name="ShowTracker" value="-1">
>       <param name="TransparentAtStart" value="0">
>       <param name="VideoBorderWidth" value="0">
>       <param name="VideoBorderColor" value="0">
>       <param name="VideoBorder3D" value="0">
>       <param name="Volume" value="-600">
>       <param name="WindowlessVideo" value="0"><embed 
> type="application/x-mplayer2"
> pluginspage="http://microsoft.com/windows/mediaplayer/en/download/";
> src="http://206.165.14.34/ml/bKEQC7o6BNtbsDriFQSR/HFLS/v-hfls022.wmv";
> name="mediaPlayer" width="320" height="266" autostart="1" 
> displaysize="4"
> autosize="0" bgcolor="darkblue" showcontrols="0" showtracker="0"
> showstatusbar="1" showdisplay="0" videoborder3d="0" 
> designtimesp="5311"
> loop="0">
>     </object>';
>  
>  return $var_result;
> Dylan Barber
> 
>  
> <file:///C:/Documents%20and%20Settings/Dylan/Application%20Dat
> a/Microsoft/Si
> gnatures/www.codegalaxy.com> www.codegalaxy.com - A 
> webservices company 
> 
> DotNetNuke Portal  Specialists
> 
> Simple Affordable & Reliable - Web Design, and Programming 
> 
>  
> 

--- End Message ---
--- Begin Message ---
Hi everyone,

I've seen several examples of passing arrays by reference such as the
following:

$a = array();

function foo(&a)
{
        for ($i=0; $i < 10; i++) 
        {
                $a[$i] = $i;
        }
}

foo($a);
echo "<PRE>";
print_r($a);
echo "</PRE>";

However, when I try this on my setup, it doesn't work and I get the
following error message:

PHP Parse error:  parse error, unexpected T_STRING, expecting T_VARIABLE
in...

Anyone have any ideas or suggestions?

Thanks,
Jim

--- End Message ---

Reply via email to