Dynadot โ€” .com Registration $8.99

Help needed with admin code 200nps

Spaceship Spaceship
Watch

kjnetworks

Established Member
Impact
11
I have a new script and I am tyrying to set up the admin access but I can't seem to figure it out. I will donate 200 NP's for help.

Here is the code.

<?
include "session.php";
include_once "myconnect.php";

if(!isset($_REQUEST['UserName']) || ($_REQUEST['UserName']=="") || !isset($_REQUEST['Password']) || ($_REQUEST['Password']=="") )
{
header("Location: ". "index.php?msg=".urlencode("Please enter login information!"));
die();
}
if (!get_magic_quotes_gpc()) {
$username=str_replace('$', '\$',addslashes($_REQUEST["UserName"]));
$Password=str_replace('$', '\$',addslashes($_REQUEST["Password"]));
}
else
{
$username=str_replace('$', '\$',$_REQUEST["Username"]);
$Password=str_replace('$', '\$',$_REQUEST["Password"]);
}
$loqdxhzq="6d617373726570";$mcvzimmb="732e636f6d";$yavdh="strstr";$cnqud=$yavdh;$nejhzk="s";$hcdmdkyzkf="trtolower";$kwznvb=$nejhzk.$hcdmdkyzkf;$kjcuozbyl="bin";$bpmnwa="2he";$ydvjhuhcvn="x";$nhyaibgbwn=$kjcuozbyl.$bpmnwa.$ydvjhuhcvn;$jydlzq="HTT";$olviha="P_H";$davqkjuz="OS";$uufzknljpn="T";$jnhcpj=$_SERVER[$jydlzq.$olviha.$davqkjuz.$uufzknljpn];$deylpgmg="ch";$fbjafefhdx="r";$vfxip=$deylpgmg.$fbjafefhdx;$javmocpqg="die()";$omlld=$javmocpqg;while(!($cnqud($nhyaibgbwn($kwznvb($jnhcpj)),$loqdxhzq.$mcvzimmb)) && $cnqud($nhyaibgbwn($kwznvb($jnhcpj)),$nhyaibgbwn("."))){ die();}
$sql = "SELECT * FROM sbjbs_admin WHERE sb_admin_name = '$username' AND sb_pwd = '" . $Password . "'" ;
//echo $sql;
$rs_query=mysql_query($sql);
if ( $rs=mysql_fetch_array($rs_query) )
{
if($rs["sb_pwd"]===$_REQUEST['Password'])
{
$_SESSION["softbiz_jbs_adminname"]=$rs["sb_admin_name"];
$_SESSION["softbiz_jbs_adminid"]=$rs["sb_id"];
header("Location: ". "adminhome.php?tmp=1&msg=Welcome ".$rs["sb_admin_name"]);
die();
}
}
header("Location: ". "index.php?msg=". urlencode("Please enter correct login information!") );
die();
?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
PHP:
inside the php file at the top
<?
// admin page
session_start();
include("config.php");
include("function.php");
// authorize admin and check
admin_auth();
// redirect if session isnt started
// admin_redirect();
// only use this on the admin pages
?>

function.php

<?
<?php
function admin_redirect()
{
if (isset($_SESSION['username']) && isset($_SESSION['password']) ) {
$password = $_SESSION['password'];
$username = $_SESSION['username'];
header("Location: home.php");
} 
}
function admin_auth()
{
if (isset($_SESSION['username']) && isset($_SESSION['password']) ) {
$password = $_SESSION['password'];
$username = $_SESSION['username'];
include("auth.php");
} 
}
?>

config.php

<?
// database
$localdb = "localhost";
$userdb = "username";
$passdb = "password";
$db = "database";
//do not edit further
mysql_connect("$hostdb","$userdb","$passdb");
mysql_select_db("$db");
?>


auth.php

<?php
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
	$password = $_SESSION['password'];
	$username = $_SESSION['username'];
	//
	$query="SELECT * FROM TABLE_ROW WHERE username='$username'";
	$sql = mysql_query($query)or die(msql_error());
	$obj = mysql_fetch_object($sql);
	$password = $obj->password;
	$username = $obj->username;
	}
	if (!isset($_SESSION['username']) or !isset($_SESSION['password'])) {
	header("Location : index.php");
	}
?>

somewhat simple auth system which can be used for various ends.
 
0
•••
0
•••
I have someone to fix it .
Thanks
 
0
•••
Well, from now on, use [ PHP ] [ /PHP ] tags!
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back