• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Secure login

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby Zippo » Fri Nov 12, 2010 1:05 pm

I need a secure login because only members of our game clan should be allowed to enter.

I found a nice login:
I have the Mysql container activated and added a table for the login.

So the login works and the chat works... no I need to connect them.

It looks to me a simple "if else" problem, but I am a nooby at this.

If login ok.... enter chat...
If login not ok... loop back to login.

I posted here the login.php and the 2 inc's.

Thanks in advance for your time.


-=-=-=-=-=- login.php -=-=-=-=-=-=-


<?php include("validateform.inc"); ?>

<blockquote>
<?php include("getresult.inc"); ?>
</blockquote>




<form ACTION="login.php" name="saveform" METHOD="POST" align="center">
<div align="center"><center><table border="0" width="704" cellspacing="0" cellpadding="0">
<tr>
<td width="385" align="right"><table border="0" height="59" width="226"
bgcolor="#FFFFFF" cellspacing="1" cellpadding="0">
<tr>
<td width="154" height="19" bgcolor="#000080" align="right"><p><font color="#FFFFFF"><small>Username:</small></font></td>
<td width="133" height="19" bgcolor="#000080" align="left"><p><input NAME="username"
VALUE SIZE="8" MAXLENGTH="16" tabindex="1"></td>
<td width="64" height="19" bgcolor="#C0C0C0" align="center"><div align="center"><center><p><a
href="javascript:alert('The username must be between 4 and 16 characters long.')">
<small><small>Help</small></small></a></td>
</tr>
<tr align="center">
<td width="154" height="17" bgcolor="#000080" align="right"><p><font color="#FFFFFF">
<small>Password:</small></font></td>
<td height="17" width="133" bgcolor="#000080" align="left"><p><input type="password"
name="password" size="8" tabindex="2" maxlength="8"></td>
<td height="17" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('The password must be between 4 and 8 characters long.')">
<small><small>Help</small></small></a></td>
</tr>
<tr align="center">
<td width="154" height="1" bgcolor="#000080"></td>
<td width="133" height="1" bgcolor="#000080" align="left"><p><input TYPE="button"
NAME="FormsButton2" VALUE="Login" ONCLICK="validateForm()" tabindex="3"
style="font-family: Verdana; font-size: 8pt"></td>
<td width="64" height="1" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('Click to save the details')"><small><small>Help</small></small></a></td>
</tr>
</table>
</div></td>
</tr>
</table>
</center></div>
</form>

-=-=-=-=-=-=-=-===-==-=-=-=-=-=-=-=-==-==-=-

-=-=-=-=-=-=- validateform.inc -=-=-=-=-=-=-=-=-=-

<noscript>
<p><strong><font color="#FF0000"><big>Warning: </big>Your Internet Browser has JavaScript
switched off or is an older browser.  You will not be able to complete this
form.  Please switch on JavaScript or return with a newer browser. </font></strong></p>
</noscript>
<script LANGUAGE="javaScript">
<!--
function validateForm()
{
with (document.saveform)
{
var saveit = true;
if (username.value.length < 4)
{
alert ("Username too short. The username must be at least 4 characters in length.");
username.focus();
username.select();
saveit = false;
}
if ((password.value.length < 4) && saveit)
{
alert ("Password too short. The password must be at least 4 characters in length.");
password.focus();
password.select();
saveit = false;
}
if ((fswords(username.value)) && saveit)
{
alert ("The username contains swear words. Please change it you silly person!");
username.focus();
username.select();
saveit = false;
}
if ((fswords(password.value)) && saveit)
{
alert ("The password contains swear words. Please change it you silly person!");
password.focus();
password.select();
saveit = false;
}
else if (saveit) submit();
}
}
swords = new Array()
swords [0] = "fuck"
swords [1] = "shit"
swords [2] = "bastard"
swords [3] = "wank"
swords [4] = "arse"
swords [5] = "bitch"
swords [6] = "cunt"
function fswords(theword)
{
thereturn=false;
theword = theword.toLowerCase();
for (i=0; i < swords.length; i++)
{
testit=theword.indexOf(swords[i],0);
//alert(swords[i]+ " testit ="+testit)
if (testit > -1) thereturn=true;
}
return thereturn
}
//-->
</script>

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

-=-=-=-=-=-=-=-= getresult.inc -=-=-=-=-=-=-=-=-==-=-(config.php contains mysql login data)

<?php
// version 1.1
if (isset($_POST['password'])) // if the password is set then the form has been submitted on login.php page
{
include("config.php");
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$qstr = "SELECT * from members where username ='$username' and password ='$password'";

$result = mysql_query($qstr);
if (mysql_num_rows($result)) echo "<font color=#008000><Center><b>**Successful Login**</b></Center></font>";
else echo "<font color=#ff0000><Center><b>**Failed Login**</b></Center></font>";
mysql_close();
}
else echo "<font color=#ff8000><Center><b>**No login attempted**</b></Center></font>";
?>

-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Last edited by Zippo on Fri Nov 12, 2010 3:21 pm, edited 1 time in total.
Zippo
New member
 
Posts: 6
Joined: Sat Nov 06, 2010 7:13 pm
Top

Postby re*s.t.a.r.s.*2 » Fri Nov 26, 2010 3:41 am

I have made a registration systems that seamless connect with phpfreechat, made specially for it
http://www.phpfreechat.net/forum/viewtopic.php?id=4678
Search gas prices in Los Angeles at tankUpLA
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Zippo » Fri Nov 26, 2010 6:12 pm

Thanks... It works great...
Zippo
New member
 
Posts: 6
Joined: Sat Nov 06, 2010 7:13 pm
Top


Post a reply
3 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 16 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub