Hi,
to prevent acces to my mediawiki server, I create a form requiring the login to server and I check the answer according to values saved into a DB table created with phymyadmin
Now, before to run the mediawiki object the form is displayed
to perform this , I modified the index.php as following
<?php
session_start();
header('Content-Type: text/html; charset=UTF-8');
if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
// We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
require dirname( __FILE__ ) . '/includes/PHPVersionError.php';
wfPHPVersionError( 'index.php' );
}
if (isset($_SESSION['Acces']) && ($_SESSION['Acces']==false)){
echo "<center><h2><font color='red'>Incorrect Login</font></h2><center>"; }
if (isset($_SESSION['Acces']) && ($_SESSION['Acces'])){
require __DIR__ . '/includes/WebStart.php';
$mediaWiki = new MediaWiki();
$mediaWiki->run();
}
else {
?>
<center>
<form action ="checkForm.php" method="post">
<b>identifiant : </b><input type="text" name="inputlogin" size="30"> <br />
<b>password : </b><input type="password" name="inputpwd" size="30"> <br />
<div class="action">
<input type="submit" class="btn primary" value="Valider">
</div>
</form>
</center>
<?php
}
and I create a checkForm.php as following
<?php
session_start();
error_reporting(E_ALL & ~E_NOTICE);
$_SESSION['mytwikiLog'] = $_POST['inputlogin'];
$_SESSION['mywikiPwd'] = sha1($_POST['inputpwd']);
$connect = mysqli_connect("localhost","root","rootpass","myDB") or die('error BD connect');
$query = 'SELECT * FROM myTable' ;
$result = mysqli_query($connect,$query) or die('Table error') ;
while($row = mysqli_fetch_row($result)){
if ( ($_SESSION['mywikiLog']==$row[1]) && ($_SESSION['mywikiPwd']==$row[2]) ){
$_SESSION['Acces']=true;
break;}
else {
$_SESSION['Acces']=false;}
}
mysqli_free_result($result);
mysqli_close($connect);
require("./index.php");
exit();
?>
But Now when I want to enter my connect login to the mediawiki The login is performed but I always have the two messages (brown and pink)
- 'userlogin-loggedin' : you are already logged in as .... use the form below to ogin an another user
- 'nocookieslogin' : SITENAME uses cookies to login users. You have cookies disabled. Please enabe them and try again
but I am corectly connect to the wiki and my cookies are activated
WHY HAVE I THIS TWO MESSAGES ?
Please coud you help me great thanks