php-windows Digest 30 Sep 2006 01:08:20 -0000 Issue 3047
Topics (messages 27183 through 27198):
Re: Problems with fscanf [WORKAROUND] fgetc
27183 by: Luis Moreira
27186 by: German Piqué
insert md5 password
27184 by: Alf Stockton
27185 by: SMITHT
27190 by: Alf Stockton
27191 by: Alf Stockton
27192 by: DvDmanDT
27193 by: Alf Stockton
27194 by: SMITHT
27195 by: Alf Stockton
27196 by: Niel Archer
27197 by: Luis Moreira
Re: TPN POSSIBLE SPAM:Re: [PHP-WIN] Re: Problems with fscanf [WORKAROUND] fgetc
27187 by: Alex Turner
27188 by: Alex Turner
27189 by: German Piqué
login stuff
27198 by: bob plano
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 ---
The "{} syntax" means to run a command whithin another command, whitout having
to store results previously.
As an example, both following codes do the same, and you don't loose time
storing and retrieving variable $argo
$argo = fgets($fileID,sizeof($file));
Echo "$argo";
And
Echo "{fgets($fileID,sizeof($file))}";
Luis
-----Original Message-----
From: German Piqué [mailto:[EMAIL PROTECTED]
Sent: sexta-feira, 29 de Setembro de 2006 11:35
To: Alex Turner
Cc: [email protected]; Stanislav Malyshev
Subject: Re: [PHP-WIN] Re: Problems with fscanf [WORKAROUND] fgetc
mmm... let me guess...
you're saying that I must do something like this:
$argo = fgets($fileID,sizeof($file))
And then work with the string?
What do you mean by "using {} syntax"? Are you talking about regular
expressions or what?
Thanks.
2006/9/28, Alex Turner <[EMAIL PROTECTED]>:
>
> Stanislav Malyshev wrote:
> > German Piqué wrote:
> >> Well, I managed to work with the spaces but using fgetc instead of
> >> fscanf.
> >>
> >
> > Just as a note I think it would be much more efficient to use fgets
> > or fread and then parse resulting string using regular expressions.
> > Unless you have some limitations that weren't mentioned.
> > Just as a note I think it would be much more efficient to use fgets
> > or fread and then parse resulting string using regular expressions.
> > Unless you have some limitations that weren't mentioned.
>
> That got me thinking - how about using fgets then running over the
> string using {} syntax. The same code (almost) would run many many
> times faster (probably).
>
> AJ
>
> --
> www.deployview.com
> www.nerds-central.com
> www.project-network.com
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I didn't kwon that! :O
Thanks!
2006/9/29, Luis Moreira <[EMAIL PROTECTED]>:
The "{} syntax" means to run a command whithin another command, whitout
having to store results previously.
As an example, both following codes do the same, and you don't loose time
storing and retrieving variable $argo
$argo = fgets($fileID,sizeof($file));
Echo "$argo";
And
Echo "{fgets($fileID,sizeof($file))}";
Luis
-----Original Message-----
From: German Piqué [mailto:[EMAIL PROTECTED]
Sent: sexta-feira, 29 de Setembro de 2006 11:35
To: Alex Turner
Cc: [email protected]; Stanislav Malyshev
Subject: Re: [PHP-WIN] Re: Problems with fscanf [WORKAROUND] fgetc
mmm... let me guess...
you're saying that I must do something like this:
$argo = fgets($fileID,sizeof($file))
And then work with the string?
What do you mean by "using {} syntax"? Are you talking about regular
expressions or what?
Thanks.
2006/9/28, Alex Turner <[EMAIL PROTECTED]>:
>
> Stanislav Malyshev wrote:
> > German Piqué wrote:
> >> Well, I managed to work with the spaces but using fgetc instead of
> >> fscanf.
> >>
> >
> > Just as a note I think it would be much more efficient to use fgets
> > or fread and then parse resulting string using regular expressions.
> > Unless you have some limitations that weren't mentioned.
> > Just as a note I think it would be much more efficient to use fgets
> > or fread and then parse resulting string using regular expressions.
> > Unless you have some limitations that weren't mentioned.
>
> That got me thinking - how about using fgets then running over the
> string using {} syntax. The same code (almost) would run many many
> times faster (probably).
>
> AJ
>
> --
> www.deployview.com
> www.nerds-central.com
> www.project-network.com
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Using MSSQL database I am attempting to insert a new user into a table
using the following command in PHP:-
INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
last_login, UserID) VALUES ('Alf', 'Stockton', 'alf',
0xd8cc7e40d17aaefd27cd324f7ba91079, '9', '2006/09/29 12:05:23', '0')
However this fails and I am not sure why.
BTW The value starting 0vd8....... is the password converted via md5()
Please tell me what I got wrong.
--
Regards,
Alf Stockton www.stockton.co.za
You have an unusual equipment for success. Be sure to use it properly.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
last_login, UserID) VALUES ("Alf", "Stockton", "alf",
"0xd8cc7e40d17aaefd27cd324f7ba91079", 9, "2006/09/29 12:05:23", 0)
Put the hashed password in as a string.
Tom
-----Original Message-----
From: Alf Stockton [mailto:[EMAIL PROTECTED]
Sent: 29 September 2006 11:46
To: php-windows
Subject: [PHP-WIN] insert md5 password
Using MSSQL database I am attempting to insert a new user into a table
using the following command in PHP:-
INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
last_login, UserID) VALUES ('Alf', 'Stockton', 'alf',
0xd8cc7e40d17aaefd27cd324f7ba91079, '9', '2006/09/29 12:05:23', '0')
However this fails and I am not sure why.
BTW The value starting 0vd8....... is the password converted via md5()
Please tell me what I got wrong.
--
Regards,
Alf Stockton www.stockton.co.za
You have an unusual equipment for success. Be sure to use it properly.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
SMITHT wrote:
> INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
> last_login, UserID) VALUES ("Alf", "Stockton", "alf",
> "0xd8cc7e40d17aaefd27cd324f7ba91079", 9, "2006/09/29 12:05:23", 0)
>
> Put the hashed password in as a string.
>
>
The command now looks like:-
INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
last_login, UserID) VALUES ('Alf', 'Stockton', 'alf',
"0xd8cc7e40d17aaefd27cd324f7ba91079", '9', '2006/09/29 13:29:34', '0')
but still fails.
--
Regards,
Alf Stockton www.stockton.co.za
If one cannot enjoy reading a book over and over again, there is no use
in reading it at all.
-- Oscar Wilde
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
The relevant PHP code looks like :-
$Surname = strip_tags($_POST['Surname']);
$FirstName = strip_tags($_POST['FirstName']);
$uname = strip_tags($_POST['uname']);
$passwd = strip_tags($_POST['passwd']);
$accesslevel = strip_tags($_POST['accesslevel']);
$passwd = md5($passwd);
// echo "<br>get_magic_quotes";
if (!get_magic_quotes_gpc())
{
$_POST['passwd'] = addslashes($_POST['passwd']);
}
$regdate = date('Y/m/d H:i:s');
// echo "<br>Prepare";
$insert = sprintf("INSERT INTO Users (FirstName, LastName, Usrname,
Passwrd, AccessLevel, last_login, UserID)
VALUES ('%s', '%s', '%s', \"0x%s\", '%d', '%s',
'%d')",
$FirstName, $Surname, $uname, $passwd,
$accesslevel, $regdate, $_SESSION['UID']);
$Reply = mssql_query($insert, $link);
echo "<br>".$insert;
if ($Reply == FALSE)
{
echo "<br> Error in Insert";
echo "<br>".get_sql_error($link)."<br>";
$Message = sprintf("%s %d <br>Record not inserted. Please refer
problem to Admin.", __FILE__, __LINE__);
trigger_error($Message, E_USER_ERROR, $link);
exit;
}
DBDisConnect();
header("location: index.shtml");
exit;
?>
--- End Message ---
--- Begin Message ---
Just check why it fails.. mysql_error() returns a string with the last error
message..
--
// DvDmanDT
mail: dvdmandt¤telia.com
msn: dvdmandt¤hotmail.com
"Alf Stockton" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> SMITHT wrote:
>> INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
>> last_login, UserID) VALUES ("Alf", "Stockton", "alf",
>> "0xd8cc7e40d17aaefd27cd324f7ba91079", 9, "2006/09/29 12:05:23", 0)
>>
>> Put the hashed password in as a string.
>>
>>
> The command now looks like:-
> INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
> last_login, UserID) VALUES ('Alf', 'Stockton', 'alf',
> "0xd8cc7e40d17aaefd27cd324f7ba91079", '9', '2006/09/29 13:29:34', '0')
> but still fails.
>
> --
> Regards,
> Alf Stockton www.stockton.co.za
>
> If one cannot enjoy reading a book over and over again, there is no use
> in reading it at all.
> -- Oscar Wilde
> My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
DvDmanDT wrote:
> Just check why it fails.. mysql_error() returns a string with the last error
> message..
>
>
Unfortunately this is mssql not mysql......:-(
--
Regards,
Alf Stockton www.stockton.co.za
You'll never see all the places, or read all the books, but fortunately,
they're not all recommended.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
mssql_get_last_message(), or if that doesn't return anything useful, try
this code from a PHP manual user note:
function get_sql_error ($con) {
$sql = "select @@ERROR as code";
$result = mssql_query($sql, $con);
$row = mssql_fetch_array($result);
$code = $row["code"]; // error code
$sql = "select cast (description as varchar(255)) as errtxt
from master.dbo.sysmessages where error = $code and msglangid = 1031";
// german
$result = mssql_query($sql, $con);
$row = mssql_fetch_array($result);
if ($row)
$text = $row["errtxt"]; // error text (with placeholders)
else
$text = "onknown error";
mssql_free_result($result);
return "[$code] $text";
}
Tom
-----Original Message-----
From: Alf Stockton [mailto:[EMAIL PROTECTED]
Sent: 29 September 2006 13:11
To: DvDmanDT
Cc: [email protected]
Subject: Re: [PHP-WIN] insert md5 password
DvDmanDT wrote:
> Just check why it fails.. mysql_error() returns a string with the last
error
> message..
>
>
Unfortunately this is mssql not mysql......:-(
--
Regards,
Alf Stockton www.stockton.co.za
You'll never see all the places, or read all the books, but fortunately,
they're not all recommended.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
SMITHT wrote:
> mssql_get_last_message(), or if that doesn't return anything useful, try
> this code from a PHP manual user note:
>
> function get_sql_error ($con) {
>
> $sql = "select @@ERROR as code";
> $result = mssql_query($sql, $con);
> $row = mssql_fetch_array($result);
> $code = $row["code"]; // error code
> $sql = "select cast (description as varchar(255)) as errtxt
> from master.dbo.sysmessages where error = $code and msglangid = 1031";
> // german
> $result = mssql_query($sql, $con);
> $row = mssql_fetch_array($result);
> if ($row)
> $text = $row["errtxt"]; // error text (with placeholders)
> else
> $text = "onknown error";
> mssql_free_result($result);
> return "[$code] $text";
> }
>
> Tom
>
> -----Original Message-----
> From: Alf Stockton [mailto:[EMAIL PROTECTED]
> Sent: 29 September 2006 13:11
> To: DvDmanDT
> Cc: [email protected]
> Subject: Re: [PHP-WIN] insert md5 password
>
> DvDmanDT wrote:
>
>> Just check why it fails.. mysql_error() returns a string with the last
>>
> error
>
>> message..
>>
>>
>>
> Unfortunately this is mssql not mysql......:-(
>
>
That function gives me a [260] unknown error
--
Regards,
Alf Stockton www.stockton.co.za
You'll never be the man your mother was!
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
Hi Alf
> The command now looks like:-
> INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
> last_login, UserID) VALUES ('Alf', 'Stockton', 'alf',
> "0xd8cc7e40d17aaefd27cd324f7ba91079", '9', '2006/09/29 13:29:34', '0')
> but still fails.
What is the error returned? Does the password hash still need the "0x"
to start it?
Niel
--- End Message ---
--- Begin Message ---
And the field types, do they all match ?
You are entering a date as a string, for example.
If all else fails, try to insert only one field at a tine, to see which one
fails.
Luis
-----Original Message-----
From: Niel Archer [mailto:Niel Archer] On Behalf Of Niel Archer
Sent: sexta-feira, 29 de Setembro de 2006 13:56
To: [email protected]
Subject: Re: [PHP-WIN] insert md5 password
Hi Alf
> The command now looks like:-
> INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel,
> last_login, UserID) VALUES ('Alf', 'Stockton', 'alf',
> "0xd8cc7e40d17aaefd27cd324f7ba91079", '9', '2006/09/29 13:29:34', '0')
> but still fails.
What is the error returned? Does the password hash still need the "0x"
to start it?
Niel
--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
German,
You can access the characters of a string one at a time using the syntax
$myString{$i}
So I was suggesting getting the data into a string and iterating over the
string using this syntax rather than repeatedly calling fgetc.
The chances are that it would be faster - it rather depends on how fgetc is
implemented (which I don't know in PHP).
Cheers
AJ
Alexander J Turner Ph.D.
HYPERLINK "http://www.deployview.com"www.deployview.com
HYPERLINK "http://www.nerds-central.blogspot.com"www.nerds-central.blogspot.com
HYPERLINK "http://www.project-network.com"www.project-network.com
_____
From: German Piqué [mailto:[EMAIL PROTECTED]
Sent: 29 September 2006 11:35
To: Alex Turner
Cc: [email protected]; Stanislav Malyshev
Subject: TPN POSSIBLE SPAM:Re: [PHP-WIN] Re: Problems with fscanf [WORKAROUND]
fgetc
mmm... let me guess...
you're saying that I must do something like this:
$argo = fgets($fileID,sizeof($file))
And then work with the string?
What do you mean by "using {} syntax"? Are you talking about regular
expressions or what?
Thanks.
2006/9/28, Alex Turner <HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]>:
Stanislav Malyshev wrote:
> German Piqué wrote:
>> Well, I managed to work with the spaces but using fgetc instead of
>> fscanf.
>>
>
> Just as a note I think it would be much more efficient to use fgets or
> fread and then parse resulting string using regular expressions. Unless
> you have some limitations that weren't mentioned.
> Just as a note I think it would be much more efficient to use fgets or
> fread and then parse resulting string using regular expressions.
> Unless you have some limitations that weren't mentioned.
That got me thinking - how about using fgets then running over the
string using {} syntax. The same code (almost) would run many many
times faster (probably).
AJ
--
HYPERLINK "http://www.deployview.com"www.deployview.com
HYPERLINK "http://www.nerds-central.com"www.nerds-central.com
HYPERLINK "http://www.project-network.com"www.project-network.com
--
PHP Windows Mailing List (HYPERLINK "http://www.php.net/" http://www.php.net/)
To unsubscribe, visit: HYPERLINK
"http://www.php.net/unsub.php"http://www.php.net/unsub.php
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
--- End Message ---
--- Begin Message ---
Yes - it does mean that as well - but that is not what I meant!
Thanks
AJ
Alexander J Turner Ph.D.
www.deployview.com
www.nerds-central.blogspot.com
www.project-network.com
-----Original Message-----
From: Luis Moreira [mailto:[EMAIL PROTECTED]
Sent: 29 September 2006 11:44
To: 'German Piqué'; Alex Turner
Cc: [email protected]; 'Stanislav Malyshev'
Subject: TPN POSSIBLE SPAM:RE: [PHP-WIN] Re: Problems with fscanf [WORKAROUND]
fgetc
The "{} syntax" means to run a command whithin another command, whitout having
to store results previously.
As an example, both following codes do the same, and you don't loose time
storing and retrieving variable $argo
$argo = fgets($fileID,sizeof($file));
Echo "$argo";
And
Echo "{fgets($fileID,sizeof($file))}";
Luis
-----Original Message-----
From: German Piqué [mailto:[EMAIL PROTECTED]
Sent: sexta-feira, 29 de Setembro de 2006 11:35
To: Alex Turner
Cc: [email protected]; Stanislav Malyshev
Subject: Re: [PHP-WIN] Re: Problems with fscanf [WORKAROUND] fgetc
mmm... let me guess...
you're saying that I must do something like this:
$argo = fgets($fileID,sizeof($file))
And then work with the string?
What do you mean by "using {} syntax"? Are you talking about regular
expressions or what?
Thanks.
2006/9/28, Alex Turner <[EMAIL PROTECTED]>:
>
> Stanislav Malyshev wrote:
> > German Piqué wrote:
> >> Well, I managed to work with the spaces but using fgetc instead of
> >> fscanf.
> >>
> >
> > Just as a note I think it would be much more efficient to use fgets
> > or fread and then parse resulting string using regular expressions.
> > Unless you have some limitations that weren't mentioned.
> > Just as a note I think it would be much more efficient to use fgets
> > or fread and then parse resulting string using regular expressions.
> > Unless you have some limitations that weren't mentioned.
>
> That got me thinking - how about using fgets then running over the
> string using {} syntax. The same code (almost) would run many many
> times faster (probably).
>
> AJ
>
> --
> www.deployview.com
> www.nerds-central.com
> www.project-network.com
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
--- End Message ---
--- Begin Message ---
:O
thanks for the idea, I will try! :)
2006/9/29, Alex Turner <[EMAIL PROTECTED]>:
German,
You can access the characters of a string one at a time using the syntax
$myString{$i}
So I was suggesting getting the data into a string and iterating over the
string using this syntax rather than repeatedly calling fgetc.
The chances are that it would be faster - it rather depends on how fgetc
is implemented (which I don't know in PHP).
Cheers
AJ
Alexander J Turner Ph.D.
HYPERLINK "http://www.deployview.com"www.deployview.com
HYPERLINK "http://www.nerds-central.blogspot.com"
www.nerds-central.blogspot.com
HYPERLINK "http://www.project-network.com"www.project-network.com
_____
From: German Piqué [mailto:[EMAIL PROTECTED]
Sent: 29 September 2006 11:35
To: Alex Turner
Cc: [email protected]; Stanislav Malyshev
Subject: TPN POSSIBLE SPAM:Re: [PHP-WIN] Re: Problems with fscanf
[WORKAROUND] fgetc
mmm... let me guess...
you're saying that I must do something like this:
$argo = fgets($fileID,sizeof($file))
And then work with the string?
What do you mean by "using {} syntax"? Are you talking about regular
expressions or what?
Thanks.
2006/9/28, Alex Turner <HYPERLINK "mailto:[EMAIL PROTECTED]"
[EMAIL PROTECTED]>:
Stanislav Malyshev wrote:
> German Piqué wrote:
>> Well, I managed to work with the spaces but using fgetc instead of
>> fscanf.
>>
>
> Just as a note I think it would be much more efficient to use fgets or
> fread and then parse resulting string using regular expressions. Unless
> you have some limitations that weren't mentioned.
> Just as a note I think it would be much more efficient to use fgets or
> fread and then parse resulting string using regular expressions.
> Unless you have some limitations that weren't mentioned.
That got me thinking - how about using fgets then running over the
string using {} syntax. The same code (almost) would run many many
times faster (probably).
AJ
--
HYPERLINK "http://www.deployview.com"www.deployview.com
HYPERLINK "http://www.nerds-central.com"www.nerds-central.com
HYPERLINK "http://www.project-network.com"www.project-network.com
--
PHP Windows Mailing List (HYPERLINK "http://www.php.net/"
http://www.php.net/)
To unsubscribe, visit: HYPERLINK "http://www.php.net/unsub.php"
http://www.php.net/unsub.php
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
--- End Message ---
--- Begin Message ---
i am very new to php and right now i am trying to make a members only
part to my site. the login part of it doesn't work and i have been
trying to diplay a mysql error like this:
$result = mysqli_query($connection,$sql)
or
$message= mysql_error();
echo "$message<br>";
die( );
and of course it doesn't work. please point out what i'm doing wrong.
another question is how would i do a password check. like most sites
where you login, they have a type password and a retype password box.
where would i put this is the form's processor to check the password?
i'm sorry that i have to send this to you people, but i need someone
more experienced to check this.
--- End Message ---