php-windows Digest 17 Dec 2002 17:56:44 -0000 Issue 1491
Topics (messages 17463 through 17470):
Re: Getting errors, need help
17463 by: David
PHP Web Mail
17464 by: Raheel Hussain
17468 by: T. Steneker
Having problems with login page, HELP
17465 by: David
Am I creating my cookies properly?
17466 by: George Pitcher
Win2K DC - Safe way to add domain user
17467 by: Vladislav Malicevic
Cookies working on test but not my application
17469 by: George Pitcher
17470 by: Stephen Edmonds
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 ---
Thank you for your reply. I just caught it and corrected it. But now my
login does nothing.
I am going to repost it with a diffrent subject line
David
"Joseph W. Goff" <[EMAIL PROTECTED]> wrote in message
005401c2a521$8ecae2c0$bdcaa8c0@jg42000">news:005401c2a521$8ecae2c0$bdcaa8c0@jg42000...
> The line just above 43 does not contain a semi-colon.
>
> ----- Original Message -----
> From: "David" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, December 15, 2002 7:18 PM
> Subject: [PHP-WIN] Getting errors, need help
>
>
> > Hello all,
> >
> > I am new to PHP so I am going to need some help.
> >
> > I am trying to create a admin login page. But I am getting this error
> > message:
> >
> > Parse error: parse error, unexpected T_VARIABLE in c:\program
files\apache
> > group\apache\htdocs\sunwestsilver\admin\tmpi5pcf76sy9.php on line 43
> >
> > tmpi5pcf76sy9.php is generated by Dreamweaver MX as a temp file from
> > admin.php
> >
> > It is coming from this line:
> >
> > this is line 43 code
> >
> > # $myquery = .'" AND password = '" . crypt($password, "xpz8ty") . "'";
> >
> > The complete code is:
> >
> > // Query Database with username and encrypted password
> > #$myquery = "SELECT * FROM user WHERE username = '" . $user
> > #$myquery = .'" AND password = '" . crypt($password, "xpz8ty") . "'";
> > #$result = mysql_query($myquery);
> > #if (!$result)
> > #{
> > # $error = "Cannot run Query";
> > #return($error);
> > #}
> >
> > Any help will be nice.
> >
> > I got this code from Dreamweaver MX: PHP Web Development pg. 257
> >
> > Thanks
> >
> > David
> >
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
--- End Message ---
--- Begin Message ---
hi,
1 - where can i download the latest version of Apache Server for installation on
Windows 2000.
I want to develop a webmail in PHP just like Yahoo, plz somebody guide me where can I
get help or some useful information about it , or if somebody have some
information etc.
regards,
---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
--- End Message ---
--- Begin Message ---
> hi,
> 1 - where can i download the latest version of Apache Server for
installation on Windows 2000.
You can download it from this url:
http://nagoya.apache.org/dist/httpd/binaries/win32/
> I want to develop a webmail in PHP just like Yahoo, plz somebody guide me
where can I get help or some useful information about it , or if somebody
have some
> information etc.
You could take a look at:
http://www.php.net/manual/en/ref.imap.php
>
> regards,
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now
--- End Message ---
--- Begin Message ---
Hello,
I am pretty new to PHP and I am trying to create a admin login page so my
client can view thier product line and orders. I have MySQL set-up properly
and have data in it and I am able to view information from the db with no
problem. I do all my testing on my local machine before I blast it to the
main web server. I am using 2000XP Pro, Apache/1.3.23 (Win32) and PHP Ver.
4.2.3. The main webserver is a Unix system.
The problem I am having is I created a login.php and a include page called
admin.inc.php. I tried to log-in but the login.php reloads and the login
fields are blank. It should go to the admin.php or give me some type of
error. I get no errors message. I was getting errors earlier but I forgot
to put a ; on one line.
I going to copy my login.php and admin.inc.php code hoping that someone
could help my and point out what am I over looking. I put a #pound sign in
front of the code, I hope this is ok.
LOGIN CODE
#<?php include("../classes/admin.inc.php"); ?>
#<?php
#
# // Main Code - Verifies the form data, and inserts into
# // the users table in the Database
# if($HTTP_POST_VARS['Submit']=='Create User'){
# $error = verify_data($HTTP_POST_VARS);
# if ($error == "")
# $success = "User inserted successfully";
# }
#?>
#<?php
#function verify_data($formdata) {
# // This function uses the functions in the include file,
# // and uses them to validate various aspects of the form.
# // If validation fails, it returns $error, the appropriate error message
# // If validation suceeds, return true
# $error = "";
# $form_data = trim_data($formdata);
# $user = $form_data['username'];
#
# // check all form fields are filled in
# if (!check_form($form_data)) {
# $error="All Form Fields must be filled in";
# return($error); }
#
# // check password and confirmation password match
# if (!confirm_password($form_data, 'password', 'confirmpassword')) {
# $error = "Password and Confirm Password do not match";
# return($error); }
#
# // check length of password
# if (!check_password_length($form_data, 'password', 6)) {
# $error = "Password should be 6 characters or more";
# return($error); }
#
# // check that username is unique
# $check = check_unique($user, 'sunwestsilver', 'localhost' , 'blade',
'123456', 'access_level', 'username');
# if ($check != "true") {
# $error = "Username is already in user, select another";
# return($error); }
#
# // if validated successfully, insert data into table
# $insert_check = insert_data($formdata);
#
# // if error with insertion, return error
# if ($insert_check != "true")
# return($insert_check);
#
# // form validated and record inserted successfully
# return("");
#}
#
#function insert_data($formdata) {
# // Insert Data into users table
# // $formdata = form array
#
# // setup database connection variables, insert as correct for your server
# $error = "";
# $myhost = "localhost";
# $myuser = "blade";
# $mypass = "123456";
# $mydb = "sunwestsilver";
#
# // setup data to insert
# $firstName = $formdata['firstName'];
# $lastName = $formdata['lastName'];
# $username = $formdata['username'];
# $password = $formdata['password'];
# $status = $formdata['status'];
#
# // encrypt the password using the key "123456"
# $password = crypt($password,"123456");
#
# // connect to mySQL server
# $mysql = mysql_connect($myhost, $myuser, $mypass);
# if (!$mysql) {
# $error = "Cannot connect to mySQL server";
# return($error);
# }
# // Connect to Database
# $mysqldb = mysql_select_db($mydb, $mysql);
# if (!$mysqldb) {
# $error = "Cannot open Database";
# return($error);
# }
# // Insert Data
# $myquery = "INSERT INTO access_level ( firstName, lastName, username,
password, status) VALUES ('$firstName', '$lastName', '$username',
'$password', #'$status')";
# $result = mysql_query($myquery, $mysql);
# if (!$result) {
#$error = "Cannot run Query";
#return $error;
#}
#// Return True if record written successfully
#return("true");
#}
#?>
INCLUDE ADMIN.INC CODE (admin.inc.php)
#<?php
##########################################
## admin.inc.php include file ##
##########################################
#function trim_data($formdata)
#{
# // Trim any leading or trailing spaces
# // $formdata = Form Data Array
# foreach($formdata as $key => $value)
#{
# $key = trim($key);
# $value = trim($value);
#}
# return $formdata;
#}
#
#function check_form($formdata)
#{
# // Check all fields are filled in
# // $formdata = Form Data Array
# foreach ($formdata as $key => $value)
# {
# if (!isset($key) || $value == "" )
# return false;
# }
# return true;
#}
#
#function check_password_length($formdata, $password, $minlen)
#{
# // Check that password is required length
# // $formdata = Form Data Array
# // $password = Name of password field
# // $minlen = Minimum number of password characters
# if (strlen($formdata[$password]) < $minlen)
# return false;
# else
# return true;
#}
#
#function confirm_password($formdata, $password1, $password2)
#{
# // Check that two passwords given match
# // $formdata = Form Data Array
# // $password1 = Name of first password field
# // $password2 = Name of second password field
#
# if ($formdata[$password1] === $formdata[$password2])
# return true;
# else
# return false;
#}
#
#function check_unique($formvalue, $db, $dbhost, $dbuser, $dbpassword,
$table, $field) {
# // Checks a table in a database, so see if passed value already exists
# // $formvalue = Value you are checking to see if it is unique or not
# // $db = mySQL Database Name
# // $dbhost = mySQL Server address eg localhost
# // $dbuser = mySQL user name
# // $dbpassword = mySQL password
# // $table = mySQL Table to search
# // $field = mySQL Field to search
#
# $error = "";
# // Connect to the mySQL Server
# $mysql = mysql_connect($dbhost, $dbuser, $dbdbpassword);
# if(!$mysql)
# {
# $error = "Cannot connect to Database Host";
# return($error);
# }
# // Open the mySQL Database
# $mysqldb = mysql_select_db($db);
# if(!$mysqldb)
# {
# $error = "Cannot open Database";
# return($error);
# }
# // Query Table to see if $formvalue is unique
# $myquery = "SELECT * FROM $access_level WHERE $username = '$formvalue'";
# $result = mysql_query($myquery);
# if (!$result)
# {
# $error = "Cannot run Query";
# return($error);
# }
# // Get number of Records found, should be 0 if $formvalue is unique
# $unique = mysql_num_rows($result);
#
# if ($unique > 0)
# {
# $error = $formvalue. " already in use";
# return($error);
# }
# // Return true if $formvalue is unique
# return("true");
#}
#?>
--- End Message ---
--- Begin Message ---
Hi,
I have this piece of code which authenticates the user then sets a cookie.
The problem is that I cannot read the cookie later, either with $cookiename
or $_COOKIE["cookiename"].
My code =
<?php
$colcode='red';
$c1=$uid;
setcookie ("uid", "$c1");
$db = 'herondiary';
$dbuser = 'root';
$dbpass = '';
$dbhost = 'localhost';
mysql_connect($dbhost,$dbuser,$dbpass) or die("could not connect");
mysql_select_db("$db") or die("could not open database");
if (!isset($uid) || !isset($pwd)){
header("Location: default.php");
}else{
$query = "select * ";
$query.= "from users ";
$query.= "where (id='".$uid."' ";
$query.= "AND pwd='".$pwd."')";
$result = mysql_query($query);
$row = mysql_num_rows($result);
if ($row == "0") {
echo $query;
header("Location: default.php");
}else{
while ($row = mysql_fetch_assoc($result)){
setcookie ("valid", "ok", time() +28800);
}
}
header("Location: diary.php");
}
?>
And before someone suggests sessions, I've loooked at several tutorials and
cannot get them to work either.
This is all set up using PHP4.0.6 on Win NT4.
Any help appeciated - this is doing my head in.
Cheers
George
===
George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T +44 (0)1865 799137 direct
T +44 (0)1865 799000 switchboard
F +44 (0)1865 799134
E [EMAIL PROTECTED]
www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.
--- End Message ---
--- Begin Message ---
Hi,
any ideas on how to safely add user to the Windows 2000 AD(with PHP of
course)?
I experimented with exec() and net user /add ... any suggestion will do.
Windows 2000 Server, IIS, PHP 4.2.3 (CGI)
Regards,
Vlado
--- End Message ---
--- Begin Message ---
hi again,
No response to my 2 earlier posts so here goes again.
I have an authentication script which sets up a cookie, but it is not being
created.
I have created some test pages on the same server (NT/IIS4) setting cookies
with variable values and they work fine. It's just that they won't work in
my Calendar site.
Thinking it might be a 'frames' issue, I have put a test into the Frameset
holder to redirect if the cookie is not being read and sure enough it dumps
me out of the frameset.
Does anyone have any suggestions?
Please!
MTIA
George
===
George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T +44 (0)1865 799137 direct
T +44 (0)1865 799000 switchboard
F +44 (0)1865 799134
E [EMAIL PROTECTED]
www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.
--- End Message ---
--- Begin Message ---
Frames are not the issue here, any page in a frame still gets the cookie
providing it is in a domain for which the cookie is set. I suggest making a
page with the following
<?
phpinfo(32);
?>
That will output ALL the variable data for your page. If your cookie has
been sent back by the browser, then you should see it in that page. If you
don't, that means that the cookie has not been sent back to the browser.
This could be:
1) The cookie has expired. Check your temporary internet files for your
cookie, see if it is still there
2) The cookie has not been set to send data to your folder in the domain.
When calling set_cookie( ), it is generally best only to give the first 3
arguments ( Variable Name, Variable Value, Expire time ).
Good luck
Stephen
----- Original Message -----
From: "George Pitcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 4:29 PM
Subject: [PHP-WIN] Cookies working on test but not my application
> hi again,
>
> No response to my 2 earlier posts so here goes again.
>
> I have an authentication script which sets up a cookie, but it is not
being
> created.
>
> I have created some test pages on the same server (NT/IIS4) setting
cookies
> with variable values and they work fine. It's just that they won't work in
> my Calendar site.
>
> Thinking it might be a 'frames' issue, I have put a test into the Frameset
> holder to redirect if the cookie is not being read and sure enough it
dumps
> me out of the frameset.
>
> Does anyone have any suggestions?
>
> Please!
>
> MTIA
>
> George
>
>
> ===
>
> George Pitcher
> HERON Technical Manager
> Ingenta plc
> 23-38 Hythe Bridge Street, Oxford, OX1 2ET
> T +44 (0)1865 799137 direct
> T +44 (0)1865 799000 switchboard
> F +44 (0)1865 799134
> E [EMAIL PROTECTED]
>
> www.ingenta.com
> Ingenta: Empowering the exchange of academic and professional content
> online.
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---