php-general Digest 23 Mar 2001 16:48:28 -0000 Issue 584

Topics (messages 45245 through 45314):

Re: writing to a file
        45245 by: hi
        45248 by: adam
        45251 by: adam
        45277 by: Christian Reiniger

Re: Silly sessions problem.
        45246 by: hi

Complex IF statement
        45247 by: JCampbell
        45249 by: David Robley
        45302 by: Chris Mulcahy

Re: "\r\n" gives extra empty line between each line in Outlook
        45250 by: Eelco de Vries
        45278 by: Christian Reiniger

Seek for the Web Site Info.
        45252 by: Ian
        45253 by: Harshdeep S Jawanda

Checking URL & mail
        45254 by: Rosen

Creating tree using table?
        45255 by: E K L
        45261 by: Neil Kimber

Sending html email
        45256 by: Floyd Piedad
        45260 by: Brad Hubbard
        45310 by: PHPBeginner.com

Re: Problems uploading Files
        45257 by: Carsten Gehling
        45309 by: PHPBeginner.com

Re: HELP? HTTP HEADER GURUS etc?
        45258 by: Tobias Talltorp

Sorry....sessions ... again...with code...
        45259 by: Miguel Loureiro
        45267 by: Jeff Armstrong

Why the data in HTML form lost when the user press back button?
        45262 by: Carfield Yim
        45298 by: Chris Lee

key generation with mcrypt
        45263 by: Dean Hall
        45295 by: Joe Conway

sql problem
        45264 by: Wade Halsey
        45268 by: Jeff Armstrong

Check URL & Mail
        45265 by: Rosen
        45279 by: Christian Reiniger
        45280 by: Jon Haworth

string->integer
        45266 by: Matt Williams
        45296 by: Chris Lee

test
        45269 by: 淡紫香風信子

session don't work with php that have version more than 4.03pl1
        45270 by: Weerapong Sirikanya
        45271 by: Renze Munnik
        45273 by: Renze Munnik
        45294 by: Chris Lee

WebCam and PHP
        45272 by: Marcelo Pereira
        45293 by: Chris Lee

Re: Crypt problem
        45274 by: Christian Reiniger

Re: regexp on us tele number
        45275 by: Christian Reiniger

Re: carriage return required??
        45276 by: Christian Reiniger

Don't understand HTTP_SESSION_VARS
        45281 by: Michael Champagne
        45292 by: Chris Lee

Re: php 4.04pl 1-3 for red hat 7
        45282 by: Larry Hotchkiss

PHP XML
        45283 by: Ales Kracik

Re: Date subtraction
        45284 by: Jeff Armstrong

Re: reading microsoft word document text in php?
        45285 by: Erick Papadakis
        45286 by: Erick Papadakis

Permission denied
        45287 by: John Almberg
        45288 by: Adam Wright
        45290 by: John Almberg
        45291 by: John Almberg
        45304 by: Adam Wright

PHP_SELF problems!
        45289 by: Erick Papadakis
        45311 by: PHPBeginner.com

Session Confusion
        45297 by: KPortsmout.aol.com
        45303 by: Jack Dempsey
        45313 by: KPortsmout.aol.com

PHP on Digital Unix
        45299 by: Olivier, Dave

Array Cleansing
        45300 by: pkshifted.slackin.com
        45301 by: Cal Evans

Re: sessions.. again...
        45305 by: PHPBeginner.com

Re: Freshmeat Ad?
        45306 by: PHPBeginner.com

Re: Move data from one MySql table to another?
        45307 by: PHPBeginner.com

Re: Sessions to password protect directory?
        45308 by: PHPBeginner.com

Re: Word docs
        45312 by: DAve Goodrich

limiting .htaccess reach
        45314 by: Joe Sheble aka Wizaerd

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]


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


Don't even bother with that previous answer.  You have what you want to
write in a string, $new.  Read the file and put that into another string,
$previous.  Then concatenate the strings with the "." operator:

$previous=$new . $previous

and write $previous to the file.







how would that look on a code view? i plan to write the variable $message on
top of the existing data

""hi"" <[EMAIL PROTECTED]> wrote in message
99ektl$gf0$[EMAIL PROTECTED]">news:99ektl$gf0$[EMAIL PROTECTED]...
> Don't even bother with that previous answer.  You have what you want to
> write in a string, $new.  Read the file and put that into another string,
> $previous.  Then concatenate the strings with the "." operator:
>
> $previous=$new . $previous
>
> and write $previous to the file.
>
>
>
>
> --
> 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]
>






nevermind ^^ i am jsut going to have posts that go from top to bottom oldest
to newest






On Friday 23 March 2001 06:17, you wrote:
> how would that look on a code view? i plan to write the variable
> $message on top of the existing data
>
> > Don't even bother with that previous answer.  You have what you want
> > to write in a string, $new.  Read the file and put that into another
> > string, $previous.  Then concatenate the strings with the "."
> > operator:
> >
> > $previous=$new . $previous
> >
> > and write $previous to the file.

Well, he just gave you a detailed description of what to do. Everything 
else you need to know is in the manual.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




WRONG!!






Thank you all for your help earlier!

Now I need to know if it is possible to create a complex if statement?

if ($variable=="duck") || ($variable=="goose"){ }else{ }

Is how I thought it would work. I just need to know if there is an easy way
to do an OR in if statements IF variable equals duck or goose...

<Jon>
===============================
And shepards we shall be
For thee, my lord, for thee
For thou hath descended forth from thy hands
That our feats may swiftly carry out thy command
We will flow a river forth unto thee
And teaming with souls shall it ever be...
===============================
http://jcampbell.blacklightning.net





On Wed, 13 Dec 2000 15:49, JCampbell wrote:
> Thank you all for your help earlier!
>
> Now I need to know if it is possible to create a complex if statement?
>
> if ($variable=="duck") || ($variable=="goose"){ }else{ }
>
> Is how I thought it would work. I just need to know if there is an easy
> way to do an OR in if statements IF variable equals duck or goose...
>
> <Jon>

Pretty much so; you might want to add extra parens thus:

if (($variable=="duck") || ($variable=="goose")){ }else{ }

You could, depending on exactly what you want, use a switch:
switch($variable){

case 'duck':
case 'goose':
 duck or goose action;
 break;
default:
 elephants, tigers etc action;
}

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




if (($variable=="duck") || ($variable=="goose")) { } else { }


-----Original Message-----
From: JCampbell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 12, 2000 11:19 PM
To: Main PHP List
Subject: [PHP] Complex IF statement


