Добрый день. Есть добрые люди, которые могут помочь прикрепить скриптик к DLE ?
Хочется в меню при нажатии на кнопочку Кабинет, что бы появилось это чудо... Ну как регистрация и так далее
accounting.php
<?php
$enabled = true;
$passtype = 0;
$file = "D:/RunUO/Saves/Accounts/accounts.xml";
$savelog = false;
$shardname = null;
$shardurl = null;
try{
session_start();
$error = $_GET['e'];
if ($error != null){
if ($error == 2){
session_destroy();
echo "<div id=error>Logging out...</div>";
echo "<meta http-equiv=refresh content=2;url=" . $_SERVER['PHP_SELF'] . ">";
exit();
}
else{
echo "<div id=error>Invalid credentials. Please try again.</div>"; }
}
if (session_is_registered("acctID")){
header("location:Manage.php");
}
// check to makesure vars are valid
if (!$enabled)
exit ("This feature is not yet enabled. Please contact the admin.");
if (!file_exists($file))
exit ("$uodir cannot be found");
if ($passtype != 0 && $passtype != 1 && $passtype != 2)
exit("Invalid Passtype");
if ($shardurl == null)
$shardurl = $_SERVER['HTTP_HOST'];
if ($shardname == null){
$shardname = "";
}
if ($shardname != ""){
echo "<title>$shardname Account Management</title>";
}
else{
echo "<title>Account Management</title>";
}
//retreive un and pw
$username = $_POST['uoun'];
$password = $_POST['uopw'];
if ($username != null && $password != null){
// if attemted to login
switch ($passtype){
case 0 :
//sha1 salted
$password = substr_replace(strtoupper(chunk_split(sha1("$username$password"),2,"-")),"",-1);
break;
case 1 :
//md5
$password = substr_replace(strtoupper(chunk_split(md5("$password"),2,"-")),"",-1);
break;
default:
case 2 :
//plain-text
$password = $password;
break;
}
$xmlDoc = new DOMDocument();
$xmlDoc->load($file);
$total = $xmlDoc->getElementsByTagName('accounts')->item(0)->getAttributeNode('count')->value;//accounts->count
$x = $xmlDoc->getElementsByTagName( "account" );
$counter = 0;
foreach ($x AS $item)
{
switch ($passtype){
//retreive the password from the xml file
case 0 : $xmlPass = $item->getElementsByTagName( "newCryptPassword" )->item(0)->nodeValue; break;
case 1 : $xmlPass = $item->getElementsByTagName( "cryptPassword" )->item(0)->nodeValue; break;
default:
case 2 : $xmlPass = $item->getElementsByTagName( "Password" )->item(0)->nodeValue; break;
}
$xmlName = $item->getElementsByTagName( "username" )->item(0)->nodeValue;
$accesslevel = $item->getElementsByTagName( "accessLevel" )->item(0)->nodeValue;
if ($username == "$xmlName" && $password == "$xmlPass"){
//done($name, $pass, $accesslevel);
//echo "Logged In";
$_SESSION['acctID'] = $counter;
$_SESSION['passID'] = $password;
$_SESSION['userID'] = $username;
$_SESSION['fileID'] = $file;
$_SESSION['passType'] = $passtype;
header("location:Manage.php");
exit();
return;
}
else
{ if ($counter >= $total - 1){
header("location:".$_SERVER['PHP_SELF']."?e=1");
exit();
}
$counter++;
}
}
}
}
catch(Exception $e){
exit("Internal Server Error<br>$e");
}
//begin other stuff...
echo "<LINK href=AcctStyle.css rel=stylesheet type=text/css>";
echo "<form method=POST action=" . $_SERVER['PHP_SELF'] . "> ";
echo "<center>";
echo "<table class=maintbl>";
echo " <tr>";
if ($shardname != "")
echo "<td height=35 colspan=2><b class=shardname>$shardname Account Management</td>";
else
echo "<td height=35 colspan=2><b class=shardname>UO Account Management</td>";
?>
</tr>
<tr>
<td>Username :</td>
<td><input type=text class=txt name=uoun></td>
</tr>
<tr>
<td>Password :</td>
<td><input type=password class=txt name=uopw></td>
</tr>
<tr>
<td></td>
<td><input type=submit value="Login" class=btn></td>
</tr>
</table>
</center>
</form>
</font>
Manage.php
<?php
session_start(); // DO NOT EDIT THIS FILE, NEWB!
if (!isset($_SESSION['acctID'])){
header("location:Accounting.php");exit();
}
$edit = $_GET['edit'];
if ($edit != null && $edit == "password"){
echo "<form method=POST action=" . $_SERVER['PHP_SELF'] . "> \n";
echo "<table class=edit>\n";
echo "<tr><td>Please type your current password :</td>\n<td><input type=password name=oldPass></td></tr>\n";
echo "<tr><td>Please type your new desired password :</td>\n<td><input type=password name=newPass></td></tr>\n";
echo "<tr><td>Please type it again to verify :\n</td><td><input type=password name=verPass></tr></td>\n";
echo "<tr><td></td><td><input type=submit value=Change>\n</td></tr>";
echo "</table>";
echo "</form>\n";
echo "<hr>";
}
$oldPass = $_POST['oldPass'];
$newPass = $_POST['newPass'];
$verPass = $_POST['verPass'];
if ($oldPass != null){
switch ($_SESSION['passType']){
case 0 :
//sha1 salted
$password = substr_replace(strtoupper(chunk_split(sha1($_SESSION['userID']."$oldPass"),2,"-")),"",-1);
break;
case 1 :
//md5
$password = substr_replace(strtoupper(chunk_split(md5("$oldPass"),2,"-")),"",-1);
break;
default:
case 2 :
//plain-text
$password = $oldPass;
break;
}
if ($password != $_SESSION['passID']){
echo "The old password was incorrect."; }
else if ($newPass != $verPass){
echo "The two passwords did not match."; }
else{
echo $_SESSION['passType'];
$xmlDoc = new DOMDocument();
$xmlDoc->load($_SESSION['fileID']);
switch ($_SESSION['passType']){
case 0 : $xmlDoc->getElementsByTagName( "newCryptPassword" )->item( $_SESSION['acctID'])->nodeValue = substr_replace(strtoupper(chunk_split(sha1($_SESSION['userID']."$newPass"),2,"-")),"",-1); $xmlDoc->save($_SESSION['fileID']); break;
case 1 : $xmlDoc->getElementsByTagName( "cryptPassword" )->item( $_SESSION['acctID'])->nodeValue = substr_replace(strtoupper(chunk_split(md5("$newPass"),2,"-")),"",-1); $xmlDoc->save($_SESSION['fileID']); break;
default:
case 2 : $xmlDoc->getElementsByTagName( "Password" )->item( $_SESSION['acctID'])->nodeValue = $newPass; $xmlDoc->save($_SESSION['fileID']); break;
}
//$xmlDoc->getElementsByTagName( "cryptPassword" )->item( $_SESSION['userID'])->nodeValue = substr_replace(strtoupper(chunk_split(md5("$newPass"),2,"-")),"",-1);
$xmlDoc->save($_SESSION['fileID']);
echo substr_replace(strtoupper(chunk_split(sha1($_SESSION['userID']."$newPass"),2,"-")),"",-1);
echo "Password was sucessfully changed!";
}
}
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Accounting</title>
<LINK href=AcctStyle.css rel=stylesheet type=text/css>
</head>
<body>
<p>Hello <?php echo $_SESSION['userID']; ?>!<br>
[ <a href="Accounting.php?e=2">Logout</a> ]</p>
<table class=maintbl>
<tr>
<td class=firstcol>Username</td>
<td class=secondcol>
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load($_SESSION['fileID']);
echo $xmlDoc->getElementsByTagName("username")->item($_SESSION['acctID'])->nodeValue;
?>
</td>
<td class=thirdcol> </td>
</tr>
<tr>
<td class=firstcol>Password</td>
<td class=secondcol>[ hidden ]</td>
<td class=thirdcol>[ <a href="<?php echo $_SERVER['PHP_SELF'] . "?edit=password"; ?>">edit</a> ]</td>
</tr>
<tr>
<td class=firstcol>Account Created</td>
<td class=secondcol>
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load($_SESSION['fileID']);
$upDate = $xmlDoc->getElementsByTagName("created")->item($_SESSION['acctID'])->nodeValue;
echo substr($upDate,0,10);
?></td>
<td class=thirdcol> </td>
</tr>
<tr>
<td class=firstcol>Last Game Login</td>
<td class=secondcol>
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load($_SESSION['fileID']);
$upDate = $xmlDoc->getElementsByTagName("lastLogin")->item($_SESSION['acctID'])->nodeValue;
echo substr($upDate,0,10);
?>
</td>
<td class=thirdcol> </td>
</tr>
<tr>
<td class=firstcol>IP Addresses</td>
<td class=secondcol><?php
$xmlDoc = new DOMDocument();
$xmlDoc->load($_SESSION['fileID']);
echo $xmlDoc->getElementsByTagName("addressList")->item($_SESSION['acctID'])->nodeValue;
?></td>
<td class=thirdcol> </td>
</tr>
</table>
<p> </p>
</body>
</html>
AcctStyle.css
.edit input, .txt{ border: 2px solid #EAEAEA; background-color: #3F3F3F; color: brown;}
body {font-family: verdana, arial; background-color: #0C0C0C; color: #FFFFFF; font-size: 12pt}
.maintbl {font-size: 10pt; width: 500px; padding: 20px; margin: 0px; border: 2px solid #EAEAEA; background-color: #3F3F3F}
.maintbl .firstcol {width: 200px; font-weight: bold;}
.maintbl .secondcol {width: 100px;}
.maintbl .thirdcol{width: 100px;}
.eCol {text-align: right;}
hr {color: white;}
a{color: white; text-decoration: none;}
a:hover{color: white; text-decoration: none; border-bottom: dashed 1px white;}