php-windows Digest 14 Aug 2003 00:46:05 -0000 Issue 1869

Topics (messages 21135 through 21144):

Re: How to preserve value , this question so difficult
        21135 by: J.Veenhuijsen
        21137 by: Thomas Edward Lawrence

Re: Zip archive & File Encryption
        21136 by: UHL Fabrice

Re: embedding php to an application
        21138 by: Adam Zey
        21144 by: Ariz Jacinto

PHP My first function (help)!!!!
        21139 by: Frank Tudor
        21141 by: Flint Doungchak

RegEx help needed
        21140 by: Herhuth, Ron
        21143 by: Bob Hall

using PHP to find out windows user name?
        21142 by: Chen, Mao

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 --- Try this for page 2:

<?php
session_start() ;
?>
<form method="POST" action="page1.php">
<?php
$value++ ;
echo $value ;
?>
<br>
<input type="submit" value="Submit" name="B1">
</form>

In your version session_start() should be sent before any other output is sent.

Jochem



Thomas Edward Lawrence wrote:
this is page1.php
<?
session_start() ;
echo $value ;
if (!session_is_registered("value") )
{
session_register("value") ;
$value = 1 ;
}
echo $value ;
?>
<br>
<a href="page2.php">Next page</a>

this is page2.php

<form method="POST" action="page1.php">
<?
session_start() ;
$value++ ;
echo $value ;
?>
<br>
<input type="submit" value="Submit" name="B1">
</form>

when I come back to page1.php from page2.php , this is result :

page1.php ( run at first time)

Warning: Cannot send session cookie - headers already sent by (output started at C:\PHP\page1.php:9) in C:\PHP\\page1.php on line 10

