Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

oh no! how can ask guest to register in my site---->>

General discussions related to php

Moderators: macek, egami, gesf

oh no! how can ask guest to register in my site---->>

Postby sarjanajava » Sun Jan 05, 2003 9:38 am

Hello Mr. Pejone and all of members

Can you advice me how to:-

1. Asking guest to register->become a member of site. For example this forum
2. using Mysql to store database:USERNAME and PASSWORD. only username registered can access relevant data (i.e portal)
-different user , different data. With my experience i use this code to ASKING user to input USERNAME and PASSWORD and then SUBMIT -process with another file
1. passwordLecturer.php---> for asking user to input username & password
Code: Select all
<? php
include("header1.php");
   print("You're using ");
   print($HTTP_USER_AGENT);
   print(" to see this page.<BR>\n");
 print("please enter your PASSWORD");
?>

<form method="POST" action="kataLecturer.php">
<div align="left"><p><font face="BankGothic Md BT">
Admin name?</font>
   <input type="text" name="name" size="14">
Admin password?</font>
<input type="password" name="pw1" size="15"><br><input type="submit" value="submit"></p>

</div></form>



and then this is
2.kataLecturer.php---> to process username and password

Code: Select all
<?php

$adminname="azman";
$adminpass = "1234";
if ($pw1 == $adminpass)
if($name ==$adminname)
{
//   print("WELCOME TO ADMINISTRATION PAGE");
   echo("<BR>");

include("lecturerpages.php");


}


  else
{
   print("Wrong password");
}
?>


If i want to add another password i have a problem. I need that username & password can be stored in Mysql and then using PHP , i can retreive.
--------------------------------------
Thanks. Happy New Year for happy live

SELAMAT TAHUN BARU 2003
User avatar
sarjanajava
New php-forum User
New php-forum User
 
Posts: 41
Joined: Wed Nov 27, 2002 10:59 pm

Postby Joan Garnet » Sun Jan 05, 2003 10:46 am

If you want to, we can tell you how to do it :D
but there are many resources on the net that you can download and see how they work.
Your method is okay, the only thing is that you have to implement mysql queries.
And one little thing -->
Code: Select all
if ($HTTP_POST_VARS["pw1"] == $adminpass and $HTTP_POST_VARS["name"] ==$adminname) {
......
}


I suggest using md5 encription to manage passwords. You can send them from the browser using javascript md5 and then check them using the md5 php function (which is already implemented) from the server.

javascript md5 --> http://pajhome.org.uk/crypt/md5/

If you have further problems, just ask
bye!
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

md5?

Postby sarjanajava » Mon Jan 06, 2003 8:09 am

thanks for your advice.

I've been visited your website. it's very interesting. I'm Masters Degree student in IT and also taking :Information Security subject in my study.

how to use that md5 jscript according to php or ?. i don't understand.
*---------------------------
simple Malay Language
Greeting:
Good Morning : SELAMAT PAGI
selamat- "good condition, situation, free"
pagi - "morning - 7.00 a.m and above untill
12.00 p.m (noon)
User avatar
sarjanajava
New php-forum User
New php-forum User
 
Posts: 41
Joined: Wed Nov 27, 2002 10:59 pm

Postby Joan Garnet » Mon Jan 06, 2003 10:49 am

Well, I would use the javascript md5 encyption system to send the password from the browser's visitor and then I would keep it in the database as is.
This a good way to ensure a minimum of security.
Then just use it any time the visitor logs in to compare with the one kept in the database.

Using the php md5 function is not as secure as sending it from the very browser (php is a server side language), because you are sending private information through the net and then converting it into hexadecimal value.
The best way is doing it from home :D

An example:

the javascript:
Code: Select all
function encript_validate(){
   if(document.forms[0].elements[0].value!="" && document.forms[0].elements[1].value!=""){//this two are the login and password textfields
      md5_enc = hex_md5(document.forms[0].elements[1].value);//let's encript the password befor sending it
      document.forms[0].elements[1].value = md5_enc;//let's change the password textfield value with the new encripted value
      return true;
      //alert(document.forms[0].elements[1].value);//uncomment it to see how it works
   }else{
      alert("Fill all fields, please!");
      return false;      
   }
}


the form:
Code: Select all
<form action="<?php $php_self ?>" onsubmit="return encript_validate()" method="POST">
l o g i n <br>
<input type="text" name="user"><br>
p a s s w o r d <br>
<input type="password" name="hex_pass"><p>
<input type="submit" name="send_it" value="Send it!">
</form>


This is how I didi it.
I hope you'll find it useful
:)
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron