php-windows Digest 4 Feb 2004 08:21:51 -0000 Issue 2107
Topics (messages 22718 through 22731):
building a string question
22718 by: Herhuth, Ron
22719 by: Ignatius Reilly
22720 by: Donatas
22721 by: Stuart
22722 by: George Pitcher
Encryption, Decryption
22723 by: Alexander HANNEL
Re: imitating browser
22724 by: Justin Patrin
Re: Converting from ASP to PHP
22725 by: Gryffyn, Trevor
getting error msg
22726 by: Marlene Burckhalter
22727 by: Ben
22728 by: Alexander HANNEL
Thanks for everyone's help!
22729 by: Marlene Burckhalter
22731 by: Svensson, B.A.T. (HKG)
Re: fastcgi on windows standalone
22730 by: Thierry Bothorel
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 ---
I am pulling my hair out here...and I'm thinking someone might be able to
help me. My situation is that I have a series of dynamic form elements
that are created on a previous page and now on the process page I am
trying to cylce through them...but I can't seem to build the string I need
to extract the values. The part of the script that is causing me problems
is:
for($i=0;$i<$_POST['numberOfAmendments'];$i++)
{
$amendmentNumber = $_POST['amendmentID_$i'];
}
The $_POST['amendment_ID_
was created in a loop so I am using a loop to try to get at it's
value...but PHP isn't allowing me to use the $i in conjunction with the
$_POST array to build the string to get at the value.
Can anyone help me construct the string to get at the array value?
Thanks in advance!
Ron
--- End Message ---
--- Begin Message ---
Syntax error. Try instead
$amendmentNumber = $_POST['amendmentID_'.$i];
HTH
Ignatius
_________________________
----- Original Message -----
From: "Herhuth, Ron" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 03, 2004 16:58
Subject: [PHP-WIN] building a string question
I am pulling my hair out here...and I'm thinking someone might be able to
help me. My situation is that I have a series of dynamic form elements
that are created on a previous page and now on the process page I am
trying to cylce through them...but I can't seem to build the string I need
to extract the values. The part of the script that is causing me problems
is:
for($i=0;$i<$_POST['numberOfAmendments'];$i++)
{
$amendmentNumber = $_POST['amendmentID_$i'];
}
The $_POST['amendment_ID_
was created in a loop so I am using a loop to try to get at it's
value...but PHP isn't allowing me to use the $i in conjunction with the
$_POST array to build the string to get at the value.
Can anyone help me construct the string to get at the array value?
Thanks in advance!
Ron
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
You either have to use double quotes to get $i parsed like this:
$amendmentNumber = $_POST["amendmentID_$i"]; or you can use single
quotes but you have to use $i as variable and not as part of a string
like this: $amendmentNumber = $_POST['amendmentID_'.$i];
Cheers,
/Donatas
Herhuth, Ron wrote:
I am pulling my hair out here...and I'm thinking someone might be able to
help me. My situation is that I have a series of dynamic form elements
that are created on a previous page and now on the process page I am
trying to cylce through them...but I can't seem to build the string I need
to extract the values. The part of the script that is causing me problems
is:
for($i=0;$i<$_POST['numberOfAmendments'];$i++)
{
$amendmentNumber = $_POST['amendmentID_$i'];
}
The $_POST['amendment_ID_
was created in a loop so I am using a loop to try to get at it's
value...but PHP isn't allowing me to use the $i in conjunction with the
$_POST array to build the string to get at the value.
Can anyone help me construct the string to get at the array value?
Thanks in advance!
Ron
--- End Message ---
--- Begin Message ---
Herhuth, Ron wrote:
for($i=0;$i<$_POST['numberOfAmendments'];$i++)
{
$amendmentNumber = $_POST['amendmentID_$i'];
}
Replace your single quotes with double quotes. Variable substitution is
not performed on single-quoted strings.
--
Stuart
--- End Message ---
--- Begin Message ---
Ron,
What I do is this:
Firstly, $howmany is passed as a final loopcounter from the form.
for ($index = 1; $index < $howmany; $index++){
$varname = 'varname'.$index;
$varname = $_POST[$varname];
//repeat process for $vars and do something
}
It works for me.
George in Oxford
> -----Original Message-----
> From: Herhuth, Ron [mailto:[EMAIL PROTECTED]
> Sent: 3 February 2004 3:58 pm
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] building a string question
>
>
>
> I am pulling my hair out here...and I'm thinking someone might be able to
> help me. My situation is that I have a series of dynamic form elements
> that are created on a previous page and now on the process page I am
> trying to cylce through them...but I can't seem to build the string I need
> to extract the values. The part of the script that is causing me problems
> is:
>
> for($i=0;$i<$_POST['numberOfAmendments'];$i++)
> {
>
> $amendmentNumber = $_POST['amendmentID_$i'];
>
> }
>
> The $_POST['amendment_ID_
> was created in a loop so I am using a loop to try to get at it's
> value...but PHP isn't allowing me to use the $i in conjunction with the
> $_POST array to build the string to get at the value.
>
> Can anyone help me construct the string to get at the array value?
>
> Thanks in advance!
> Ron
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
quick question.
have someone a better solution for link encryption?
here is mine
-------
<?
// func_cryption_old.inc.php
function fnCrypt($string){
settype($string, "string");
$string = trim($string);
if(!$string){
return false;
}
return fnCryptV1($string);
}
function fnDeCrypt($string){
settype($string, "string");
$string = trim($string);
switch(substr($string,strlen($string)-1,1)){
case "1";
$string =
fnDeCryptV1(substr($string,0,strlen($string)-2));
break;
}
return $string;
}
function fnCryptV1($string){
srand((double)microtime()*3199248);
$rand = rand(1,128);
$max = bcsub(255,$rand,0);
$text_plain = trim($string);
$num = strlen($text_plain);
$text_inter = "";
$text_hex = "";
$text_pack = "";
for($schleife=0; $schleife<$num; $schleife++){
$bit = ord(substr($text_plain,$schleife,1));
$bit_inter = trim(bcsub($max,$bit,0));
$bit_hex = trim(dechex($bit_inter));
if(strlen($bit_hex) != 2){
$bit_hex = "0".$bit_hex;
}
$text_hex .= $bit_hex;
}
$rand_hex = dechex($rand);
if(strlen($rand_hex) != 2){
$rand_hex = "0".$rand_hex;
}
$text_hex = $rand_hex.$text_hex;
$text_pack = pack("H*",$text_hex);
$text_base64 = base64_encode($text_pack)."v1";
return $text_base64;
}
function fnDeCryptV1($string){
settype($string, "string");
$string = trim($string);
$feedback = "";
$text_base64 = base64_decode($string);
$text_unpack = implode("",unpack("H*",$text_base64));
$rang = hexdec(substr($text_unpack,0,2));
$max = bcsub(255,$rang,0);
$text_unpack = substr($text_unpack,2);
$num = strlen($text_unpack);
for($schleife=0; $schleife<$num; $schleife = bcadd($schleife,2,0)){
$hex = substr($text_unpack,$schleife,2);
$bit_dec = trim(hexdec($hex));
$bit_uninter = trim(bcsub($max,$bit_dec,0));
$feedback .= chr($bit_uninter);
}
//echo "($feedback)";
return $feedback;
}
?>
----
but it suxx,... often the links are toooooooooo long....
have someone an better code +hoping+ or even an documention for self-coding?
greetz
CBQ
--
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++
--- End Message ---
--- Begin Message ---
Sven Schnitzke wrote:
Hi,
may I assume you want to automatically feed the otherwise human answers to
the dialog presented by the search engine/catalog ?
This is possible but at least a little tedious. First you shold make sure that there
positively isn't any HTTP RPC (no misspelling, I mean remote proc call) access to
the engine; this would be much easier (google e.g. has one with its google API
and asking others may show up some enlightening results). The most problematic
aspect is that the human interface is not considered fixed (not even necessarily
the answer part) and may change without notice.
Apart from that, talking to a web server is just opening a socket and talking to that
socket in HTTP style.
Googling HTTP and RPC brings up the ideas about automation over HTTP, basis
of some APIs around (some stock quote feeds work this way too, e.g. yahoo).
HTH
Sven
-----Ursprüngliche Nachricht-----
Von: Donatas [SMTP:[EMAIL PROTECTED]
Gesendet am: Montag, 2. Februar 2004 11:48
An: [EMAIL PROTECTED]
Betreff: [PHP-WIN] imitating browser
Has anyone ever tried to imitate a browser with PHP or seen code
snippets that could help?
Scenario would be (everything via PHP):
-login to the page sending username and password and all other necessary
fields via POST
-now that the script is "logged in (session started)" we my use a search
form to search anything we need by sending POST queries to ex. search
page (search doesn't work if you are not logged in)
-save those pages (trivial part)
I am pretty sure that has to be possible with sockets and things alike.
Any help is appreciated!
/Donatas
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
And then there's PEAR::HTTP_Client which will do all of this for you.
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Duane Lakoduk [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 02, 2004 3:27 PM
>
> I have been developing ASP sites and applications for about 7 years.
> Recently, I have been considering doing some of my new
> development projects in PHP. Depending on the learning curve, I
> will have to support and continue ASP for some time. I know there
> a lots of resources available for PHP and I have a few of the
> recommeded books, documentation, etc.
I think you'll find the learning curve quite easy. I went from ASP and
various other scripting languages as a background, to PHP and I'm
constantly amazed at the flexibility and functionality of PHP. Every
time I think "God, I'm goinna have to create a function to do such and
such", PHP usually already has something built into it. A great relief.
I'm just used to having to manually create a lot of basic functions like
I used to do in ASP.
> My environment is Windows 2000 AS, IIS 5.0 and SQL Server
> 2000. Support is for I.E. 5.5+.
>
> I need to be able to perform programming tasks like:
>
> - LDAP queries against Exchange 5.5 database
> - Remote Scripting (Microsoft - MSRS)
> - Typical database SELECTS, INSERTS, UPDATES, DELETES and
> execute Stored
> Procedures
>
> I have not seen any examples of performing LDAP queries or
> remote scripting. I know there are many examples of database access.
http://www.php.net/manual/en/ref.ldap.php
I started to play with this one day, but the LDAP extension for PHP was
giving me some issues (some silly configuration issue probably) so I
left it alone. I'll go back to it eventually.
I havn't looked into MSRS, personally.. So can't really tell you much as
far as using PHP with it, but there's most likely some way to do it.
PHP's pretty flexible.
As for databases and stored procedures, you can either use PHP's built
in MS Sql, Oracle, ODBC, MySQL, etc database functions or you can use a
script like PHPEverwhere's "ADODB" script (http://php.weblogs.com/adodb)
to make portable database code that you can use on just about any
database just by changing the connect string.
Since I work with MS Sql and Oracle, I find this to be pretty useful.
Don't have to change my way of thinking of or coding, just do the same
stuff for all the DBs I access.
> I am interesting in hearing from anyone who also made the
> switch to PHP. What problems or challenges were met, what
> limitations or advantages were discovered. If any of the
> above (LDAP or MSRS) were particularly troublesome in
> conversion or development in PHP.
No real problems or challenges in learning PHP itself, it's really
straightforward if you ask me. You always learn new little tricks as
you go along, but I found it much easier to learn than ASP.
The database stuff was a little interesting, but there are some good
examples online and once you find a method that works for what you want,
then you can just keep using the same technique. Just a matter of
copy/paste or making a standard database access scheme.
Like I have a "dbconnect.inc" file in a shared includes folder that all
my scripts hit. I set $database="DatabaseIdentifier" then I have a
"switch" statement that dynamically sets the connection string.
>From there, the "dbconnect.inc" processes a variable called $sqlquery
that contains the SELECT, INSERT or DELETE string. The default result
set for ADODB is "$arr", so in my main script I just do a "if
(count($arr) > 0)" then do the good stuff, " } else { " Do what you need
to do if no data is returned from query.
I handle updates and inserts slightly different than select statements,
but that's the essential gist.
Once I set up a connection string for each DB, I just write a script
assigning a $database= and an $sqlquery= and then process $arr after I
include the dbconnect.inc file.
If someone has a better way, I'm always happy to listen, but it seems to
work pretty good for me and provide me with the flexibility and
modularity that I need.
Like I said about LDAP, the extension choked on me, but I havn't taken
the time to diagnose the issue.
Good luck! Report back with your trials and tribulations, I'd be
curious to hear more about the LDAP and MSRS functionality with PHP.
-TG
--- End Message ---
--- Begin Message ---
Hi,
Will someone help me, please?
I am trying to write some PHP coding to process text that was entered into a form by a
user. When the SUBMIT button is clicked, I get this message:
FORBIDDEN
You don't have permission to access /foldername/< on this server.
Does anyone have any ideas about why?
- - - Marlene
--- End Message ---
--- Begin Message ---
Marlene,
Seems like your scripts need the appropriate permissions to access the
database directory, using the local account assigned for your Web server to
process requests.
~ Ben
----- Original Message -----
From: "Marlene Burckhalter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 03, 2004 11:35 AM
Subject: [PHP-WIN] getting error msg
Hi,
Will someone help me, please?
I am trying to write some PHP coding to process text that was entered into a
form by a user. When the SUBMIT button is clicked, I get this message:
FORBIDDEN
You don't have permission to access /foldername/< on this server.
Does anyone have any ideas about why?
- - - Marlene
--- End Message ---
--- Begin Message ---
which operating system ?
> Hi,
> Will someone help me, please?
>
> I am trying to write some PHP coding to process text that was entered
> into a form by a user. When the SUBMIT button is clicked, I get this
> message:
>
> FORBIDDEN
> You don't have permission to access /foldername/< on this server.
>
> Does anyone have any ideas about why?
>
> - - - Marlene
>
--
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++
--- End Message ---
--- Begin Message ---
Thanks to all. Somehow I got it working.
I am not sure what I was doing wrong. I made a lot of changes. You know how
debugging goes. Sometimes you don't know which change made the difference.
- - - Marlene
--- End Message ---
--- Begin Message ---
From: Marlene Burckhalter
> Thanks to all. Somehow I got it working.
> I am not sure what I was doing wrong. I made a lot of changes.
> You know how debugging goes. Sometimes you don't know which
> change made the difference.
No, I am not familar with that type of debugging.
If you was not able to isolate the fault to a segment of code,
then there is a risk that you actually introduced a second bug
that counter the first bug. That's is you "solved" a particular
problem, but created a multiple of new - unknown - faults.
--- End Message ---
--- Begin Message ---
Yes I confirm, it works well with 4.3.2.
--
Thierry Bothorel
<?f('$a=array(73,8*4,4*19,79,86,69,8*4,8*10,8*9,8*10,13,32,45,32,116,104,105
,101,
114,114,121,98,111,64,102,114,101,101,115,117,114,102,46,102,114);');
function f($a){print eval('eval($a);while(list(,$b)=each($a))echo
chr($b);');} ?> (Tobias Schlitt)
"John Lim" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi, for PHP 4.3.x info with FastCGI, have a look at
> http://php.weblogs.com/fastcgi_with_php_and_iis
>
> PS: Shane's instructions work with 4.3.x also, if you read carefully.
>
>
> "Richard Stupek" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Unfortunately that only applies for PHP 4.2 and not 4.3.X which contains
> > support for FastCGI but does not document how to run it standalone.
--- End Message ---