Warning: Cannot send session cache limiter - headers already sent (output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10

Notice: Undefined variable: value in C:\PHP\page1.php on line 11

1 (value of $value)

Next page


page2.php


Warning: Cannot send session cache limiter - headers already sent (output started at C:\PHP\page2.php :10) in C:\PHP\page2.php on line 11

2 (value of $value)




page1.php ( when come back from page2.php)

Warning: Cannot send session cookie - headers already sent by (output started at C:\PHP\page1.php :9) in C:\PHP\page1.php on line 10

Warning: Cannot send session cache limiter - headers already sent (output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10

Notice: Undefined variable: value in C:\PHP\page1.php on line 11 (browser not understanding $value)

1 (value of $value still 1)


Next page




Nothing changes , value of $value still is 1 , this question is so difficult , I also want to ask why my browser warns , how I must config in php.ini , I use IE6 , win2k , thank for reading .


--- End Message ---
--- Begin Message ---
Excellent , thank so much , and I also want to ask why my browser warns this
when I run page1.php at first time , whether I must make something in
php.ini , I use IE6 , win2k , thank for your anwsering .


Warning: Cannot send session cookie - headers already sent by (output
started at C:\PHP\baitap\session.php:11) in C:\PHP\baitap\session.php on
line 12

Warning: Cannot send session cache limiter - headers already sent (output
started at C:\PHP\baitap\session.php:11) in C:\PHP\baitap\session.php on
line 12

Notice: Undefined index: value in C:\PHP\baitap\session.php on line 13

1

Next page












"J.Veenhuijsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Try this for page 2:
>
> <?php
> session_start() ;
> ?>
> <form method="POST" action="page1.php">
> <?php
> $value++ ;
> echo $value ;
> ?>
> <br>
> <input type="submit" value="Submit" name="B1">
> </form>
>
> In your version session_start() should be sent before any other output
> is sent.
>
> Jochem
>
>
>
> Thomas Edward Lawrence wrote:
> > this is page1.php
> > <?
> > session_start() ;
> > echo $value ;
> > if (!session_is_registered("value") )
> > {
> > session_register("value") ;
> > $value = 1 ;
> > }
> > echo $value ;
> > ?>
> > <br>
> > <a href="page2.php">Next page</a>
> >
> > this is page2.php
> >
> > <form method="POST" action="page1.php">
> > <?
> > session_start() ;
> > $value++ ;
> > echo $value ;
> > ?>
> > <br>
> > <input type="submit" value="Submit" name="B1">
> > </form>
> >
> > when I come back to page1.php from page2.php , this is result :
> >
> > page1.php ( run at first time)
> >
> > Warning: Cannot send session cookie - headers already sent by (output
started at C:\PHP\page1.php:9) in C:\PHP\\page1.php on line 10
> >
> > Warning: Cannot send session cache limiter - headers already sent
(output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10
> >
> > Notice: Undefined variable: value in C:\PHP\page1.php on line 11
> >
> > 1 (value of $value)
> >
> > Next page
> >
> >
> > page2.php
> >
> > Warning: Cannot send session cache limiter - headers already sent
(output started at C:\PHP\page2.php :10) in C:\PHP\page2.php on line 11
> >
> >
> > 2 (value of $value)
> >
> >
> >
> >
> > page1.php ( when come back from page2.php)
> >
> > Warning: Cannot send session cookie - headers already sent by (output
started at C:\PHP\page1.php :9) in C:\PHP\page1.php on line 10
> >
> > Warning: Cannot send session cache limiter - headers already sent
(output started at C:\PHP\page1.php:9) in C:\PHP\page1.php on line 10
> >
> > Notice: Undefined variable: value in C:\PHP\page1.php on line 11
(browser not understanding $value)
> >
> > 1 (value of $value still 1)
> >
> >
> > Next page
> >
> >
> >
> > Nothing changes , value of $value still is 1 , this question is so
difficult , I also want to ask why my browser warns , how I must config in
php.ini , I use IE6 , win2k , thank for reading .
>








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

according to the zip white pages, encryption working with RIJNDAEL algorithm is 
avialable for zip filez, see http://www.winzip.com/aes_info.htm 

my question is, witch function and parameters can I use to get such encryption ?

I have not much experience in the domain, but winzip talk about "AES", and I can't 
find any info about it in the mcrypt librairie.

thanks.



-----Message d'origine-----
De : Miha Nedok [mailto:[EMAIL PROTECTED]
Envoyé : mardi 12 août 2003 12:21
À : UHL Fabrice
Cc : [EMAIL PROTECTED]
Objet : Re: [PHP-WIN] Zip archive & File Encryption




Look at PhpMyAdmin they have a ZIP file class. But no encryption, you
would have to implement it yourself. But ZIP file encryption is weak and
easy breakable. I'm recommind you to encrypt your data with some
encryption that is provided by Mcrypt (check for libmcrypt).

-Mike


On Mon, 11 Aug 2003, UHL Fabrice wrote:

> Date: Mon, 11 Aug 2003 17:20:53 +0200
> From: UHL Fabrice <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Zip archive & File Encryption
>
> hi all,
>
> I am looking for a php class for creating zip encrypted files archives.
>
> does anyone have an idea ?
>
> thanks
>
> UF
>
> --
> 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


--- End Message ---
--- Begin Message ---
I've never heard of this library before, however I point you towards EncPHP
(http://www.sourceforge.net/projects/encphp), which will allow you to
encapsulate a PHP script inside an EXE along with everything needed to run
it.

Regards, Adam.

"Ariz Jacinto" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> how do i embed php to an application?
>
> should i simply link the application to php4embed.lib library?
>
>
>
>
>
I've never heard of this library before, however I point you towards EncPHP
(http://www.sourceforge.net/projects/encphp), which will allow you to
encapsulate a PHP script inside an EXE along with everything needed to run
it.

Regards, Adam.

"Ariz Jacinto" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> how do i embed php to an application?
>
> should i simply link the application to php4embed.lib library?
>
>
>
>
>



--- End Message ---
--- Begin Message --- php4embed.lib is included in the php windows binary installer.

thanks for the link.



Adam Zey wrote:

I've never heard of this library before, however I point you towards EncPHP
(http://www.sourceforge.net/projects/encphp), which will allow you to
encapsulate a PHP script inside an EXE along with everything needed to run
it.

Regards, Adam.

"Ariz Jacinto" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


how do i embed php to an application?

should i simply link the application to php4embed.lib library?







I've never heard of this library before, however I point you towards EncPHP
(http://www.sourceforge.net/projects/encphp), which will allow you to
encapsulate a PHP script inside an EXE along with everything needed to run
it.

Regards, Adam.

"Ariz Jacinto" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


how do i embed php to an application?

should i simply link the application to php4embed.lib library?















--- End Message ---
--- Begin Message ---
Guys I need help! 

I think I am on the right track with my logic but my code fails.
 Can someone help?  (my coding is weak no formal training).

Thanks,
Frank

 
$TotalString = "$total";
function Price($total)
{
 if "$total" <= "24" then "$total" * "3200"
 else 
 if "$total" >= "25" and  "$total" <= "49" then "$total" *
"3000"
 else 
 if "$total" >= "50" and  "$total" <= "99" then "$total" *
"2900"
 else
 if "$total" >= "100" then "$total" * "2700"
 return "$Price";
 }
 echo "$Price";



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--- End Message ---
--- Begin Message ---
Frank,

There's a lot to mention, you might want to look at PHP arithmetic operators for an 
understanding between strings and integers at:
http://www.php.net/manual/en/language.operators.arithmetic.php

You might also want to review the function reference at: 
http://www.php.net/manual/en/functions.php

But since you probably don't want to read the manual. Here are some comments. If you 
have questions, you can mail me directly and we'll if we can get you on the ball at 
[EMAIL PROTECTED]

First off,

You cannot use comparision operaters (<=, >=, >) with strings.  When you put quotes 
around your variable it defines it to php as a string, which translated means that 
it's words, not numbers.  So you could say 
if ("$total" == "lowprice") {
  code code code
}

but not say ("$total" >= 25) {
  code code code
}

Also, you have defined your intergers as strings.  You're much better off with 
comparision operators using only intergers rather than comparing two strings that 
should be intergers.  None of them will work besides == and === anyway if what you're 
comparing are strings


Second, you never define what $Price should be.  Is it $total, or just some magic 
number out of the air?  You need to at least tell php that $price = something.  You 
should also define it in the function definition, like

function Price($total, $price) {
  if ($total <= 25) {
    $total = $total * 3000;
  }  
  $price = $total;
  return $price;
}
echo $price;

Third, with your multiplication statement, you need to define what the result of 
$total * whatever is.  So after your then statement it should be something like then 
$total = $total * 3000 or $newtotal = $total * 3000


Finally, with your if statements, you need to all the things php needs to check to 
pass the if statement in parathesis.  So it should be
if ($total >= 25 &&(also known as AND) $total <= 49) then do whatever


For ease of reading, you might just want to put your if statement in brackets, i.e. if 
($total >= 25 && $total <= 49) {
  code code code
}


-----Original Message-----
From: Frank Tudor [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 10:40 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] PHP My first function (help)!!!!


Guys I need help! 

I think I am on the right track with my logic but my code fails.
 Can someone help?  (my coding is weak no formal training).

Thanks,
Frank

 
$TotalString = "$total";
function Price($total)
{
 if "$total" <= "24" then "$total" * "3200"
 else 
 if "$total" >= "25" and  "$total" <= "49" then "$total" *
"3000"
 else 
 if "$total" >= "50" and  "$total" <= "99" then "$total" *
"2900"
 else
 if "$total" >= "100" then "$total" * "2700"
 return "$Price";
 }
 echo "$Price";



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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


--- End Message ---
--- Begin Message ---
I have an array of a submitted text string (called $submittedTextString).
And I have an array of common words (called $commonWordArray).

I'm trying to use Regex to:

1. Remove any words from $submittedTextString that appear in
$commonWordArray (about a hundred words).

2. Remove any numbers from $submittedTextString.

3. Remove any characters from $submittedTextString that aren't
alphabetical.

4. Remove any duplicate words from $submittedTextString

I have been wrestling RegEx using tutorials and the manual but I'm not
getting it...could someone help me put together the regex I need to do the
above?

Thanks a lot!
Ron





--- End Message ---
--- Begin Message ---
On Wed, Aug 13, 2003 at 02:48:11PM -0400, Herhuth, Ron wrote:
> I have an array of a submitted text string (called $submittedTextString).
> And I have an array of common words (called $commonWordArray).
> 
> I'm trying to use Regex to:

These aren't necessarily regex problems.
 
> 1. Remove any words from $submittedTextString that appear in
> $commonWordArray (about a hundred words).

My suggestion is to use split() or explode() to split 
$submittedTextString and put the words in an array. Then use 
array_intersection() to return an array of words in both arrays. 
Then you could either loop through the intersection array and 
use str_replace() to replace each word with the empty string, or 
you convert the intersection array to an array that maps each 
word in the array to the empty string, and use that as the map 
argument for strtr()
 
> 2. Remove any numbers from $submittedTextString.

The brute force method is to loop through 0-9, using str_replace()
to replace each digit with the emplty string, whether the digit 
exists or not. Another approach is the search for numbers first, 
and use str_replace() only if you find something. str_replace() 
has to do a search anyway, so a seperate search is probably 
redundant, meaning the brute force method is probably faster. If 
your numbers may include non-numeric characters (e.g. decimal 
points), use [0-9]*[.]?[0-9]+([.][0-9]+)?, or something similar, 
in ereg() to return the number, and pass it to str_replace() to 
replace with the empty string.
 
> 3. Remove any characters from $submittedTextString that aren't
> alphabetical.

Try searching for [^a-zA-Z] and apply str_replace() to anything 
you find. For non-English alphabets you may need to alter that, 
e.g. [^a-åA-Å]. I've only tried PHP regex with English, so I 
don't know.
 
> 4. Remove any duplicate words from $submittedTextString

Use split() or explode(), sort the resulting array with asort() so 
you don't change the indices, and delete any element of the array that 
matches the element immediately before. You should be able to do this 
with either a loop or with array_walk(). Resort the remaining elements 
with ksort() to put them back in their original order, and use join() 
or implode() to convert the array back to a string.

I haven't tried writing any code, so you'll have to figure out the 
details yourself.

Bob Hall

--- End Message ---
--- Begin Message ---
Hi Everyone,

 

I'm just wondering whether we can use PHP to find out the name of user
who is currently logging on to local Windows computer and accessing a
particular .php web page.

 

Thanks in advance.

 


--- End Message ---

Reply via email to