php-windows Digest 24 Jun 2002 19:29:24 -0000 Issue 1209
Topics (messages 14361 through 14384):
This crazy code works, but is this the correct and elegant way on 4.21 ?
14361 by: Saci
14362 by: Christian Leberfinger
14363 by: Christian Leberfinger
14364 by: Saci
14365 by: Matt Parlane
14369 by: Saci
Color parser? what?
14366 by: Alberto. Sartori
14368 by: Matt Parlane
mod_auth_sspi
14367 by: Carl Whittaker
Class question
14370 by: Alberto. Sartori
Moron question: What is the & in a class meant to do?
14371 by: Asendorf, John
14372 by: Svensson, B.A.T. (HKG)
14373 by: Chris Boget
14374 by: Daniel Beulshausen
function definitions
14375 by: Bill Hudspeth
Using Bzip2 to create an archive...
14376 by: Mikey
14377 by: Mikey
14380 by: Ross Fleming
Re: Get/Post and Security Issues
14378 by: Dash McElroy
14379 by: Mikey
14381 by: Brian Graham
14382 by: Brian Graham
14383 by: Brian Graham
PHP and Cookies
14384 by: James Meers
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 ---
<?php
if (isset($_POST['location']) AND $_POST['location'] != "" AND
$_POST['location'] != "none")
{
header("Location: ".$_POST['location']);
exit;
}
else ?>
<html>
<body>
<?php echo "Select one site to go ";?>
</body>
</html>
<FORM method = "POST" action ="">
<SELECT name = "location" size = "1">
<OPTION value = "none">None</OPTION>
<OPTION value = "http://www.microsoft.com/">Microsoft</OPTION>
<OPTION value = "http://www.altavista.com/">Altavista</OPTION>
<OPTION value = "http://php.net/">Php.net</OPTION>
</SELECT>
<Input type = "submit" Value = "GO"></FORM>
--- End Message ---
--- Begin Message ---
No.
This is the most elegant way I'm aware of:
<?php
if (isset($_POST['location']) AND $_POST['location'] != "" AND
$_POST['location'] != "none") {
header("Location: ".$_POST['location']);
} else {
echo "Select one site to go ";
?>
<FORM method = "POST" action ="">
<SELECT name = "location" size = "1">
<OPTION value = "none">None</OPTION>
<OPTION value = "http://www.microsoft.com/">Microsoft</OPTION>
<OPTION value = "http://www.altavista.com/">Altavista</OPTION>
<OPTION value = "http://php.net/">Php.net</OPTION>
</SELECT>
<Input type = "submit" Value = "GO"></FORM>
<?php
} //endif
?>
--- End Message ---
--- Begin Message ---
sorrysorrysorry - I didn't see the exit.
The other way really was the better one.
But what is crazy about this piece of code?
Chris
--- End Message ---
--- Begin Message ---
I guess that this code are crazy, because this code come from my mind, a 2
day newbye on PHP.
The "crazy thing is putting half code prior to <html> <body> and half after.
"Christian Leberfinger" <[EMAIL PROTECTED]> escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> sorrysorrysorry - I didn't see the exit.
> The other way really was the better one.
>
> But what is crazy about this piece of code?
>
>
> Chris
--- End Message ---
--- Begin Message ---
Hiya...
This probably isn't really the right place to discuss this kind of thing,
but to be pedantic, you probably shouldn't have content (like the form tag)
after your </html> tag - it's just not well-formed HTML.
You could of course argue that you probably shouldn't have the "Select one
site to go " text in a php block, but instead just write it out using html -
but that's fairly over the top. oh - and you should have all your html tags
in lower case, otherwise it's not xhtml/xml compliant... You did ask
about elegance.... :)
Matt
Nicely formatted code:
<?php
if (isset($_POST['location']) AND $_POST['location'] != "" &&
$_POST['location'] != "none")
{
header("Location: ".$_POST['location']);
exit;
}
?>
<html>
<body>
Select one site to go:
<br />
<form method="POST" action="">
<select name="location" size="1">
<option value="none">None</option>
<option value="http://www.microsoft.com/">Microsoft</option>
<option value="http://www.altavista.com/">Altavista</option>
<option value="http://php.net/">Php.net</option>
</select>
<input type="submit" value="GO" />
</form>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Saci" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> <?php
> if (isset($_POST['location']) AND $_POST['location'] != "" AND
> $_POST['location'] != "none")
> {
> header("Location: ".$_POST['location']);
> exit;
> }
> else ?>
> <html>
> <body>
> <?php echo "Select one site to go ";?>
> </body>
> </html>
> <FORM method = "POST" action ="">
> <SELECT name = "location" size = "1">
> <OPTION value = "none">None</OPTION>
> <OPTION value = "http://www.microsoft.com/">Microsoft</OPTION>
> <OPTION value = "http://www.altavista.com/">Altavista</OPTION>
> <OPTION value = "http://php.net/">Php.net</OPTION>
> </SELECT>
> <Input type = "submit" Value = "GO"></FORM>
>
>
>
--- End Message ---
--- Begin Message ---
It's not pedantic.
I asked for that, this will help on improvement.
Thank you
> This probably isn't really the right place to discuss this kind of thing,
> but to be pedantic, you probably shouldn't have content (like the form
tag)
> after your </html> tag - it's just not well-formed HTML.
>
--- End Message ---
--- Begin Message ---
Hi guys, I got a funny questions. I need to create a html page with some php code
color-parsed (I mean, the tags all coloured in different way in case of html tags,
comments etc...), like HomeSite do. But I need to put out in html final page. I've to
do this sucking work handly? Thanks!
<? Alberto Sartori - Developer ?>
--- End Message ---
--- Begin Message ---
I'm not sure if this is what you're talking about, but have a look
http://www.php.net/manual/en/function.show-source.php
The colour settings are taken from php.ini
Matt
"Alberto. Sartori" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]
...
Hi guys, I got a funny questions. I need to create a html page with some php
code color-parsed (I mean, the tags all coloured in different way in case of
html tags, comments etc...), like HomeSite do. But I need to put out in html
final page. I've to do this sucking work handly? Thanks!
<? Alberto Sartori - Developer ?>
--- End Message ---
--- Begin Message ---
This module is the answer to all my prayers!
but i cant get it to work :(
I know this isnt strictly a php question but if anyone can help me id be
forever in their debt
im running Win2k and Apache 2.0.39 over a medium sized lan with a domain.
the problem im having is that when i try to install mod_auth_sspi i get a
message telling me that it is an incompatible version heres the exact
message:
Apache.exe: module "mod_auth_sspi.c" is not compatible with this version of
Apache.
Please contact the vendor for the correct version.
now on the mods site it says and i quote
"The current release works with Apache 2.0.35 and later releases"
heres the site address
http://www.syneapps.com/software/mod_auth_sspi/
this is the line i have added to httpd.conf
LoadModule sspi_auth_module modules/mod_auth_sspi.so
im using the binary version because i havent got a c++ prog to compile it
myself.
Thanks,
Carl
--- End Message ---
--- Begin Message ---
Hi guys. I got a little problem. I created a simply class:
$istance=new MyClass();
$istance->Think("hi");
The method "think" must return a variable and the user can handle it. How can I do
this?
Thanks in advance,Alb
--- End Message ---
--- Begin Message ---
I'm a bit confused. I keep stealing code and using it for my own devious
purposes and parts of it I don't understand. What is the "&" in a piece of
code that looks like this meant to do? I looked all through the Class stuff
in the docs but can't seem to find the reason for it.
$foo = &$bar->some_function();
Thanks in advance, John
---------------------
John Asendorf - [EMAIL PROTECTED]
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit
--- End Message ---
--- Begin Message ---
Looks like "stolen" syntax from C/C++: E.g. it is a reference to the variable,
a.k.a. as pointer.
> -----Original Message-----
> From: Asendorf, John [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 3:06 PM
> To: Php-Windows (E-mail)
> Subject: [PHP-WIN] Moron question: What is the & in a class meant to do?
>
>
> I'm a bit confused. I keep stealing code and using it for my own devious
> purposes and parts of it I don't understand. What is the "&" in a piece of
> code that looks like this meant to do? I looked all through the Class stuff
> in the docs but can't seem to find the reason for it.
>
> $foo = &$bar->some_function();
>
> Thanks in advance, John
>
> ---------------------
> John Asendorf - [EMAIL PROTECTED]
> Web Applications Developer
> http://www.lcounty.com - NEW FEATURES ADDED DAILY!
> Licking County, Ohio, USA
> 740-349-3631
> Nullum magnum ingenium sine mixtura dementiae fuit
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
> I'm a bit confused. I keep stealing code and using it for my own devious
> purposes and parts of it I don't understand. What is the "&" in a piece of
> code that looks like this meant to do? I looked all through the Class stuff
> in the docs but can't seem to find the reason for it.
> $foo = &$bar->some_function();
I've never seen it used like that, but the & means pass "by reference" instead
of the default *by value".
Chris
--- End Message ---
--- Begin Message ---
At 09:06 24.06.2002 -0400, Asendorf, John wrote:
>I'm a bit confused. I keep stealing code and using it for my own devious
>purposes and parts of it I don't understand. What is the "&" in a piece of
>code that looks like this meant to do? I looked all through the Class stuff
it assigns the variable a reference rather than a copy of your function
return value.
>in the docs but can't seem to find the reason for it.
>
>$foo = &$bar->some_function();
>
>Thanks in advance, John
http://www.php.net/manual/en/language.references.php
in particular http://www.php.net/manual/en/language.references.return.php
daniel
/*--
Daniel Beulshausen - [EMAIL PROTECTED]
Using PHP on Windows? http://www.php4win.com
--- End Message ---
--- Begin Message ---
I am using PHP 4.2.1, Windows 2000P, IIS4 connected to an Access 2000
database with an ISAPI module. I have created a very simple form and have
written a function to display radio buttons. While a hard-coded, HTML
version of the form works perfectly (correctly returning data), the php file
brings up an error message when I simply add the function definition at the
top of the page (whether or not the function call is present in the code
further down).
i.e.,
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING in
C:\inetpub\wwwroot\PHP\cat_proto3.php on line 46
Line 46 corresponds to the form tag, as follows:
<FORM ACTION="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
The entire code is below:
<HTML>
<HEAD>
<TITLE>Prototype IOM Meteorite Catalog Access Site</TITLE>
</HEAD>
<?php
###############################PROGRAM
FUNCTIONS#####################################
############################################################################
#########
#Function MakeRadioButtons()
function
MakeRadioButtons($Name,$Current,$Values=array(1,0),$Prompt=array("Yes","No")
)
{
for($Index=1;$Index<=count($Prompt);$Index++) {
$String.=<<< STRING
$Prompt[$Index]: <INPUT TYPE="RADIO" NAME="$Name" VALUE="$Values[$Index]"
STRING;
$String .= ($Prompt[$Index]==$Current) ? " Checked>"
: ">";
$String .= "\n";
} #end of for loop
return chop($String);
} #end of function MakeRadioButtons()
############################################################################
#########
?>
<BODY bgcolor="#FF8000">
<!--
********************FORM************************************************ -->
<!--
************************************************************************ -->
<!-- if this is the first entry on the page, present the initial form -->
<?php
if (!isset($_POST[menu])){
?>
<div align="center"><H2>INSTITUTE OF METEORITICS<br>
Prototype Meteorite Catalog Access Page</H2>
<hr></div>
<br>PLEASE SELECT A METEORITE CLASS:
<FORM ACTION="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<?php
MakeRadioButtons("meteorite_class", "1", array("1","2","3","4"),
array("Chondrite","Achondrite","Stony Iron","Iron"));
?>
<BR><input type="radio" name="meteorite_class" value="1">Chondrite
<BR><input type="radio" name="meteorite_class" value="2">Achondrite
<BR><input type="radio" name="meteorite_class" value="3">Stony Iron
<BR><input type="radio" name="meteorite_class" value="4">Iron
<br><input type="hidden" name="menu" value="no">
<BR><INPUT TYPE="submit" VALUE="Next">
</FORM>
<!--
****************OUTPUT************************************************** -->
<!--
************************************************************************ -->
<!-- if the user has entered basic form data, present the output -->
<?php
}
else
{
echo <<<OUTPUT_HEADER
<br><br>
<div align="center"><h2>Meteorite Catalog Output
Results</h2></div>
<hr>
<br><br>
OUTPUT_HEADER;
echo <<<TABLEHEADER
<table width="500px" border="1" cellspacing="1" cellpadding="1"
bgcolor="#FFFF80" align="center">
<tr>
<td height="22" align="left"><b>Sample Name</b></td>
<td height="22" align="left"><b>Type</b></td>
</tr>
TABLEHEADER;
//connect to database
$connectionstring = odbc_connect("meteoritecatalog", "wbhk", "poitiers");
$class_query = "SELECT sample.Sample, type.type_name
FROM sample,type
WHERE sample.type = type.type
AND sample.type=$_POST[meteorite_class]
ORDER BY type.type_name";
//execute query
$queryexe = odbc_do($connectionstring, $class_query);
//query database
while(odbc_fetch_row($queryexe))
{
$msample = odbc_result($queryexe, 1);
$mtype = odbc_result($queryexe, 2);
//format results
print ("<tr>");
print ("<td>$msample</td>");
print ("<td>$mtype</td>");
print ("</tr>");
}
//disconnect from the database
odbc_close($connectionstring);
print ("</table>");
}
?>
</BODY>
</HTML>
Many thanks for the help, Bill
--- End Message ---
--- Begin Message ---
Hi there!
I was wondering if anyone here had used the bzip functions to create an
archive? The documentation shows only how to compress strings, yet I want
to create an archive similar to the HTML documentation available from
php.net
TIA,
mikey
--- End Message ---
--- Begin Message ---
Also - is anyone else getting this mail sent to them when they try to post
to the list?
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 24 June 2002 18:39
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Using Bzip2 to create an archive...
>
>
> Mail not delivered to [EMAIL PROTECTED] The mailbox of the user
> has exceeded the allotted limit. Try sending later.
>
>
--- End Message ---
--- Begin Message ---
Yes, this guy is the biggest pain in the ass known to man IMO. Anyone know
how to get him unsubscribed to stop it happening?... <braces himself for his
own personal copy...>
Ross
> -----Original Message-----
> From: Mikey [mailto:[EMAIL PROTECTED]]
> Sent: 24 June 2002 18:43
> To: [EMAIL PROTECTED]
> Subject: FW: [PHP-WIN] Using Bzip2 to create an archive...
>
>
> Also - is anyone else getting this mail sent to them when they try to post
> to the list?
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: 24 June 2002 18:39
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-WIN] Using Bzip2 to create an archive...
> >
> >
> > Mail not delivered to [EMAIL PROTECTED] The mailbox of the user
> > has exceeded the allotted limit. Try sending later.
> >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
By any chance, does the broser have cookies disabled? I know when a session
can't go to a cookie, it goes to the URL.
-Dash
-----Original Message-----
From: Brian Graham [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 12:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Get/Post and Security Issues
Apache 1.3.26
PHP 4.2.1
When I enter username and password information onto a page, it uses Get and
puts the session ID along with the username and the password into the URL,
despite my saying "method=post" in the form attributes.
This seems like it would be a common problem, but my research isn't bringing
up anything even remotely about it.
I've done very, very little tweaking to my php.ini and httpd.conf to give
you an idea of what defaults are in place still. Here is the function code:
function user_login() {
global $usern;
global $userp;
global $feedback;
global $loginswitch;
if (!isSet($usern) && !isSet($userp))
return FALSE;
if ($usern == '' or $userp == '') {
$loginswitch = FALSE;
$feedback = "Username and/or password is missing.";
return FALSE;
}
$uname = strtolower($usern);
$query = "SELECT user_name, user_pass, user_isconfirmed
FROM user
WHERE user_name = '$usern'
AND user_pass = '$userp'";
$results = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($results);
if ($usern == $row[0] && $userp == $row[1]) {
$_SESSION['loginswitch'] = TRUE;
$_SESSION['username'] = $usern;
$feedback = "You are now logged in.";
return TRUE;
}
else {
$_SESSION['loginswitch'] = FALSE;
$feedback = "Username of password are incorrect.";
return FALSE;
}
}
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Can you send a copy of the HTML form that posts to your function?
> -----Original Message-----
> From: Brian Graham [mailto:[EMAIL PROTECTED]]
> Sent: 24 June 2002 08:27
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Get/Post and Security Issues
>
>
> Apache 1.3.26
> PHP 4.2.1
>
> When I enter username and password information onto a page, it
> uses Get and
> puts the session ID along with the username and the password into the URL,
> despite my saying "method=post" in the form attributes.
>
> This seems like it would be a common problem, but my research
> isn't bringing
> up anything even remotely about it.
>
> I've done very, very little tweaking to my php.ini and httpd.conf to give
> you an idea of what defaults are in place still. Here is the
> function code:
>
> function user_login() {
> global $usern;
> global $userp;
> global $feedback;
> global $loginswitch;
> if (!isSet($usern) && !isSet($userp))
> return FALSE;
> if ($usern == '' or $userp == '') {
> $loginswitch = FALSE;
> $feedback = "Username and/or password is missing.";
> return FALSE;
> }
> $uname = strtolower($usern);
> $query = "SELECT user_name, user_pass, user_isconfirmed
> FROM user
> WHERE user_name = '$usern'
> AND user_pass = '$userp'";
> $results = mysql_query($query) or die(mysql_error());
> $row = mysql_fetch_row($results);
> if ($usern == $row[0] && $userp == $row[1]) {
> $_SESSION['loginswitch'] = TRUE;
> $_SESSION['username'] = $usern;
> $feedback = "You are now logged in.";
> return TRUE;
> }
> else {
> $_SESSION['loginswitch'] = FALSE;
> $feedback = "Username of password are incorrect.";
> return FALSE;
> }
> }
>
>
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
Examined settings, reassured that all cookies were being allowed; still did
not work.
"Dash McElroy" <[EMAIL PROTECTED]> wrote in message
ABA3F1F1A223D411BE6C006008A6F7E260427C@MSX1-PTON">news:ABA3F1F1A223D411BE6C006008A6F7E260427C@MSX1-PTON...
> By any chance, does the broser have cookies disabled? I know when a
session
> can't go to a cookie, it goes to the URL.
>
> -Dash
>
> -----Original Message-----
> From: Brian Graham [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 12:27 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Get/Post and Security Issues
>
>
> Apache 1.3.26
> PHP 4.2.1
>
> When I enter username and password information onto a page, it uses Get
and
> puts the session ID along with the username and the password into the URL,
> despite my saying "method=post" in the form attributes.
>
> This seems like it would be a common problem, but my research isn't
bringing
> up anything even remotely about it.
>
> I've done very, very little tweaking to my php.ini and httpd.conf to give
> you an idea of what defaults are in place still. Here is the function
code:
>
> function user_login() {
> global $usern;
> global $userp;
> global $feedback;
> global $loginswitch;
> if (!isSet($usern) && !isSet($userp))
> return FALSE;
> if ($usern == '' or $userp == '') {
> $loginswitch = FALSE;
> $feedback = "Username and/or password is missing.";
> return FALSE;
> }
> $uname = strtolower($usern);
> $query = "SELECT user_name, user_pass, user_isconfirmed
> FROM user
> WHERE user_name = '$usern'
> AND user_pass = '$userp'";
> $results = mysql_query($query) or die(mysql_error());
> $row = mysql_fetch_row($results);
> if ($usern == $row[0] && $userp == $row[1]) {
> $_SESSION['loginswitch'] = TRUE;
> $_SESSION['username'] = $usern;
> $feedback = "You are now logged in.";
> return TRUE;
> }
> else {
> $_SESSION['loginswitch'] = FALSE;
> $feedback = "Username of password are incorrect.";
> return FALSE;
> }
> }
>
>
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Here it is. Please note that all of this output from a function; if you
would like the PHP code that outputs this, please just ask.
<form
action=<?=$_SERVER["PHP_SELF"]?>
method=post
name="login"
>
<tr>
<td>
<center>
<!-- .:Login Table - Name & Pass:. --!>
<table>
<tr>
<td>
<span class=text>Name:
</td>
<td>
<input
type=text
size=10
name=usern
>
</td>
</tr>
<tr>
<td>
<span class=text>Pass:
</td>
<td>
<input
type=password
size=10
name=userp
>
</td>
</tr>
<tr>
<td colspan=2><center>
<input
type=submit
value="Login"
class="submit"
name="login"
onsubmit="document.login.login.disabled='true'"
></center>
</td>
</tr>
</form>
And there we are!
"Mikey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can you send a copy of the HTML form that posts to your function?
>
> > -----Original Message-----
> > From: Brian Graham [mailto:[EMAIL PROTECTED]]
> > Sent: 24 June 2002 08:27
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Get/Post and Security Issues
> >
> >
> > Apache 1.3.26
> > PHP 4.2.1
> >
> > When I enter username and password information onto a page, it
> > uses Get and
> > puts the session ID along with the username and the password into the
URL,
> > despite my saying "method=post" in the form attributes.
> >
> > This seems like it would be a common problem, but my research
> > isn't bringing
> > up anything even remotely about it.
> >
> > I've done very, very little tweaking to my php.ini and httpd.conf to
give
> > you an idea of what defaults are in place still. Here is the
> > function code:
> >
> > function user_login() {
> > global $usern;
> > global $userp;
> > global $feedback;
> > global $loginswitch;
> > if (!isSet($usern) && !isSet($userp))
> > return FALSE;
> > if ($usern == '' or $userp == '') {
> > $loginswitch = FALSE;
> > $feedback = "Username and/or password is missing.";
> > return FALSE;
> > }
> > $uname = strtolower($usern);
> > $query = "SELECT user_name, user_pass, user_isconfirmed
> > FROM user
> > WHERE user_name = '$usern'
> > AND user_pass = '$userp'";
> > $results = mysql_query($query) or die(mysql_error());
> > $row = mysql_fetch_row($results);
> > if ($usern == $row[0] && $userp == $row[1]) {
> > $_SESSION['loginswitch'] = TRUE;
> > $_SESSION['username'] = $usern;
> > $feedback = "You are now logged in.";
> > return TRUE;
> > }
> > else {
> > $_SESSION['loginswitch'] = FALSE;
> > $feedback = "Username of password are incorrect.";
> > return FALSE;
> > }
> > }
> >
> >
> >
> >
> >
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
--- End Message ---
--- Begin Message ---
Here it is. Please note that all of this output from a function; if you
would like the PHP code that outputs this, please just ask.
<form
action=<?=$_SERVER["PHP_SELF"]?>
method=post
name="login"
>
<tr>
<td>
<center>
<!-- .:Login Table - Name & Pass:. --!>
<table>
<tr>
<td>
<span class=text>Name:
</td>
<td>
<input
type=text
size=10
name=usern
>
</td>
</tr>
<tr>
<td>
<span class=text>Pass:
</td>
<td>
<input
type=password
size=10
name=userp
>
</td>
</tr>
<tr>
<td colspan=2><center>
<input
type=submit
value="Login"
class="submit"
name="login"
onsubmit="document.login.login.disabled='true'"
></center>
</td>
</tr>
</form>
And there we are!
"Mikey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can you send a copy of the HTML form that posts to your function?
>
> > -----Original Message-----
> > From: Brian Graham [mailto:[EMAIL PROTECTED]]
> > Sent: 24 June 2002 08:27
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Get/Post and Security Issues
> >
> >
> > Apache 1.3.26
> > PHP 4.2.1
> >
> > When I enter username and password information onto a page, it
> > uses Get and
> > puts the session ID along with the username and the password into the
URL,
> > despite my saying "method=post" in the form attributes.
> >
> > This seems like it would be a common problem, but my research
> > isn't bringing
> > up anything even remotely about it.
> >
> > I've done very, very little tweaking to my php.ini and httpd.conf to
give
> > you an idea of what defaults are in place still. Here is the
> > function code:
> >
> > function user_login() {
> > global $usern;
> > global $userp;
> > global $feedback;
> > global $loginswitch;
> > if (!isSet($usern) && !isSet($userp))
> > return FALSE;
> > if ($usern == '' or $userp == '') {
> > $loginswitch = FALSE;
> > $feedback = "Username and/or password is missing.";
> > return FALSE;
> > }
> > $uname = strtolower($usern);
> > $query = "SELECT user_name, user_pass, user_isconfirmed
> > FROM user
> > WHERE user_name = '$usern'
> > AND user_pass = '$userp'";
> > $results = mysql_query($query) or die(mysql_error());
> > $row = mysql_fetch_row($results);
> > if ($usern == $row[0] && $userp == $row[1]) {
> > $_SESSION['loginswitch'] = TRUE;
> > $_SESSION['username'] = $usern;
> > $feedback = "You are now logged in.";
> > return TRUE;
> > }
> > else {
> > $_SESSION['loginswitch'] = FALSE;
> > $feedback = "Username of password are incorrect.";
> > return FALSE;
> > }
> > }
> >
> >
> >
> >
> >
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
--- End Message ---
--- Begin Message ---
Hi,
Does anyone know any good PHP reference/learning sites for understanding
how to use Cookies with PHP?
Cheers
Jambo
--- End Message ---