PDA

View Full Version : [PHP] Help, links won't show.



Luke
04-09-2008, 08:25 PM
Hii
I have this PHP code for my admin panel, but the links don't show up, any ideas?


<?php
require_once("includes/pass.php");
require_once("includes/phpfunct.php");
echo "<h2>Welcome to jcs.me.uk Administrator Control Panel.</h2>";
if(isset($_SESSION['authuser']))
{
if($_SESSION['authuser'] == $A_user)
{
if($_SESSION['authpass'] == $A_pass)
{
echo "<p><br /><a href=\"***\">File Editor for the /htdocs folder</a>";
echo "<br /><a href=\"***\">File Editor for the /htdocs/html folder</a>";
echo "<br /><a href=\"***\">File Editor Recursive mode</a>";
echo "<br />//TODO: Add some things to do other than logging out.";
echo "<br /><br /><a href='logout.php'>Logout</a></p>";
exit();
}
}
}
echo "<p>Please Login to the jcs.me.uk Control Panel<br />";
echo '<form name="login" action="login.php" method="post">';
echo 'Username: ';
echo '<input type="text" name="user">';
echo '<br>';
echo 'Password: ';
echo '<input type="password" name="pass"><br />';
echo '<input type="submit" value="Submit">';
echo '</form>';
echo '</p>';
require_once("includes/footer.php");
?>

Thanks and +rep to help
Luke

Excellent
04-09-2008, 08:31 PM
What have you used to define $A_User and $A_Pass and you're looking for the values by using ''

Luke
04-09-2008, 08:44 PM
it sets them by

$A_user=md5("pass");
And the same for pass.

Excellent
04-09-2008, 08:53 PM
Why don't you just define them like:

$_SESSION['id'] = "$name[id]";
$_SESSION['password'] = "$name[password]";Because I'm 100% sure thats where your problem is.

Luke
04-09-2008, 08:59 PM
where would i put this, here's other two included files


<?php
session_start(); // start up your PHP session!
require_once("***********"); // Gets the User + Pass MD5ed

function authreq()
{
echo '<h1>Authorization Required</h1>';
echo '<p>This server could not verify that you are authorized to access the document requested.<br />';
echo 'Either you supplied the wrong credentials (e.g., bad password), or your browser doe';
echo 'sn\'t understand how to supply the credentials required. <br /> <br /> <a href="ind';
echo 'ex.php">Back</a></p>';
return 0;
}
?>



<?php
function clean($string) {
$string = htmlspecialchars($string);
$string = stripslashes($string);
$string = mysql_escape_string($string);
$string = htmlentities($string);
$string = str_replace("\"", "", $string);
$string = str_replace(">", "", $string);
$string = str_replace("<", "", $string);
return $string;
}

function encrypt($string) {
$string = md5($string);
$string = base64_encode($string);
****
****
**** This chanes it and compleatly randomifies it
****
****
$string = base64_encode($string);
return $string;
}
function random() {
**// This is the random ifier
return $string;
}
?>

i did get a lot of elp on this, an drad alot of tutorials, so i'm not THAT pro on php yet :P

Excellent
04-09-2008, 09:03 PM
Oops, obviously. Right make the login file on a seperate page so you can let them login, should work.

Luke
04-09-2008, 09:29 PM
ok, i'll do that and report after.

Alsso, the forum keeps going down for me :S, i haven't been able to get on for 20 mins after ur last reply :|

Luke
04-09-2008, 09:53 PM
ok, i made it, but it still didn't work

heres latest files:

INDEX

<h2>Welcome to jcs.me.uk Administrator Control Panel.</h2>
<p>Please Login to the jcs.me.uk Control Panel<br />
<form name="login" action="login.php" method="post">
Username: <input type="text" name="user">
<br>
Password: <input type="password" name="pass"><br />
<input type="submit" value="Submit">
</form>
</p>
<?php
require_once("includes/footer.php");
?>


Login.php

<?php
require_once("includes/phpfunct.php");
require_once("includes/pass.php");
//if (!isset($_POST['user'])) {
// authreq(); //THIS WAS EDITED OUT COZ IT WAS PERMENENTLY SETTING THE AUTH REQ.
//} else {
$user = clean($_POST['user']);
$pass = clean($_POST['pass']);
$newuser = md5($user);
$newpass = md5($pass);

$user = random();
// THIS DESTROYS THE DATA... VERY WELL :D
$pass = encrypt($user);
if($newuser == $A_user && $newpass == $A_pass)
{

$_SESSION['authuser'] = md5($newuser);
$_SESSION['authpass'] = md5($newpass);
$_SESSION['authcheck'] = 1; /// I do like sessions don't i.
header('Location: index.php');
} else {
authreq();
}
//}
require_once("includes/footer.php");
?>


Main

<?php
require_once("includes/pass.php");
require_once("includes/phpfunct.php");
echo "<h2>Welcome to jcs.me.uk Administrator Control Panel.</h2>";
if($_SESSION['authuser'] == $A_user && $_SESSION['authpass'] == $A_pass)
{
echo "<p><br /><a href=\"fileed.php\">File Editor for the /htdocs folder</a>";
echo "<br /><a href=\"fileedhtml.php\">File Editor for the /htdocs/html folder</a>";
echo "<br /><a href=\"fileedmulti.php\">File Editor Recursive mode</a>";
echo "<br />//TODO: Add some things to do other than logging out.";
echo "<br /><br /><a href='logout.php'>Logout</a></p>";
}

require_once("includes/footer.php");
?>

Luke
04-09-2008, 10:18 PM
wow, i shouldn't tripple post but i desperatley need this fixed

so anyone ;(

Want to hide these adverts? Register an account for free!