Thank you all for your help earlier!

Now I need to know if it is possible to create a complex if statement?

if ($variable=="duck") || ($variable=="goose"){ }else{ }

Is how I thought it would work. I just need to know if there is an easy way
to do an OR in if statements IF variable equals duck or goose...

<Jon>
===============================
And shepards we shall be
For thee, my lord, for thee
For thou hath descended forth from thy hands
That our feats may swiftly carry out thy command
We will flow a river forth unto thee
And teaming with souls shall it ever be...
===============================
http://jcampbell.blacklightning.net


--
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 all,

First I had a problem that text from a textarea form object passed to mail()
ended up as a single line of text in MS Outlook.
I changed the newlines to newlines _with_ carriage returns:
strtr($mailbody, "\n", "\r\n");

Now it's not a single line of text but every newline skips an extra line
?!?!
The following is typed in the textarea en passed to mail():
"line 1
line 2
line 3"

In Outlook it shows as:
"line 1

line 2

line 3"

The "\n" alone gives a single line of text, the "\r\n" gives an extra empty
line between each line. (the "\r" alone ends up the same as "\r\n").

What is going on here?
How can I fix this?


Regards;
Eelco.





On Friday 23 March 2001 06:57, you wrote:
> Hi all,
>
> First I had a problem that text from a textarea form object passed to
> mail() ended up as a single line of text in MS Outlook.
> I changed the newlines to newlines _with_ carriage returns:
> strtr($mailbody, "\n", "\r\n");

Re-read the description of strtr. Hint:

> empty line between each line. (the "\r" alone ends up the same as
> "\r\n").

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




Does anybody know that any web site allow me to enter web address example,
www.yahoo.com, and enter go.

The result will shown me that yahoo server,
1. Operating System?
2. Programming?
3. Database?
etc ....

Thanks in advance.






Go to http://uptime.netcraft.com/ . That should give you part of the
information you want.

Ian wrote:

> Does anybody know that any web site allow me to enter web address example,
> www.yahoo.com, and enter go.
>
> The result will shown me that yahoo server,
> 1. Operating System?
> 2. Programming?
> 3. Database?
> etc ....

--
Regards,
Harshdeep Singh Jawanda.






Hi,
How can I check for existing site (e.g. http://www.somehost.com/someone)
and check for existing mail ?

Thanks,
Rosen Marinov








Hi all,

   Currently, i'm trying to write a program which is related to tree 
manipulation. Meaning that, i'll search the tree to get level or count how 
many child exist for particular parent, for example.

  Initially i planned to use table to represent all kind of datas that are 
parent, left child and right child. However, i still face problem in 
calculating the level of the tree. So, can any one gives me an idea on how 
to manipulate the table so that i will be able to count the level?

  Your prompt reply is much appreciated. Thanks....

E K
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





This is a big topic. I'll be brief.
This all depends upon your data structure. There are a couple of ways that
you can store information like this.
The classic (purist) method would be to have a table of the following type:

      table_Tree
      Node ID   |       Parent ID | Node Data
      ==========+===========+==========
          1     |    0      |  xxx
          2     |    1      |  xxx
          3     |    1      |  xxx

This describes a tree where node 1 is the top (parent id = 0) and has 2
children (nodes 2 and 3).
This approach can be used to describe any depth of tree with any number of
child nodes.
You then need to decide how to represent this in PHP. You could create a
node class that contains a collection of child nodes, a reference to the
parent node and the node data. You could then construct a physical
representation of your tree in PHP. You could then write some routines to
traverse your tree and count depth level of any particular node.
Alternatively, you could store the data in the db table in the same way in
PHP (as an array) and then write some routines to traverse your array. Both
approaches are valid and work. You would have to write the code to count the
depth of a node.

You could also store you information in the database as:

      table_Tree
      Node ID   |       Depth     | Node Data
      ==========+===========+==========
          1     |    0      |  xxx
          2     |    1      |  xxx
          3     |    1      |  xxx
          4     |    0      |  xxx

Making the assumption that the rows are ordered correctly. By reading
row-by-row you can assume that if a following row is at a lower depth or the
same, then you are in the same branch of the tree. As soon as the depth is
at a higher level then you have traversed back up a branch. You can store
this representation directly in PHP in arrays and then write some routines
to render/handle your tree however you like. This approach will give you a
depth level directly, however, it's not as 'nice' as the first types of
trees as it relies upon order rather than strong relationships with child
nodes.

Your choice.

Hope that helps,
        Neil

-----Original Message-----
From: E K L [mailto:[EMAIL PROTECTED]]
Sent: 23 March 2001 08:29
To: [EMAIL PROTECTED]
Subject: [PHP] Creating tree using table?


Hi all,

   Currently, i'm trying to write a program which is related to tree
manipulation. Meaning that, i'll search the tree to get level or count how
many child exist for particular parent, for example.

  Initially i planned to use table to represent all kind of datas that are
parent, left child and right child. However, i still face problem in
calculating the level of the tree. So, can any one gives me an idea on how
to manipulate the table so that i will be able to count the level?

  Your prompt reply is much appreciated. Thanks....

E K
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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







Can anybody tell me the easiest and quickest way to send email in HTML
format?

Thanks,

Floyd







> Can anybody tell me the easiest and quickest way to send email in HTML
> format?

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

Read it.

Brad





here:

charset to be is text/html

$mess .= '<H1>your HTML code</H1>';
$mess .= '<a href="as many">as <B>you</B> like</a>';

here is going mail()

see php.net/mail

for how to add the headers


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com





-----Original Message-----
From: Floyd Piedad [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 6:12 PM
Cc: [EMAIL PROTECTED]
Subject: [PHP] Sending html email


Can anybody tell me the easiest and quickest way to send email in HTML
format?

Thanks,

Floyd


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






From: "Kilian" <[EMAIL PROTECTED]>
Sent: Thursday, March 22, 2001 7:28 PM


> The user the webserver process runs under may not have the permission to
> upload the file. In many cases, the webserver runs as nobody. Thus, if you
> want to upload a file, nobody needs write-access to the directory into
which
> the file should be uploaded.
>
>   -- Kilian

You sure your name's not Odysseus? :-)

"...nobody blinded me..."

- Carsten






You have to chmod that directory (not needed for FTP of course)


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Renzi, Sebastian [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 3:18 AM
To: PHP General List
Subject: [PHP] Problems uploading Files


Hello again ! , i have a script that uploads a file , when i use the
function move_uploaded_file() an error raises ,"Permission denied ....."
,but if i upload the same file thru an ftp client it works correctly !


Sebastián Renzi
Consultoría & Desarrollo de Sistemas.
CODES S.A


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






Try out cURL. I think it will work for java and C aswell:
http://curl.haxx.se

It does posts and handles cookies and more.

// Tobias

"brunatex" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hello,
>
> Not sure if this is exactly focused on PHP, but i thought some of you
> guys might know.
>
> The general problem:
>     I want to be able to send SMS messages from my computer using one of
> the free SMS services.
>     I want to be able to do this without logging on each time - i.e.
> from a program (eiither C or java or the like).
>
> In essence, the problem is to get a program to 'Log In' to a site, and
> keep the user 'Logged In' (by sending cookies with
> each request i presume..)
>
> So the 2 questions are:
>
>     1. how do i send a POST query (containing login details) to a page?
> (if it were GET, i could just append to the URL, how do i do it with
> POST?)
>
>     2. once i have sent this (correct) login, i will receive back a
> cookie. I can store this, but need to know how to send it back with each
> request? (in the header somehow i presume..?)
>
> Thanks in advance,
>
> Jonathan
>
>
> --
> 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]
>






|Hello all,
I'm mad with me....sorry but see if can understand why I'm mad.
Copy the 3 attached files, and run it.
In one.php just click to the link (it works.....), now in two.php you can see: " and 
now: aaaaaaa", cool hum...
Clicking in OFF link you can see the result of phpinfo, but section of Apache 
Evironment, in HTTP_COOKIE you (at least I have) the PHPSESSID with value, in spite of 
in off.php code I make a session_destroy????
Now if you use history back button, go to two.php, and OK the session variable dont 
appear, Back again, Forward and voila' here is 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
I have try to follow some Jeff Armstrong tips, but I have no success.Thank you very 
much Jeff (really...I'm no jocking...).
Any ideas ?? 
T.Y all

Best Regards
Miguel Loureiro <[EMAIL PROTECTED]>


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

CODE:

one.php
<?

session_start();

session_register("a"); 

$a="aaaaaaaaa";

?>

<html>

<body>

<form>

<a href="two.php"> 2 </a> 

</form>

</body>

</html>




two.php
<?

session_start();

?>

<html>

<body>

and now : <?echo $a?>

<a href="off.php">OFF</a>

</body>

</html>




off.php
<?

session_start();

unset($a);

session_destroy();


phpinfo();

?>







I have tried you code and cannot see any real problem?

This is what I see happening:

1 one.php creates a session and sets the value of $a to 'aaaaa'
2 click on 2 and you get to two.php with the value set to 'aaaaa'
3 click on OFF and you get to off.php where the value is unset
4 click back and you go back to two.php, and $a has no value
5 click back and you go to one.php which then
    creates a new session and puts 'aaaaa' back into $a

phpinfo() shows that the browser is sending you a PHPSESSID
cookie, but as your variables are correctly unset, this 
should never be a problem. When you call session_start() php 
is automatically going to create a PHPSESSID cookie anyway, 
so even if you
  setcookie( 'PHPSESSID', '', time() );
all that happens is that you get a new one.

Is the real issue that when you go back to one.php your code 
unconditionally recreates the value?

Regards
Jeff

PS madness is a state of mine.

-----Original Message-----
From: Miguel Loureiro [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 9:28 AM
To: php-gen
Subject: [PHP] Sorry....sessions ... again...with code...


|Hello all,
I'm mad with me....sorry but see if can understand why I'm mad.





Why the data in HTML form lost when the user press back button? And I
find that this problem only exist if I use session_start() to enable
session variable. But I can't disable it because the user information in
session useful in every pages




this is a client side issue, not a server side (php) issue. when a page is called, php 
is loaded, everything is worked out and php echo's the data requested, then php 
closes. this is the key, php closes. why should it keep running, its done its job. 
when the user goes to a new page, php is again called. if the user hits the back 
button is clicked the previous page is re-loaded, but here is where the browser 
faults, the page is re-loaded but the client does not re-send the data. it is in no 
way php's fault that a clients browser does not re-send the data.

IE will at least warn you that you will have to click yes to have the data re-sent. 
netscape/opera will not, they just wont send the data. what you can do to fix/patch 
this is to use method='get' vs method='post' because the previous page will now 
contain all the data in the url, the data will be re-sent. of course you now have alot 
of GET problems, like no spaces in your variable values, etc etc. you know all about 
those though.

I often here "php is ding this wrong, why does php do this, why is php pissing me off" 
haha. just think of this. "php is good, if what you are experiencing is bad, its your 
fault or your browsers, not php's, blame the browser" haha j/k
-- 

 Chris Lee
 [EMAIL PROTECTED]



"Carfield Yim" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Why the data in HTML form lost when the user press back button? And I
find that this problem only exist if I use session_start() to enable
session variable. But I can't disable it because the user information in
session useful in every pages

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






Does anyone know a good way to generate /good/ keys for algorithms used with
mcrypt? I know openssl has key generation scripts, and it seems a little
inane that mcrypt doesn't provide key generation functions. After all,
encryption algorithms are not secure without sufficiently random and
well-chosen keys.

I surely /must/ be missing something! Please let me know.

Dean Hall.






> Does anyone know a good way to generate /good/ keys for algorithms used
with
> mcrypt? I know openssl has key generation scripts, and it seems a little
> inane that mcrypt doesn't provide key generation functions. After all,
> encryption algorithms are not secure without sufficiently random and
> well-chosen keys.
>
> I surely /must/ be missing something! Please let me know.
>
> Dean Hall.

I'm sure there are "better" ways, but for what it's worth, here is what I
use to generate a good random key:

        mt_srand((double)microtime()*1000000);
        $rsess = uniqid(mt_rand());
        $ksess = mhash(MHASH_SHA1, $rsess);

I think the basic code here originated somewhere in the annotated PHP
manual. Depending on the algorithm you use, different key lengths will be
appropriate, so just trim this to the required length. Note that this
requires MHash as well as MCrypt, but you could substitute the built in MD5
function for SHA1.

Hope this helps,

Joe






Hi ppl

("select empname from employer where empno = (select employercode from badclient where 
pesal = '$Persal')")

Could anyone help me out with the syntax?

Im running an interbase db and php4.04

Thanks
Wade




Not sure what you are trying to do?
Not sure what a Persal is (maybe an Arial?)

Perhaps you want:

select
  E.empname
  from employer E, badclient B
  where E.employercode = B.employercode
    and E.pesal='$Persal'

Note there are two tables given aliases of E and B
that are JOINED by the first condition in the where clause.

Regards
Jeff

-----Original Message-----
From: Wade Halsey [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 11:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] sql problem


Hi ppl

("select empname from employer where empno = (select employercode from
badclient where pesal = '$Persal')")

Could anyone help me out with the syntax?

Im running an interbase db and php4.04

Thanks
Wade





Hi,
How can I check for existing site (e.g. http://www.somehost.com/someone)
and check for existing mail (e.g. [EMAIL PROTECTED])?

Thanks,
Rosen Marinov









On Friday 23 March 2001 12:25, you wrote:
> Hi,
> How can I check for existing site (e.g.
> http://www.somehost.com/someone) and check for existing mail (e.g.
> [EMAIL PROTECTED])?

You posted this exact question already 3 hours ago. Why did you post it a 
second time?

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




> Hi,
> How can I check for existing site (e.g.
> http://www.somehost.com/someone) and check for existing mail (e.g.
> [EMAIL PROTECTED])?

You will most likely find the answer at:
http://marc.theaimsgroup.com/?l=php-general&r=1&w=2 

If you don't get any joy at this address I'd also suggest visiting
http://www.google.com/search?q=validating+email+address+php where there are
"about 1,220" possible solutions for your problem.


HTH
Jon










**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************




Hi

I am trying to validate a form to check the user has entered there date of
birth correctly
There are three fields day, month & year.

how can I check whether a string is a number?

I have tried using is_long(), is_int(), is_integer() to check the values
,but it doesn't seem to be working.

the code I have tried is

if(!is_int($dobd))
{
  print "error";
}
else
{
  //carry on
}

could someone help me as to where I'm going wrong

TIA

M@





even better, verify the date as a whole rather then just as an int.

<?php

 $time = mktime(0, 0, 0, $month, $day, $year);
 
 $date  = getdate($time);
 $month = $date['mon'];
 $day  = $date['mday'];
 $year  = $date['year'];

?>

there you go, try it. someone puts an invalid date in? no problem it fixes it for you.


-- 

 Chris Lee
 [EMAIL PROTECTED]



""Matt Williams"" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi

I am trying to validate a form to check the user has entered there date of
birth correctly
There are three fields day, month & year.

how can I check whether a string is a number?

I have tried using is_long(), is_int(), is_integer() to check the values
,but it doesn't seem to be working.

the code I have tried is

if(!is_int($dobd))
{
  print "error";
}
else
{
  //carry on
}

could someone help me as to where I'm going wrong

TIA

M@


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






--
§ Origin:淡紫香風信亭 <er.twbbs.org> § 
from:er.twbbs.org §




I have problem about using session with php that have version newer than 4.03pl1.
this is the test code.
-----------------
test_session.php
-----------------
<?php
session_start();
session_register("abc");
print "\$PHPSESSID -> $PHPSESSID<br>";
$abc = 1;
?>
<A HREF="test_session2.php">test_session2</A>
-------------------------------------------------------
result is:
$PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
test_session2  
------------------
test_session2.php
------------------
<?php
print "\$PHPSESSID -> $PHPSESSID<br>";
print "\$abc   -> $abc<br>";
?>
-------------------------------------------------------
result is:
$PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
$abc ->  

this is the configuration:
Session Support enabled
Directive                    Local Value        Master Value
---------                    -----------       ------------
session.auto_start           Off               Off
session.cache_expire        80               180
session.cache_limiter        nocache       nocache
session.cookie_domain      no value       no value
session.cookie_lifetime      0                 0
session.cookie_path          /                 /
session.cookie_secure       Off              Off
session.entropy_file          no value       no value
session.entropy_length      0                0
session.gc_maxlifetime      1440            1440
session.gc_probability       1                 1
session.name                   PHPSESSID    PHPSESSID
session.referer_check        no value       no value
session.save_handler         files             files
session.save_path             /tmp            /tmp
session.serialize_handler     php             php
session.use_cookies           On              On<br clear=all><hr>Get Your Private, 
Free E-mail from MSN Hotmail at <a 
href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p>




Hi,

Try:

session_start_start();

for a change. If you don't it will never work. Not even with versions
older than 4.03pl1.

RenzE.


On Fri, Mar 23, 2001 at 07:03:37PM +0700, Weerapong Sirikanya wrote:
> I have problem about using session with php that have version newer than 4.03pl1.
> this is the test code.
> -----------------
> test_session.php
> -----------------
> <?php
> session_start();
> session_register("abc");
> print "\$PHPSESSID -> $PHPSESSID<br>";
> $abc = 1;
> ?>
> <A HREF="test_session2.php">test_session2</A>
> -------------------------------------------------------
> result is:
> $PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
> test_session2  
> ------------------
> test_session2.php
> ------------------
> <?php
> print "\$PHPSESSID -> $PHPSESSID<br>";
> print "\$abc   -> $abc<br>";
> ?>
> -------------------------------------------------------
> result is:
> $PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
> $abc ->  
> 
> this is the configuration:
> Session Support enabled
> Directive                    Local Value        Master Value
> ---------                    -----------       ------------
> session.auto_start           Off               Off
> session.cache_expire        80               180
> session.cache_limiter        nocache       nocache
> session.cookie_domain      no value       no value
> session.cookie_lifetime      0                 0
> session.cookie_path          /                 /
> session.cookie_secure       Off              Off
> session.entropy_file          no value       no value
> session.entropy_length      0                0
> session.gc_maxlifetime      1440            1440
> session.gc_probability       1                 1
> session.name                   PHPSESSID    PHPSESSID
> session.referer_check        no value       no value
> session.save_handler         files             files
> session.save_path             /tmp            /tmp
> session.serialize_handler     php             php
> session.use_cookies           On              On<br clear=all><hr>Get Your Private, 
>Free E-mail from MSN Hotmail at <a 
>href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p>




Oops....

Should be:

session_start();

ofcourse, instead of session_start_start();

RenzE.




you have to register the variable after it is set, not before. also only register the 
variable once, dont keep re-registering it, some builds ie php-4.0.5 (snap) doesnt 
like re-registering vars (sometimes).

<?php

 include_once('time.egn');

 if ( isset($PHPSESSID) )
  session_id($PHPSESSID);

 session_start();

 if (!isset($HTTP_SESSION_VARS['SessionID']))
 {
  $SessionID = mtime();
  session_register('SessionID');
 }

 $PHPSESSID = session_id();
 $SID = "PHPSESSID=$PHPSESSID";

?>

this is my session file, works great for me.


-- 

 Chris Lee
 [EMAIL PROTECTED]



""Weerapong Sirikanya"" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I have problem about using session with php that have version newer than 4.03pl1.
this is the test code.
-----------------
test_session.php
-----------------
<?php
session_start();
session_register("abc");
print "\$PHPSESSID -> $PHPSESSID<br>";
$abc = 1;
?>
<A HREF="test_session2.php">test_session2</A>
-------------------------------------------------------
result is:
$PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
test_session2  
------------------
test_session2.php
------------------
<?php
print "\$PHPSESSID -> $PHPSESSID<br>";
print "\$abc   -> $abc<br>";
?>
-------------------------------------------------------
result is:
$PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
$abc ->  

this is the configuration:
Session Support enabled
Directive                    Local Value        Master Value
---------                    -----------       ------------
session.auto_start           Off               Off
session.cache_expire        80               180
session.cache_limiter        nocache       nocache
session.cookie_domain      no value       no value
session.cookie_lifetime      0                 0
session.cookie_path          /                 /
session.cookie_secure       Off              Off
session.entropy_file          no value       no value
session.entropy_length      0                0
session.gc_maxlifetime      1440            1440
session.gc_probability       1                 1
session.name                   PHPSESSID    PHPSESSID
session.referer_check        no value       no value
session.save_handler         files             files
session.save_path             /tmp            /tmp
session.serialize_handler     php             php
session.use_cookies           On              On<br clear=all><hr>Get Your Private, 
Free E-mail from MSN Hotmail at <a 
href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p>






Hi All,

How can I show images, captured by a webcamp, in my website using PHP ???

Thanks,

Marcelo Pereira






wow thats a vague question :)

are you trying to display them to the user?

    echo "
    <img src='/path/imagename.jpg'>
    ";

or are you trying to read that data ?

    fopen('/path/imagename.jpg', 'r');

is the file not in the document root ?

    header('Content-Type: image/jpeg');
    readfile('/path/imagename.jpg');


-- 

 Chris Lee
 [EMAIL PROTECTED]



""Marcelo Pereira"" <[EMAIL PROTECTED]> wrote in message 
006001c0b396$05167cc0$0b01a8c0@hmmg">news:006001c0b396$05167cc0$0b01a8c0@hmmg...
Hi All,

How can I show images, captured by a webcamp, in my website using PHP ???

Thanks,

Marcelo Pereira








On Friday 23 March 2001 00:04, you wrote:
> you dont... as far as i know,
> crypt only works on <= 8 chars
> it will truncate anything over 8.

That's "traditional" Unix crypt. PHP's crypt() may also understand other 
crypt algorithms that can handle longer passwords. Check the manual.

> > the problem I am having is that it is only comparing the first 8
> > characters of the password

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




On Thursday 22 March 2001 16:17, you wrote:
> i'm still getting the hang of regexps, however i have on small problem
> - I can't seem to make one to work on a US telephone number.  does
> anyone have something similar that i could work from?

Well, how does/can a US telephone number look like?

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




On Friday 23 March 2001 01:49, you wrote:
> > Use \r\n for email line breaks.
>
> Should I write a function that replace any corrance of '\n' with '\r\n'
> in a string myself?
> Hard to believe that the PHP guys haven't encountered this before and
> didn't write some PHP function to do this for us, not?

Well, 
str_replace('\n', '\r\n', $MyText); 
isn't so tedious to type that you need an extra function for it I'd say...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Never doubt that a small group of thoughtful, committed people can
change the world...
Indeed, it's the only thing that ever has."

- Margaret Mead




Ok, I'm not really getting this.  Without anything in my php.ini I was able to
register session vars just like session_register('var') and then access them
using $GLOBALS['var'].  From what I'm gathering there's a performance hit from
using the $GLOBALS?  So I turned register_globals off, I'm registering my
session vars the same way (i.e. session_register('var')) and then I try to
access them with $HTTP_SESSION_VARS['var'], but I don't see my variables.  I
also defined $HTTP_SESSION_VARS as a global at the top of my function.  Does
anyone know exactly how this works or can point me to a reference page that
has how this works?  Thanks in advance for any replies.

-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



******************************************************************
This communication is for informational purposes only.  It is not
intended as an offer or solicitation for the purchase or sale of 
any financial instrument or as an official confirmation of any 
transaction, unless specifically agreed otherwise.  All market 
prices, data and other information are not warranted as to 
completeness or accuracy and are subject to change without
notice.  Any comments or statements made herein do not 
necessarily reflect the views or opinions of Capital Institutional
Services, Inc.  Capital Institutional Services, Inc. accepts no
liability for any errors or omissions arising as a result of
transmission.  Use of this communication by other than intended
recipients is prohibited.
******************************************************************




I have never heard that $GLOBALS[''] causes performance issues, where did you get this 
info? does $HTTP_SESSION_VARS work if you turn 
    
    register_globals on;

in php.ini? here is my session.egn file.

<?php

 include_once('time.egn');

 if ( isset($PHPSESSID) )
  session_id($PHPSESSID);

 session_start();

 if (!isset($HTTP_SESSION_VARS['SessionID']))
 {
  $SessionID = mtime();
  session_register('SessionID');
 }

 $PHPSESSID = session_id();
 $SID = "PHPSESSID=$PHPSESSID";

?>


-- 

 Chris Lee
 [EMAIL PROTECTED]



"Michael Champagne" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Ok, I'm not really getting this.  Without anything in my php.ini I was able to
register session vars just like session_register('var') and then access them
using $GLOBALS['var'].  From what I'm gathering there's a performance hit from
using the $GLOBALS?  So I turned register_globals off, I'm registering my
session vars the same way (i.e. session_register('var')) and then I try to
access them with $HTTP_SESSION_VARS['var'], but I don't see my variables.  I
also defined $HTTP_SESSION_VARS as a global at the top of my function.  Does
anyone know exactly how this works or can point me to a reference page that
has how this works?  Thanks in advance for any replies.

-- 
Michael Champagne, Software Engineer
Capital Institutional Services, Inc.
wk: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



******************************************************************
This communication is for informational purposes only.  It is not
intended as an offer or solicitation for the purchase or sale of 
any financial instrument or as an official confirmation of any 
transaction, unless specifically agreed otherwise.  All market 
prices, data and other information are not warranted as to 
completeness or accuracy and are subject to change without
notice.  Any comments or statements made herein do not 
necessarily reflect the views or opinions of Capital Institutional
Services, Inc.  Capital Institutional Services, Inc. accepts no
liability for any errors or omissions arising as a result of
transmission.  Use of this communication by other than intended
recipients is prohibited.
******************************************************************

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






        Thanks. I just grabbed the source and am looking over it. The way the
red hat RPM is configed is perfect for me except for the exclusion of
enable-trans-sid. Am I correct in assuming in addition to using
--enable-trans-sid that I should also use the current config options
displayed by phpinfo() ?

Larry H.

"..s.c.o.t.t.. [gts]" wrote:
snip.............. 
> (replace php..... with whatever the PHP
> tarball is named)
> 
> at the prompt (you dont need to be root) type:
> tar xvfz php.....tar.gz
> cd php.....
> ./configure --enable-trans-sid
> make
> make test
> 
> if you didnt get any errors, then (as root) type:
> make install
snip...................




does anybody know how to switch off entities resoving in PHP XML?

thanks







Do it in MySQL = Fast
Don't fiddle in PHP = waste of your time.

Look into the following:

select
    UNIX_TIMESTAMP(date1)-UNIX_TIMESTAMP(date1) as diff_secs,
    TO_DAYS(date1)-TO_DAYS(date1)               as diff_days,
    PERIOD_DIFF(date1,date2)                    as diff_months,
    YEAR(date1) - YEAR(date2)                   as diff_years
  from MYTABLE 
  where id=$id

I'm not sure what
  select date1-date2 as date_diff
returns?

beware of the 2037 limitation using UNIX_TIMESTAMP()

regards
Jeff



-----Original Message-----
From: BlackLord [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 5:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Date subtraction


Hi!

I want to subtract to date times from each other. Like :

'2000 12 01 12:12:12' - '2000 11 10 11:39:59'

Is there any function to do this subtraction or can i do it with MySQL's
SELECT query ?

Thanks



-- 
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 david, thanks for the response! would u also know how i can read some
excel and powerpoint files?

thanks/erick




> If youu are on a *nix system, there is a package called mswordview, or
> alternatively you could check the www.htdig.org site for document parsers
> (catdoc.pl and parsedoc.pl, I think).







actually, i am not sure how i can use this to convert an uploaded word or
pdf file into plain text and then do somethign with that text? can someone
please help?

thanks/erick







Hi all,

I'm trying to upload a file from a client browser to my server.

On the client side, I've got:

        <FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST>
        <!-- <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> -->
        Send this file: <INPUT NAME="userfile" TYPE="file">
        <INPUT TYPE="submit" VALUE="Send File">
        </FORM>

On the server side, I've got:

        echo ("$userfile<br>");
        echo ($HTTP_POST_FILES['userfile']['name'] ."<br>");
        echo ($HTTP_POST_FILES['userfile']['type'] ."<br>");
        echo ($HTTP_POST_FILES['userfile']['size'] ."<br>");
        echo ($HTTP_POST_FILES['userfile']['tmp_name']  ."<br>");

        if (move_uploaded_file($userfile,
"/home/jalmberg/public_html/qiksys/images/temp.jpg"))
                print("moved file");
        else
                print("couldn't move file!");

When I try to use this, I get:

=============================
/tmp/phpa21470
test.jpg
image/pjpeg
21917
/tmp/phpa21470

Warning: Unable to create
'/home/jalmberg/public_html/qiksys/images/temp.jpg': Permission denied in
/home/jalmberg/public_html/qiksys/upload.php on line 57

Warning: Unable to move '/tmp/phpa21470' to
'/home/jalmberg/public_html/qiksys/images/temp.jpg' in
/home/jalmberg/public_html/qiksys/upload.php on line 57
couldn't move file!
==============================

I check the php.ini file and safe mode is turned off. I've also tried with a
text file, same result. I have permission to access the above directory . .
. the php files working this magic are located in
/home/jalmberg/public_html/qiksys.

Probably there is a simple answer to this question, but I'm out of ideas!
Any help???

Thanks in advance.

John





Don't forget, PHP (in general) runs as the webserver (normally "nobody" or
"apache" for Apache servers). Make sure your webserver has write access to
/home/jalmberg/public_html/qiksys/images/

adamw

----- Original Message -----
From: "John Almberg" <[EMAIL PROTECTED]>
To: "PHP General List" <[EMAIL PROTECTED]>
Sent: Friday, March 23, 2001 2:50 PM
Subject: [PHP] Permission denied


> Hi all,
>
> I'm trying to upload a file from a client browser to my server.
>
> On the client side, I've got:
>
> <FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST>
> <!-- <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000"> -->
> Send this file: <INPUT NAME="userfile" TYPE="file">
> <INPUT TYPE="submit" VALUE="Send File">
> </FORM>
>
> On the server side, I've got:
>
> echo ("$userfile<br>");
> echo ($HTTP_POST_FILES['userfile']['name'] ."<br>");
> echo ($HTTP_POST_FILES['userfile']['type'] ."<br>");
> echo ($HTTP_POST_FILES['userfile']['size'] ."<br>");
> echo ($HTTP_POST_FILES['userfile']['tmp_name']  ."<br>");
>
> if (move_uploaded_file($userfile,
> "/home/jalmberg/public_html/qiksys/images/temp.jpg"))
> print("moved file");
> else
> print("couldn't move file!");
>
> When I try to use this, I get:
>
> =============================
> /tmp/phpa21470
> test.jpg
> image/pjpeg
> 21917
> /tmp/phpa21470
>
> Warning: Unable to create
> '/home/jalmberg/public_html/qiksys/images/temp.jpg': Permission denied in
> /home/jalmberg/public_html/qiksys/upload.php on line 57
>
> Warning: Unable to move '/tmp/phpa21470' to
> '/home/jalmberg/public_html/qiksys/images/temp.jpg' in
> /home/jalmberg/public_html/qiksys/upload.php on line 57
> couldn't move file!
> ==============================
>
> I check the php.ini file and safe mode is turned off. I've also tried with
a
> text file, same result. I have permission to access the above directory .
.
> . the php files working this magic are located in
> /home/jalmberg/public_html/qiksys.
>
> Probably there is a simple answer to this question, but I'm out of ideas!
> Any help???
>
> Thanks in advance.
>
> John
>
>
> --
> 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 Adam,

thanks for your quick repsonse. I'm just renting space on a (Linux/Apache)
server, so I don't have any control over how PHP is configured on the
machine. Perhaps there is a way for me to change my 'local' PHP
configuration? I don't know much about this aspect of PHP, obviously. I'm
just trying to ask obvious questions.

Alternatively, can my PHP application log-in, and thus obtain permission?

John





Adam,

Just ran phpinfo and you are correct: the Apache User/Group is "nobody".

H'mmmm. This sounds like a problem. Hope there is an answer!

- John





If you have shell access to the box, you can chgrp some stuff and allow PHP
to write to it. Otherwise, you'll have to talk to the ISP directly (get them
to setup setuid versions of common shell commands for this sort of
requirement). There is no way to make PHP 'login', any as PHP is server
side, nothing you change locally can affect it.

adamw

----- Original Message -----
From: "John Almberg" <[EMAIL PROTECTED]>
To: "PHP General List" <[EMAIL PROTECTED]>
Sent: Friday, March 23, 2001 3:27 PM
Subject: RE: [PHP] Permission denied


> Adam,
>
> Just ran phpinfo and you are correct: the Apache User/Group is "nobody".
>
> H'mmmm. This sounds like a problem. Hope there is an answer!
>
> - John
>
>
> --
> 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,

i am using my program

    http://localhost/test.php

inside this program is a form, which points to $PHP_SELF

but, when i submit this form, the link actually becomes

    http://localhost/php/php.exe/test.php

this results in some images not being displayed correctly!

is there anyway i can disable this, and make the PHP SELF same as the
original?

thanks/erick








a common problem:

you have compiled PHP as CGI,

make it run as a module, and that problem will disappear.

well, if you really want to have it under CGI, try to check phpinfo() for a
solution



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com






-----Original Message-----
From: Erick Papadakis [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 24, 2001 12:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP_SELF problems!


hi,

i am using my program

    http://localhost/test.php

inside this program is a form, which points to $PHP_SELF

but, when i submit this form, the link actually becomes

    http://localhost/php/php.exe/test.php

this results in some images not being displayed correctly!

is there anyway i can disable this, and make the PHP SELF same as the
original?

thanks/erick





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






Ok these sessions have got me all confused, I need to have two seperate 
sessions one for when a user signs up, to stop them using there back button 
and inadvertantly signing up twice. And then one when they login. Both of 
them work great as standalone but if say I went and log into my account and 
then decide I need another, the sign up page blocks me because I already have 
a session running. Here is some code will probably help me explain my system.

if(!$PHPSESSID)
{
$SET=1;
}elseif($PHPSESSID=1)
{
echo"<CENTER>You are already Registered, please click <A HREF='login.php'>here
</A> to login.</CENTER>";
die;
}
if($SET=1)
{
session_start();
session_register("SET");
}

This checks to see if there is a session running, if there is it blocks them 
and sends them to the log in page, if there isn`t the rest of my script sets 
up the account and then forwards them to the log in screen, so if for any 
reason they decide to use there back button they can`t create two accounts by 
accident.

Then when they log in I start a session as follows:

session_start();
session_register("UserName","Password");
header ("Location: Http://www.tothemembersarea.com/");


So if I go to my system log in and then try to setup a new account it blocks 
me, any idea how I can distinguish between the two??

TIA
Ade




If that's a copy of your code, you might want to check the if($SET=1)
line...that will always return true, because you're setting a variable, not
checking for equality...should be if($SET==1) instead....

jack

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 10:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Session Confusion


Ok these sessions have got me all confused, I need to have two seperate
sessions one for when a user signs up, to stop them using there back button
and inadvertantly signing up twice. And then one when they login. Both of
them work great as standalone but if say I went and log into my account and
then decide I need another, the sign up page blocks me because I already
have
a session running. Here is some code will probably help me explain my
system.

if(!$PHPSESSID)
{
$SET=1;
}elseif($PHPSESSID=1)
{
echo"<CENTER>You are already Registered, please click <A
HREF='login.php'>here
</A> to login.</CENTER>";
die;
}
if($SET=1)
{
session_start();
session_register("SET");
}

This checks to see if there is a session running, if there is it blocks them
and sends them to the log in page, if there isn`t the rest of my script sets
up the account and then forwards them to the log in screen, so if for any
reason they decide to use there back button they can`t create two accounts
by
accident.

Then when they log in I start a session as follows:

session_start();
session_register("UserName","Password");
header ("Location: Http://www.tothemembersarea.com/");


So if I go to my system log in and then try to setup a new account it blocks
me, any idea how I can distinguish between the two??

TIA
Ade

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







If that's a copy of your code, you might want to check the if($SET=1)
line...that will always return true, because you're setting a variable, not
checking for equality...should be if($SET==1) instead....

jack

Ooops ok put that bit right, I should really know better :-) but it still 
doesn`t solve the overal problem LoL

Thanks for pointing it out though

Ade




Folks,

I am in the process of trying to install PHP 4.0.4pl1 on my Digital Unix 5.1
machine.  I follow the instructions from php.net and in the install
instructions.  I can do everything right but, after I run the ./configure
--with-mysql --with-apache=../apachex --enable-track-vars, I run the make.
When running the make it starts of really god, but then it seems toward the
end it fails, I get the following error message:

 
/opt/TWWfsw/gcc29/lib/gcc-lib/alpha-dec-osf5.0/2.95.2/include/va-alpha.h:36:
war
ning: redefinition of `va_list'
/opt/TWWfsw/gcc29/lib/gcc-lib/alpha-dec-osf5.0/2.95.2/include/va_list.h:7:
warni
ng: `va_list' previously declared here
mips-tfile, /tmp/ccTX1BTq.s:8 Invalid .stabs/.stabn directive, value not
found
line:    #.stabs "/usr/local/php-4.0.4pl1/Zend/",100,0,0,$Ltext0

mips-tfile, /tmp/ccTX1BTq.s:9 Invalid .stabs/.stabn directive, value not
found
line:    #.stabs "zend_sprintf.c",100,0,0,$Ltext0

mips-tfile, /tmp/ccTX1BTq.s:194 Segmentation fault
line:    #.stabs "zend_write_func_t:t269=253",128,0,246,0

*** Exit 1
Stop.
*** Exit 1
Stop.

Does anyone know why I would get this, and how I could fix it.  Is there any
reported bugs that I am missing.

Thanks
David





Maybe someone could help with this? I'm trying to remove white space values from my 
array, and resequence them, so that the following:

foo[0] = "value",
foo[1] = " ",
foo[2] = "value",
foo[3] = " ",
foo[4] = "value"

after running through a piece of code would turn into

foo[0] = "value",
foo[1] = "value",
foo[2] = "value",
foo[3] = null,
foo[4] = null,

The code I wrote, and deleted out of frustration ended up with all of the variables 
equal to null. Maybe someone could show me the proper way?

PKshifted





One way to do it is to spin through the original array using a for/next loop
and build a second array of only the rows you want to keep. Then, rename the
new array to the old array. ($oldArray = $newArray;)

Cal
http://www.calevans.com


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 10:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Array Cleansing



Maybe someone could help with this? I'm trying to remove white space values
from my array, and resequence them, so that the following:

foo[0] = "value",
foo[1] = " ",
foo[2] = "value",
foo[3] = " ",
foo[4] = "value"

after running through a piece of code would turn into

foo[0] = "value",
foo[1] = "value",
foo[2] = "value",
foo[3] = null,
foo[4] = null,

The code I wrote, and deleted out of frustration ended up with all of the
variables equal to null. Maybe someone could show me the proper way?

PKshifted


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






Few of us have time to play with your script, but

if you refer to the fact that the form you submitted and once new page came
up - you clicked back seeing nothing, that is something that happens most of
the time.

As Sascha once explained that to me - that is the way Sessions work.

well, if that is not what you're referring to, then please copy that code in
your email and we'll think about it.




Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




  -----Original Message-----
  From: Miguel Loureiro [mailto:[EMAIL PROTECTED]]
  Sent: Friday, March 23, 2001 3:43 AM
  To: php-gen
  Subject: [PHP] sessions.. again...


  Hello all,
  I'm mad with me....sorry but see if can understand why I'm mad.
  Copy the 3 attached files, and run it.
  In one.php just click to the link (it works.....), now in two.php you can
see: " and now: aaaaaaa", cool hum...
  Clicking in OFF link you can see the result of phpinfo, but section of
Apache Evironment, in HTTP_COOKIE you (at least I have) the PHPSESSID with
value, in spite of in off.php code I make a session_destroy????
  Now if you use history back button, go to two.php, and OK the session
variable dont appear, Back again, Forward and voila' here is
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
  I have try to follow some Jeff Armstrong tips, but I have no success.Thank
you very much Jeff (really...I'm no jocking...).
  Any ideas ??
  T.Y all

  Best Regards
  Miguel Loureiro <[EMAIL PROTECTED]>




I guess it was designed a while ago...

can't find any other solution.. ;-))


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Michael Geier [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 2:05 AM
To: PHP Mailing List
Subject: [PHP] Freshmeat Ad?


Is there a reason Freshmeat is showing a banner stating "PHP 4.01pl2 is
out"?  Especially since the binary is up to 4.04pl1.

Michael Geier
CDMSports Systems Administration
 EMail: [EMAIL PROTECTED]
 Phone: 314.991.1511 x 6505


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






Oh yeah, at my work I do it all the time,

the simplest way is to create a small function which will:

$SQL = "SELECT * FROM table WHERE ID=$id";

and then (whatever method you use) catch that array and call some 

function moveMe($array='') {
   if(!is_array($array) or $array=='')
        Return False;

   /// Loop this array creating a query like:
 
   /// Prepare the array in this format:
   /// $staff[] = "this='that'";
   /// $staff[] = "that='this'";

   /// $SQL = 'INSERT INTO table2 SET '.implode(',', $staff);

   /// And vua la! insert it !
}


hope this was of some help to you,



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com





-----Original Message-----
From: YoBro [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 8:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Move data from one MySql table to another?


I need to know how to do it in PHP?


""Cal Evans"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
: Probably on the MySQL list.  This is the PHP. (This is arguments,abuse is
: down the hall.)
:
: Try:
: http://www.mysql.com/documentation/lists.html
:
:
: Cal
: http://www.calevans.com
:
:
: -----Original Message-----
: From: YoBro [mailto:[EMAIL PROTECTED]]
: Sent: Thursday, March 22, 2001 5:20 PM
: To: [EMAIL PROTECTED]
: Subject: [PHP] Move data from one MySql table to another?
:
:
: Hello,
:
: Does anybody know where I could find out how to Move data from one Mysql
: table to another.
:
: I have a query showing all the results, and I am trying to put a link at
the
: end of each row that says "move"
:
: Clicking this will move that records information to another table.
: IE From table orders to table ordered
:
: Make sense?
:
: Please help
:
: --
: Regards,
:
:
: YoBro
: -------------------------------------------------------------
: DO NOT REPLY TO THIS VIA EMAIL
: PLEASE USE THE NEWSGROUP
: All emails sent to this address are automatically deleted.
: This is to avoid SPAM!
: -------------------------------------------------------------
:
:
:
: --
: 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]
:



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






All you need is to add this into .htaccess

php_value auto_prepend auth.php

when any file under that directory is being accessed, auth.php will come on
top, there - make your own script to pass-protect yourself..



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Kyutums [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 23, 2001 10:28 AM
To: Php-General
Subject: [PHP] Sessions to password protect directory?


Good day to all!

Before, I was able to password protect html and php files via a username
and passowrd script which used sessions. Now, I need to password protect
a folder (via .htaccess) that has images (for a family album thing). Can
this be done via sessions (or even cookies)? I don't want to
authenticate the user via forms and not via the pop-up that a browser
presents when using an .htaccess file. Any scripts that already do this
(password protect a directory)?

Thanks for all your help.

- Kyutums


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






Sorry I deleted the message, but here are some options for converting word
docs on the fly. I'd think you could easily pipe docs through these tools to
get the output you want.

http://word2x.alcom.co.uk/

http://www.wvWare.com/

an online document converter using wv to do the conversion. Works fairly
well when I've needed it.
http://www.freeviewer.com/

DAve
--
Dave Goodrich
Director of Interface Development
Reality Based Learning Company
9521 NE Willows Road, Suite 100
Redmond, WA 98052 
Toll Free 1-877-869-6603 ext. 237
Fax (425) 558-5655 
[EMAIL PROTECTED] 
http://www.rblc.com






I'm using an .htaccess file to auto_append and auto_prepend files within a 
specific directory, and it works great.  Unfortunaltely if I create a new 
sub-directory that doesn't have it's own .htaccess file, it too tries to 
use the auto_append and auto_prepend values of the .htaccess file from the 
parent directory.  In this subdirectory, I don't want anything appended or 
prepended to my php scripts.  SO what I always end up doing is creating a 
new .htaccess file in this subdirectory and create and empty file and use 
this filename and path in that new .htaccess file.

Over all, it's a bit of a PITA...  so is there a way to override the 
auto_append and auto_prepend from an .htaccess file in a parent directory 
without having to go through all this every time I create a new directory?


Joseph E. Sheble
[EMAIL PROTECTED]
========================
Wizaerd's Realm
http://www.wizaerd.com



Reply via email to