|
|
Posted by Jim Michaels on 01/10/06 11:17
obviously I can't see their code, so I guess you're talking about a generic
login script.
don't know anything about a shoutbox. URL?
there is an ENCRYPT(str, passcode) and DECRYPT(str,passcode) function in
MySQL for the password.
you can do it two ways. you can create database users if you have
permissions to do so,
or you can create a table with username and password columns.
to create the table,
mysql_query("CREATE TABLE logins (
username varchar(8) NOT NULL,
password varchar(20) NOT NULL,
PRIMARY KEY(username)
)", $link);
mysql_query("CREATE UNIQUE INDEX login_ix ON logins(username)", $link);
<?php
include 'inc.php';
if (isset($_POST['username']) && isset($_POST['password'] )) {
$q=mysql_query("SELECT DECRYPT(password,'gArblEstRinG') AS pwd FROM
logins WHERE username='$_POST[username]'", $link);
$row=mysql_fetch_array($q);
if (mysql_num_rows($q)>0) { //username found. is pwd correct?
if ($row['pwd']==$_POST['password']) { //total match!
//do something here. we'll redirect to another page.
header("Location: memberspage.php");
} else { // failed to match. show login form.
?>
<form action="index.php" method=post>
<input type=text name=username maxsize=8><br>
<input type=password name=password maxsize=8>
<input type=submit value=Login>
</form>
<?php
}
} else { //failed login. show form.
?>
<form action="index.php" method=post>
<input type=text name=username maxsize=8><br>
<input type=password name=password maxsize=8>
<input type=submit value=Login>
</form>
<?php
}
} else { //not processing, so display form.
?>
<form action="index.php" method=post>
<input type=text name=username maxsize=8><br>
<input type=password name=password maxsize=8>
<input type=submit value=Login>
</form>
<?php
}
?>
to create a new user,
mysql_query("INSERT INTO logins (username, password) VALUES
('$_POST[username]', ENCRYPT('$_POST[password]', 'gArblEstRinG'))", $link);
"Jole" <NECU_SPAMvinkulja@yahoo.com> wrote in message
news:doukkk$e1e$1@ss405.t-com.hr...
>I will put smf shoutbox on my site... only registered users can write on
> shoutbox... how to make this? and login script for smf like on
> www.semenka.com
> can anybody help me?
>
> --
> ::: www.Spalionica.com - portal :::
> ::: www.Forum.spalionica.com - forum :::
>
>
[Back to original message]
|