Location: PHPKode > scripts > Bioloide > botlane/install.php
<?php
	session_start();
?>
<html lang="en">
<head>
<title>Bot Lane - Installer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" href="script.css" rel="stylesheet">
<style>
	.admin
	{
		padding:16px;
		border:1px solid #036;	
	}
</style>
</head>
<body bgcolor="#FFFFFF" >


<script language="JavaScript">

function changeIPoption(element)
{
  if(document.install.ip.checked)
  {
    element.value="withip";
    document.install.regcheck.value="Register by login or IP recognition";
  }
  else
  {
    element.value="noip";
    document.install.regcheck.value="Register by login only";
  }

}

</script>
<noscript>

write("JavaScript required");

</noscript>

<?php

function already($login, $users="scriptol-users.php")
{
	
	if(empty( $login ))
	{
		return false; 	
	}
	
	$fp = @fopen( $users, 'r' ); 
	if($fp == false)
	{
		return false;
	}
	while( !feof( $fp ) ) 
	{ 
		$line = trim(fgets( $fp, 1000)); 
		list($l, $p) = explode( ',', $line ); 
		if($l == $login) 
		{ 
			fclose($fp); 
			return true; 
		} 
	} 

	fclose( $fp ); 
	return false; 
	
}	


if (isset( $_POST ))
   $posted = &$_POST ;		
else
   $posted = &$HTTP_POST_VARS ;

$ulogin = $posted['login'];
$upass = $posted['password'];
$usertype = $posted['type'];
$ipallowed = $posted['ip'];
$filename = "index.php";
$users="scriptol-users.php";

$already = false;
$registered= false;

$pass5 = "x" . MD5($upass);


//echo "pass $upass md5 ". $pass5. "<br />";

if(already($ulogin))
{
	echo "<br />$ulogin already used, try another name...<br />";
	$filename ="install.php?login=$ulogin";
	$already = true;
}


if($already==false && $ulogin != false)
{

	if(strlen($ulogin) < 3)
	{
		die("Login length must be at least 3 letters");
	}	
	else
	{
		$fp = fopen( $users, 'w' ); 
		$ip = md5($_SERVER[REMOTE_ADDR]);
		if($ipallowed) fwrite($fp,"ip,$ip,$usertype\n");
		fwrite($fp, "$ulogin,$pass5,$usertype\n");
		fclose($fp); 

		$_SESSION["login"] = $ulogin;
		$_SESSION["password"] = $upass;
		$registered= true;
	}
}	



?>



<div id="content"> 
  <h1>Install  Bot Lane </h1>
  <p>The webmaster assistant</p>

<?php

if($registered==false)
{
echo "
  <p>Enter a login and a password into the fields below, and click on the Register 
    button.<br>
    If PHP version is prior to 5, set up the .htaccess file for PHP 5.</p>

<div class='admin'>
  <form method='post' name='install' action='install.php' >
	<input type='hidden' name='type' value='admin' >  
    <p> Login: 
        <input type='text' name='login'> Three letters at least.
    </p>
    <p> Password: 
        <input type='password' name='password'>
    </p>
    <p> IP recognition: 
        <input type='checkbox' name='ip' checked value='withip' onClick='changeIPoption(this)' title='Auto registration for your computer only'>  Recommanded but if you are in unsecure environment.
    </p>
    <p> 
      <input type='submit' name='regcheck' value='Register by login or IP recognition'>
    </p>
  </form>
</div>";
}
else
{

echo "
<p>You are now registered as $login</p>
<p>Now delete the install.php file in the Bot Lane directory.</p>
<br>
<form action='$filename' method='post' target='_parent'>
	<input type='submit'  value='Continue here'>
</form>";
}

?>

<br>

<?php
	phpinfo(INFO_GENERAL);
?>
<?php
	phpinfo(INFO_CONFIGURATION);
?>
<?php
	phpinfo(INFO_VARIABLES);
?>






  <p id="footer">(c) 2009 <a href="http://www.scriptol.com/" target="_parent">Scriptol.com</a> 
    - Free and Open Source software by Denis Sureau under GNU GPL 3.0 license. 
  </p>

</div>
</body>
</html>

Return current item: Bioloide