php-windows Digest 16 Nov 2002 10:35:48 -0000 Issue 1443

Topics (messages 16977 through 16990):

Re: set up mysql without winmysqladmin?
        16977 by: Cam Dunstan

Re: php - login and password
        16978 by: Brian 'Bex' Huff
        16989 by: George Nicolae

php - ftp_get
        16979 by: Rui Monteiro

Re: COM issue, problems with return type.
        16980 by: Brian 'Bex' Huff

php and mysql
        16981 by: Zeus

problem insert data into mysql
        16982 by: Zeus
        16983 by: Cary
        16985 by: Zeus

insert into mysql
        16984 by: Zeus

enter a carriage return after shell_exec()
        16986 by: Aaron
        16987 by: Aaron

Re: Calling exe/cgi
        16988 by: Aaron

Re: Subject: php - login and password
        16990 by: Neil Smith

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 ---
A.J.

A.J.
Dash`s solution says it all - you certainly don`t need Winmysqladmin to
start and stop mySQL - I just have a couple of shortcuts to batch files to
start and stop apache and mysql on the desktop.  You don`t need the "start"
command in fact though it does no harm.

stop mySQL with ....

cd C:\mysql\bin
mysqladmin shutdown

(in a batch file or at the command prompt)



----- Original Message -----
From: "Dash McElroy" <[EMAIL PROTECTED]>
To: "'A. J. McLean'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, November 16, 2002 4:11 AM
Subject: RE: [PHP-WIN] set up mysql without winmysqladmin?


> Make yourself a simple batch script:
>
> amp.bat:
> @echo off
> start c:\path\to\apache\apache.exe
> c:\path\to\mysql\bin\mysqld.exe --console
> echo Press ^C to stop stuff
> pause>NUL
> c:\path\to\apache\apache.exe -k stop
>
> or something (I'm guessing on the mysqld option). The start command may be
> particularly of service here. Open up a command prompt, type in 'start /?'
> to see all it can do (start /wait can be a handy option...)
>
> The above batch script is totally untested and may need a fair amount of
> tweaking, but it just might do what you want.
>
> -Dash
>
> -----Original Message-----
> From: A. J. McLean [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 14, 2002 6:11 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] set up mysql without winmysqladmin?
>
>
> Is it possible to configure mysql to load up automatically whenever apache
> is run (without having to load up winmysqladmin in the systray)?
>
> Thanks!!
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
I think what you are looking for isn't a JavaScript popup, but a "WWW-Authenticate" HTTP header, which is the standard broswer popup for login and password. You can do that with this PHP code at the ABSOLUTE top of every PHP page you want to secure:

header('WWW-Authenticate: Basic realm="my realm"');
header('HTTP/1.0 401 Unauthorized');

After getting that, the browser will resend its credentials, or popup a login window. The user fills in username and password, and you can authenticate with these parameters:

$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];

Typically, people store a SHA1 hash of the password in a text file, or a database somewhere. You then want to make the hash with the password from the user, check it against the original, and then either resend the unauthorized headers, or let them continute. Check out the 'MHash' functions for more info about this:

http://www.php.net/manual/en/ref.mhash.php

That info should help you get your head around it... but I STRONGLY suggest you get to the bookstore and pick up a book on writing secure PHP apps. There are a lot of subtle issues which are always missed by newbies... much to the delight and amusement of us hackers ;)

--

Brian 'Bex' Huff
[EMAIL PROTECTED]
Phone: 952-903-2023
Fax: 952-829-5424

I must say that I'm new at this php world.

There are some web sites that when you enter a page, a pop-up windows
appears requesting a login and password.

How can I make a form in php (login page) that searches for the login and
password of the page that is requested?

I really don't know where the file containing the login or password is
stored, but I suppose theres is a rule where to be hold up.

Thank you,

Rui Monteiro



--- End Message ---
--- Begin Message ---
You can find a good tutorial about this at
http://www.phpbuilder.com/columns/tim20000505.php3

--


Best regards,
George Nicolae
IT Manager
___________________
PaginiWeb.com  - Professional Web Design
www.PaginiWeb.com
"Rui Monteiro" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I must say that I'm new at this php world.
>
> There are some web sites that when you enter a page, a pop-up windows
> appears requesting a login and password.
>
> How can I make a form in php (login page) that searches for the login and
> password of the page that is requested?
>
> I really don't know where the file containing the login or password is
> stored, but I suppose theres is a rule where to be hold up.
>
> Thank you,
>
> Rui Monteiro
>
>


--- End Message ---
--- Begin Message ---
I'm using the function ftp_get() in my ftp access. The problem is that I
can't tell if the file is downloaded or not. How can I resolve this problem?

The page that has this function gets the vars from an url ( ex.
www.mysite.com/hello.php?name=rui&pass=superfly) Another problem to concern
is the fact that the var containing the password is printed in the url. Is
there a funcion that incripts this?

Thank's,

Rui


--- End Message ---
--- Begin Message ---
imho, the best documentation of the COM functionality is done by the random people who post comments to the online documentation here:

http://www.php.net/manual/en/ref.com.php

About the return value, it might be an array, or it might just be a reference to another COM object. Try this:

echo $groups;

If its an object or a reference, then you're only hope is to look at the COM documentation for Active Directory to see how one interates through group objects. If its anything like LDAP, its probably a big pointless convoluted mess. This link might be of use:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/active_directory_service_interfaces_adsi.asp

good luck!

--

Brian 'Bex' Huff
[EMAIL PROTECTED]
Phone: 952-903-2023
Fax: 952-829-5424

Hello all,

I am having a little problem with return types from a COM object. Basically
(code follows) I get a collection back from the object and I can not figure
out a way to iterate through this collection. Posted is a snippet of test
code that I hope one of you can help me with.


<?php echo "Starting\n";

$system = new COM("ADSystemInfo") or die("failed to get system info");
$usr = new COM("WinNT://$system->DomainDNSName/USERID,user") or
die("failed on usr");
$groups = $usr->Groups() or die("fail");

//Groups should be a collection of objects that I can iterate through, but
for //of me I can't figure out how.

//iteration through group should be here.

?>

If someone could point me to some relevent documentation about this It
would be great.
Thanks,
Eric

--- End Message ---
--- Begin Message ---
i write this code, veru simple code about testing inserting into database
MySQL. I found a little trouble, wich is the data i inserted in the form
doesn't show up in the database, since i still new with PHP, i cannot solve
this problem,

what's wrong with my code??

thanks

<?PHP
/////////////////////
//configure       ///
/////////////////////
include("config.php");

/////////////////////
//connect ke mysql///
/////////////////////
mysql_connect($db_host,$db_user,$db_pass) or die ("cannot connect");
mysql_select_db($db_base) or die ("cannot select db");

///////////////////////////////////
//inserting to database          //
//////////////////////////////////
$submit=mysql_query("INSERT INTO links_balon (banner, teks, alamat) VALUES
('$banner', '$teks', '$alamat')") or die ("tak ada data yang masuk");

///////////////////////////////////
//Form     //
///////////////////////////////////
echo "MASUKAN LINKS DI SINI<p>";
echo "<form method=post action=$php_self>"
 ."Insert Title and Descriptiion of a links<br>"
 ."<textarea name=\"teks\" rows=\"10\" cols=\"30\"></textarea><br>"
 ."insert the links of the site<br>"
 ."<input type=\"text\" name=\"alamat\"><br>"
 ."Insert the file name of the banner<br>"
 ."<input type=\"text\" name=\"banner\"><p>"
 ."<input type=\"submit\" name=\"submit\">"
 ."</form>";

?>

================================
:.zeus:.
http://www.redrival.com/zeussama

--- End Message ---
--- Begin Message --- I make this script. I have a problem, the data entered in the form wont insert into MYSQL, the database added new row but with blank database. Is there something wrong with the script? because i install phpnuke and i can added new data into mysql.
Thanks, i need solve this problem A.S.A.P, with your kind help o PHP-er....

Thanks..

using
PHP 4.2
Apache 1.3
========================code===================
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
Phone: <input type="text" name="phone"><br>
Mobile: <input type="text" name="mobile"><br>
Fax: <input type="text" name="fax"><br>
E-mail: <input type="text" name="email"><br>
Web: <input type="text" name="web"><br>
<input type="Submit">
</form>
<?PHP
$username="root";
$password="";
$database="belajarPHP";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";
mysql_query($query);
mysql_close();


?>

--- End Message ---
--- Begin Message --- I'm fairly new to PHP myslef, but I think you need to call the post variable from your form like this:
$_POST["first"], $_POST["last"] etc....



At 10:48 AM 11/16/02, zeus wrote:
I make this script. I have a problem, the data entered in the form wont insert into MYSQL, the database added new row but with blank database. Is there something wrong with the script? because i install phpnuke and i can added new data into mysql.
Thanks, i need solve this problem A.S.A.P, with your kind help o PHP-er....

Thanks..

using
PHP 4.2
Apache 1.3
========================code===================
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
Phone: <input type="text" name="phone"><br>
Mobile: <input type="text" name="mobile"><br>
Fax: <input type="text" name="fax"><br>
E-mail: <input type="text" name="email"><br>
Web: <input type="text" name="web"><br>
<input type="Submit">
</form>
<?PHP
$username="root";
$password="";
$database="belajarPHP";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";
mysql_query($query);
mysql_close();


?>


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

--- End Message ---
--- Begin Message --- I make register golbals on, but it doesn't solve the problems. The wird thing is, i am using php nuke in my localhost, it can enter datas into MySQL, the form and the script it's not diffrent than mine right (phpnuke more complex). The form it self don't have any errors?? and how about the PHP script?? is there any error?

I need explanation in english please..please.. because i am still new in php.



Dash McElroy wrote:

Oh - you might want to check your register_globals item in php.ini and set
it to on (look at www.php.net/register_globals) or use $_GET['varname'] for
GET, $_POST['varname'] for POST, or $_REQUEST['varname'] for Get/Post/Cookie
(works for any of those).

-Dash

-----Original Message-----
From: zeus [mailto:[EMAIL PROTECTED]] Sent: Saturday, November 16, 2002 8:49 AM
To: phpwin
Subject: [PHP-WIN] problem insert data into mysql


I make this script. I have a problem, the data entered in the form wont insert into MYSQL, the database added new row but with blank database. Is there something wrong with the script? because i install phpnuke and i can added new data into mysql.
Thanks, i need solve this problem A.S.A.P, with your kind help o PHP-er....

Thanks..

using
PHP 4.2
Apache 1.3
========================code===================
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
Phone: <input type="text" name="phone"><br>
Mobile: <input type="text" name="mobile"><br>
Fax: <input type="text" name="fax"><br>
E-mail: <input type="text" name="email"><br>
Web: <input type="text" name="web"><br>
<input type="Submit">
</form>
<?PHP
$username="root";
$password="";
$database="belajarPHP";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";
mysql_query($query);
mysql_close();


?>





--- End Message ---
--- Begin Message ---
i write this code, veru simple code about testing inserting into database
MySQL. I found a little trouble, wich is the data i inserted in the form
doesn't show up in the database, since i still new with PHP, i cannot solve
this problem,

what's wrong with my code??

thanks

<?PHP
/////////////////////
//configure       ///
/////////////////////
include("config.php");

/////////////////////
//connect ke mysql///
/////////////////////
mysql_connect($db_host,$db_user,$db_pass) or die ("cannot connect");
mysql_select_db($db_base) or die ("cannot select db");

///////////////////////////////////
//inserting to database          //
//////////////////////////////////
$submit=mysql_query("INSERT INTO links_balon (banner, teks, alamat) VALUES
('$banner', '$teks', '$alamat')") or die ("tak ada data yang masuk");

///////////////////////////////////
//Form     //
///////////////////////////////////
echo "MASUKAN LINKS DI SINI<p>";
echo "<form method=post action=$php_self>"
 ."Insert Title and Descriptiion of a links<br>"
 ."<textarea name=\"teks\" rows=\"10\" cols=\"30\"></textarea><br>"
 ."insert the links of the site<br>"
 ."<input type=\"text\" name=\"alamat\"><br>"
 ."Insert the file name of the banner<br>"
 ."<input type=\"text\" name=\"banner\"><p>"
 ."<input type=\"submit\" name=\"submit\">"
 ."</form>";

?>
================================
:.zeus:.
http://www.redrival.com/zeussama


--- End Message ---
--- Begin Message ---
how the hey do i enter a carriage return after shell_exec()

heres the code that works:

$status1 = shell_exec("status.exe");

BUT, because the exe has a windows popup in it (because i havent registered
or craked the thing yet, no time or $) the thing wont run! so, ideas any1?

:-\



noize



--- End Message ---
--- Begin Message ---
go here to see/hear what i mean http://203.79.117.34/help.php <you can hear
the pop up window open, but cant do anything about it.

"Aaron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> how the hey do i enter a carriage return after shell_exec()
>
> heres the code that works:
>
> $status1 = shell_exec("status.exe");
>
> BUT, because the exe has a windows popup in it (because i havent
registered
> or craked the thing yet, no time or $) the thing wont run! so, ideas any1?
>
> :-\
>
>
>
> noize
>
>
>


--- End Message ---
--- Begin Message ---
try this in php. put the executable  in your apache/iis root dir or include
the path

$status1 = shell_exec("status.exe");

see here for more>  http://www.php.net/manual/en/function.exec.php

'wo nurries'
noize

"Brennan Mann" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello everybody!
>
>     I am new to PHP. I have several C and C++ programs that run as cgi(s).
> Currently, I am just using a form on a web page to call the cgi(s). I am
> running PHP on a Windows 2000 server with IIS. Can you call/invoke an exe
> program from a PHP script?  If so, could you please show an example.
>
> Thanks for your help!
> Brennan
>
>


--- End Message ---
--- Begin Message --- Hello - do you mean a HTML form in a popup window, or do you mean the 'Enter Network Password' box - which has 'site' , realm', 'User Name' and Password - and is generated by the webserver .htaccess file?

The 1st is accessed using standard variables - if you write a form with a user name box called user < input type = text name="user" > then :

$_POST["user"] or $HTTP_POST_VARS["user"] in older versions of PHP.

If you mean the password protection is done by authenticating the user by the web server in .htaccess file, then the syntax is different - try printing the value of

$HTTP_AUTH_USER

I haven't tried this on PHP > 4.2.0, but it might now be called $_SERVER["AUTH_USER"]
Don't quote me on the last one but it may well work.

To make an .htaccess authentication work, you need also to *generate* 2 files - one called .htusers which contains a list of users, and encrypted passwords which will be accepted, then make a .htaccess file which points to the .htusers file. In .htaccess, there needs to be a line which says

AuthUserFile /wwwroot/htdocs/mydirectory/.htusers

Put the path to where you store this file instead.

You *will* definitely need to read the server (apache?) documentation to do this. Come back to the list if you have problems - I have the docs somewhere but I'm rebuilding my system right now.


Hope that helps
Neil Smith.

At 22:15 15/11/2002 +0000, you wrote:
Message-ID: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
From: "Rui Monteiro" <[EMAIL PROTECTED]>
Date: Thu, 14 Nov 2002 22:43:07 -0000
Subject: php - login and password

I must say that I'm new at this php world.

There are some web sites that when you enter a page, a pop-up windows
appears requesting a login and password.

How can I make a form in php (login page) that searches for the login and
password of the page that is requested?

I really don't know where the file containing the login or password is
stored, but I suppose theres is a rule where to be hold up.

Thank you,

Rui Monteiro

--- End Message ---

Reply via email to