Ik heb een beveiligde chat inlog nodig voor mijn game clan chat
Chat heb ik werkend
Inlog heb ik werkend
Maar nu nog aan elkaar zetten.
Ik denk dat het simpelst is om de login.php samen te voegen met chat.php
Het lijkt mij me een simpel "if else" probleem, but Ik ben een totale beginner.
Ik heb de else al op verschillende plaatsen geprobeerd, maar krijg steeds foutmeldingen betreffende die else.
Als login ok.... enter chat...
als login niet ok... loop back naar login.
Hier geplaatst:
Login
login.php
getresult.inc
validateform.inc
Chat (PHPFreeChat)
chat.php
alvast bedankt voor je tijd..
-=-=-=-=-=- 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>";
?>
-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=-=- chat.php -=-=-=-=-=-=-=-=-
<?php
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
date_default_timezone_set('Europe/Paris');
$params = array();
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
//Mysql
$params["container_type"] = "mysql";
$params["container_cfg_mysql_host"] = "localhost"; // default value is "localhost"
$params["container_cfg_mysql_port"] = 3306; // default value is 3306
$params["container_cfg_mysql_database"] = "database"; // default value is "phpfreechat"
$params["container_cfg_mysql_table"] = "chat"; // default value is "phpfreechat"
$params["container_cfg_mysql_username"] = "username"; // default value is "root"
$params["container_cfg_mysql_password"] = "password"; // default value is ""
// Einde Mysql
$params["title"] = "test";
$params['firstisadmin'] = false;
$params['admins'] = array(
'Zippohontas' => 'test01'); //Ik
//$params["isadmin"] = true; // makes everybody admin: do not use it on production servers ;)
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["language"] = "nl_NL";
//$params["nick"] = "Chatter".rand(1,1000); // setup the intitial nickname
$params["frozen_nick"] = false; // do not allow to change the nickname
$params["shownotice"] = 3; // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit
$params["max_nick_len"] = 20; // nickname length could not be longer than 10 caracteres
$params["max_text_len"] = 400; // a message cannot be longer than 50 caracteres
$params["max_channels"] = 10; // limit the number of joined channels tab to 3
$params["max_privmsg"] = 10; // limit the number of private message tab to 1
$params["refresh_delay"] = 1000; // chat refresh speed is 1 secondes (1000ms)
$params["timeout"] = 180000; // 3 minuten(180000 ms)
$params["max_msg"] = 0; // max message in the history is 15 (message seen when reloading the chat)
$params["height"] = "440px"; // height of chat area is 440px
$params["debug"] = false; // activate debug console
$params["connect_at_startup"] = true;
$params["start_minimized"] = false;
$params["nickmarker"] = true;
$params["clock"] = true;
$params["theme"] = "zilveer";
$params["channels"] = array ("Offensief","Algemeen");
// $params["frozen_channels"] = array ("Offensief","Algemeen");
// $params["time_offset"] = 21600; //"Afwijking server tijd 6 uur x 60 x 60"
$chat = new phpFreeChat( $params );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Elysion-Chat</title>
<link rel="stylesheet" title="classic" type="text/css" href="style/generic.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/header.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/footer.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/menu.css" />
<link rel="stylesheet" title="classic" type="text/css" href="style/content.css" />
<?php $chat->printJavascript(); ?>
<?php $chat->printStyle(); ?>
</head>
<body>
<div class="header">
<img alt="phpFreeChat" src="style/logo.gif" class="logo2" />
</div>
<div class="menu">
<ul>
<li class="sub title">General</li>
<li>
<ul class="sub">
<li class="item">
<a href="demo/">Demos </a>
<?php if (file_exists(dirname(__FILE__)."/checkmd5.php")) { ?>
<a href="checkmd5.php"> Check md5</a>
</li>
<?php } ?>
<!--
<li class="item">
<a href="admin/">Administration</a>
</li>
-->
</ul>
</li>
<li class="sub title">Documentation</li>
<li>
<ul>
<li> <a href="http://www.phpfreechat.net/overview">Overview </a>
<a href="http://www.phpfreechat.net/quickstart"> Quickstart</a>
</li>
<li> <a href="http://www.phpfreechat.net/parameters">Parameters
list </a> <a href="http://www.phpfreechat.net/faq"> FAQ</a> </li>
<li class="item"> <a href="http://www.phpfreechat.net/advanced-configuration">Advanced
configuration </a> <a href="http://www.phpfreechat.net/customize"> Customize</a>
</li>
</ul>
<li class="sub title">Commando's</li>
<hr = 50 align="center">
<font color="#FFFFFF" size="6" face="Arial, Helvetica, sans-serif"><br>
<b>/help = Overzicht commando's<br>
/join naam = nieuwe chatroom<br>
/nick naam = wijzig nick<br>
/leave = verlaat chatroom<br>
/quit = verlaat chat<br>
</b> </font> </li>
</ul>
<p class="partner">
<a href="http://www.phpfreechat.net"><img alt="phpfreechat.net" src="style/logo_88x31.gif" /></a><br/>
</p>
</div>
<div class="content">
<?php $chat->printChat(); ?>
<?php if (isset($params["isadmin"]) && $params["isadmin"]) { ?>
<p style="color:red;font-weight:bold;">Warning: because of "isadmin" parameter, everybody is admin. Please modify this script before using it on production servers !</p>
<?php } ?>
</div>
<div class="footer">
<span class="partners">phpFreeChat partners:</span>
<a href="http://www.jeu-gratuit.net">jeux gratuits</a> |
<a href="http://jeux-flash.jeu-gratuit.net">jeux flash</a> |
<a href="http://www.pronofun.com">pronofun</a> |
<a href="http://areno.jeu-gratuit.net">areno</a> |
<a href="http://www.micropolia.com">micropolia</a> |
<a href="http://www.zeitoun.net">zeitoun</a> |
<a href="http://federation.jeu-gratuit.net">federation</a>
</div>
</body></html>
2.678 views