Lotto320
01-14-2012, 01:07 PM
Ok, so I need help programming my CPanel.
My users log in by writing their username and password wich they registered with earlier.
The database is via MySQL, as you may understand.
I already have the CPanel up, but I want an other feature to exist.
A premium rank wich adds special fields in the CPanel IF the user got "premium" to "ok" in their table-row based on username.
So if they got "ok" on "premium", more options should appear in the CPanel.
The current CPanel looks like this:
http://img708.imageshack.us/img708/2695/5c40039c6c7e4a5fb4b0b75.png
cpanel.php
<form action="checklogin.php" method="post">
<td>
<p align="right">Server Name:</td>
<td><input type="text" name="name" value="" size="20"></td>
</tr>
<tr>
<td>
<p align="right">Password:</td>
<td><input type="password" name="password" size="20"></td>
</tr>
</table>
</ul>
<p><input type="submit" value="Login »" name="Submit"></p>
</form>
Checklogin.php
<?php
$host="***";
$username="**";
$dbpassword="**";
$db_name="**";
$tbl_name="webclientcreate";
mysql_connect("$host", "$username", "$dbpassword")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['name'];
$mypassword=$_POST['password'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM webclientcreate WHERE name='$myusername' AND password='$mypassword' AND status='ok'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_start();
$_SESSION['username'] = ("$myusername");
$_SESSION['password'] = ("$mypassword");
$_SESSION['name'] = $_POST['name'];
header( 'location: cpanel_edit.php' );
}
else {
echo ''
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Wrong username/password.</title>
</head>
<body>
<p>Wrong username or password.</p>
</body>
</html>
cpanel_edit.php
<?php
$host="***";
$username="***";
$dbpassword="**";
$db_name="***";
$tbl_name="webclientcreate";
mysql_connect("$host", "$username", "$dbpassword")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
session_start();
$name = $_POST['name'];
$ip = $_POST['ip'];
$port = $_POST['port'];
$loader = $_POST ['loader'];
$email = $_POST ['email'];
$password = $_POST ['password'];
$background = $_POST ['background'];
$download = $_POST ['download'];
$sql="SELECT * FROM webclientcreate WHERE name='".mysql_real_escape_string($_SESSION['name'])."'";
if (($result = mysql_query($sql))) {
while ($row = mysql_fetch_array($result)) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Edit</title>
</head>
<body>
<form action="cpanel_update.php" method="post" class="uniForm">
<td>
<p align="right">Server Name:</td>
<td><?php echo $row['name'];?></td>
</tr>
<tr>
<td>
<p align="right">IP&Port:</td>
<td><input type="text" name="ip" size="20" class="textInput required" value="<?php echo $row['ip'];?>">:<select name="port">
<option value="43594">43594</option>
<option value="5555">5555</option>
</select></td>
</tr>
<tr>
<td>
<p align="right">Email:</td>
<td><input type="text" name="email" size="20" maxlength="50" id="email" class="textInput required validateEmail"></td>
</tr>
<tr>
<td>
<p align="right">Email Again:</td>
<td><input type="text" name="email_confirm" size="20" maxlength="50" id="email_again" class="textInput required validateSameAs email"></td>
</tr>
<tr>
<td>
<p align="right">Loader:</td>
<td><select name="loader">
<option value="**">InsidiaX</option>
<option value="***">HybridPVP v3</option>
</select></td>
</tr>
<tr>
<td>
<p align="right">Webclient BG:</td>
<td><input name="background" data-default-value="http://" size="20" maxlength="65" type="text" value="<?php echo $row['background'];?>" class=""/></td>
</tr>
<tr>
<td>
<p align="right">Desktop Client:</td>
<td><input name="download" data-default-value="http://" size="20" maxlength="50" value="<?php echo $row['download'];?>" type="text" class=""/></td>
</tr>
<tr>
<td>
<p align="right">Password:</td>
<td><input type="password" name="password" size="20" maxlength="40" class="textInput required"></td>
</tr>
</table>
</ul>
<p><input type="submit" value="Create »" name="Submit"></p>
</form>
</div>
</center>
</div>
<script>
$(function(){
$('form.uniForm').uniform({
prevent_submit : false
});
});
</script>
</body>
</html>
<?php
}
} else die(mysql_error());
?>
Side-note: I have no idea if this is in the right section.
Any help is appreciated.
My users log in by writing their username and password wich they registered with earlier.
The database is via MySQL, as you may understand.
I already have the CPanel up, but I want an other feature to exist.
A premium rank wich adds special fields in the CPanel IF the user got "premium" to "ok" in their table-row based on username.
So if they got "ok" on "premium", more options should appear in the CPanel.
The current CPanel looks like this:
http://img708.imageshack.us/img708/2695/5c40039c6c7e4a5fb4b0b75.png
cpanel.php
<form action="checklogin.php" method="post">
<td>
<p align="right">Server Name:</td>
<td><input type="text" name="name" value="" size="20"></td>
</tr>
<tr>
<td>
<p align="right">Password:</td>
<td><input type="password" name="password" size="20"></td>
</tr>
</table>
</ul>
<p><input type="submit" value="Login »" name="Submit"></p>
</form>
Checklogin.php
<?php
$host="***";
$username="**";
$dbpassword="**";
$db_name="**";
$tbl_name="webclientcreate";
mysql_connect("$host", "$username", "$dbpassword")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['name'];
$mypassword=$_POST['password'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM webclientcreate WHERE name='$myusername' AND password='$mypassword' AND status='ok'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_start();
$_SESSION['username'] = ("$myusername");
$_SESSION['password'] = ("$mypassword");
$_SESSION['name'] = $_POST['name'];
header( 'location: cpanel_edit.php' );
}
else {
echo ''
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Wrong username/password.</title>
</head>
<body>
<p>Wrong username or password.</p>
</body>
</html>
cpanel_edit.php
<?php
$host="***";
$username="***";
$dbpassword="**";
$db_name="***";
$tbl_name="webclientcreate";
mysql_connect("$host", "$username", "$dbpassword")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
session_start();
$name = $_POST['name'];
$ip = $_POST['ip'];
$port = $_POST['port'];
$loader = $_POST ['loader'];
$email = $_POST ['email'];
$password = $_POST ['password'];
$background = $_POST ['background'];
$download = $_POST ['download'];
$sql="SELECT * FROM webclientcreate WHERE name='".mysql_real_escape_string($_SESSION['name'])."'";
if (($result = mysql_query($sql))) {
while ($row = mysql_fetch_array($result)) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Edit</title>
</head>
<body>
<form action="cpanel_update.php" method="post" class="uniForm">
<td>
<p align="right">Server Name:</td>
<td><?php echo $row['name'];?></td>
</tr>
<tr>
<td>
<p align="right">IP&Port:</td>
<td><input type="text" name="ip" size="20" class="textInput required" value="<?php echo $row['ip'];?>">:<select name="port">
<option value="43594">43594</option>
<option value="5555">5555</option>
</select></td>
</tr>
<tr>
<td>
<p align="right">Email:</td>
<td><input type="text" name="email" size="20" maxlength="50" id="email" class="textInput required validateEmail"></td>
</tr>
<tr>
<td>
<p align="right">Email Again:</td>
<td><input type="text" name="email_confirm" size="20" maxlength="50" id="email_again" class="textInput required validateSameAs email"></td>
</tr>
<tr>
<td>
<p align="right">Loader:</td>
<td><select name="loader">
<option value="**">InsidiaX</option>
<option value="***">HybridPVP v3</option>
</select></td>
</tr>
<tr>
<td>
<p align="right">Webclient BG:</td>
<td><input name="background" data-default-value="http://" size="20" maxlength="65" type="text" value="<?php echo $row['background'];?>" class=""/></td>
</tr>
<tr>
<td>
<p align="right">Desktop Client:</td>
<td><input name="download" data-default-value="http://" size="20" maxlength="50" value="<?php echo $row['download'];?>" type="text" class=""/></td>
</tr>
<tr>
<td>
<p align="right">Password:</td>
<td><input type="password" name="password" size="20" maxlength="40" class="textInput required"></td>
</tr>
</table>
</ul>
<p><input type="submit" value="Create »" name="Submit"></p>
</form>
</div>
</center>
</div>
<script>
$(function(){
$('form.uniForm').uniform({
prevent_submit : false
});
});
</script>
</body>
</html>
<?php
}
} else die(mysql_error());
?>
Side-note: I have no idea if this is in the right section.
Any help is appreciated.