Re: login
am 10.01.2006 10:17:39 von Jim Michaels
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);
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.
?>
}
} else { //failed login. show form.
?>
}
} else { //not processing, so display form.
?>
}
?>
to create a new user,
mysql_query("INSERT INTO logins (username, password) VALUES
('$_POST[username]', ENCRYPT('$_POST[password]', 'gArblEstRinG'))", $link);
"Jole" 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 :::
>
>