Hi

**I have doing the project for my purpose. it is working properly on localhost engine.
after i have uploaded to server(cpanel) it is not working.

i have posted my code here for reference:
Please help me anyone!!!**

** Login.php**

 `Inline Code Example Here`

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To Administrator Login page</title>
<link href="login_style.css" rel="stylesheet" type="text/css" />
</head>

<body oncontextmenu="return false;" background="image/bg.jpg">
<h2 align="center">&nbsp;</h2>
<h2 align="center">&nbsp;</h2>
<p class="login_page" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Administrator Login</p>
<p align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="image/locked.png" width="150" height="150" /></p>
<form id="form1" name="form1" method="post" action="verify_admin.php">
<p align="center" class="username">Username : 
<input type="text" name="u_name" id="u_name" />
</p>
<p align="center" class="username">Password : 
<input type="password" name="pass" id="pass" />
</p>
<p align="center">
<input type="submit" name="submit" id="submit" value="Login" style="background-color:#ee4902; width:100px; height:35px; border:1px #efcebf solid; border-radius:5px; -moz-border-radius:5px; font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#FFFFFF; font-weight:bold;"/>
</p>
</form>
<br\>
<h3 align="center" class="para">
<?php
if(isset($_GET['id']))
{
echo $_GET['id'];
}
?>
</h3>

</body>
</html>

logout.php
`

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
session_start();
$_SESSION=array();
setcookie(session_name(),"",time()-3600);
session_destroy();
header("Location: login.php?id=You are successfully logged out");
?>
<body oncontextmenu="return false;" background="../image/bg.jpg">
</body>
</html>

`
verify_admin.php

`

Inline Code Example Here


<?php

if(isset($_SESSION['name']))
{
if(!$_SESSION['name']=='admin')
{
header("Location:login.php?id=You are not authorised to access this page unless you are administrator of this website");
}
}
else
{
header("Location:login.php?id=You are not authorised to access this page unless you are administrator of this website");
}
?>
<?php
/*
connecting to mysql database
hostname : localhost
username : root
password : 123456
*/
$con = mysql_connect("localhost","rnzsnet_prabaweb","DT$,k-qT2^_W");
if(!$con)
{
die("connection to database failed".mysql_error());
}

/* selecting the database "cms" */
$dataselect = mysql_select_db("rnzsnet_contact",$con);
if(!$dataselect)
{
die("Database namelist not selected".mysql_error());
}
?>

<?php
$uname=$_POST['u_name'];
$pass=$_POST['pass'];

$qry=mysql_query("SELECT * FROM login WHERE user='$uname'", $con);
if(!$qry)
{
die("Query Failed: ". mysql_error());
}
else
{
$row=mysql_fetch_array($qry);
//echo $row["user"]." ".$row["password"]."<br/>";

if($_POST['u_name']==$row["user"]&&$_POST['pass']==$row["password"])
{
ob_start();
session_start();
$_SESSION['name']=$_POST['u_name'];
$uname=$_POST['u_name'];
header("Location:admin_panel.php");
}
else
{
header("Location:login.php?id=username or password you entered is incorrect");
}
}

?>

`
admin_panel.php

`

Inline Code Example Here
<?php
session_start();
if(isset($_SESSION['name']))
{
if(!$_SESSION['name']=='admin')
{
header("Location:login.php?id=You are not authorised to access this page unless you are administrator of this website");
}
}
else
{
header("Location:login.php?id=You are not authorised to access this page unless you are administrator of this website");
}
?>
<?php
/*
connecting to mysql database
hostname : localhost
username : root
password : 123456
*/
$con = mysql_connect("localhost","rnzsnet_prabaweb","DT$,k-qT2^_W");
if(!$con)
{
die("connection to database failed".mysql_error());
}

/* selecting the database "cms" */
$dataselect = mysql_select_db("rnzsnet_contact",$con);
if(!$dataselect)
{
die("Database namelist not selected".mysql_error());
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To ADMINISTRATION PANEL</title>
<link href="admin_style.css" rel="stylesheet" type="text/css" />
<script TYPE="text/javascript"> 
//Disable select-text script (IE4+, NS6+)
function disableselect(e){
return false
} 
function reEnable(){
return true
} 
//if IE4+
document.onselectstart=new Function ("return false") 
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>

</head>

<body oncontextmenu="return false;" background="../image/bg.jpg">
<div class="container1" align="center">
<div id="top">
<h2 align="center">ADMINISTRATION PANEL</h2>         

</div>
<div id="log">
<table border="0" width="300" height="50" style="border:1px #333333 solid;">
<tr>
<td>
<?php
echo "Welcome ".$_SESSION['name'];
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<a href=logout.php>Logout</a>";
?>
</td>
</tr>
<tr>
<td>
 <a href="help.php">FAQ</a>
 </td>
 </tr>
</table>
</div>
<div id="left">
<table border="0" width="500" height="200" class="admin">
<tr>
<td align="center">
<a href="create_new.php" style="font-family:Arial, Helvetica, sans-serif;    font-size:15px; color: #f36223; text-transform:uppercase;   font-weight:bold;">Create New Event</a><br/>
</td>
</tr>
<tr>
<td align="center">
<a href="admin_panel.php?id=viewall" style="font-family:Arial, Helvetica, sans-serif;    font-size:15px; color: #f36223; text-transform:uppercase;   font-weight:bold;">View all Events</a><br/>
</td>
</tr>
</table>
</div>
<div id="right">

    <?php
if(isset($_GET['id'])=="viewall")
{
$qry=mysql_query("SELECT * FROM events order by events.id DESC ", $con);
if(!$qry)
{
die("Query Failed: ". mysql_error());
}
echo "<table class='admin' border='0' width='510' style='border:3px #333333 solid; margin-top:10px;' cellspacing='5'>";
/* Fetching data from the field "title" */
while($row=mysql_fetch_array($qry))
{
echo "<tr>";
echo "<td style='border:1px #333333 solid;'><a href=articles.php?id=".$row['id']." style='font-family:Arial, Helvetica, sans-serif;   font-size:15px; color: #004692; text-transform:uppercase;   font-weight:bold;'>".$row['title']."</a></td>";
echo "<td style='border:1px #333333 solid;'><a href=edit_article.php?id=".$row['id']." style='font-family:Arial, Helvetica, sans-serif;   font-size:15px; color: #70c30e; text-transform:uppercase;   font-weight:bold;'><img src='image/edit.png' width='10' height='10' />&nbsp;&nbsp;&nbsp;edit</a></td>";
echo "<td style='border:1px #333333 solid;'><a href=delete_article.php?id=".$row['id']." style='font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#000000;  text-transform:uppercase;   font-weight:bold;'><img src='image/del.png' width='10' height='10' />&nbsp;&nbsp;&nbsp;delete</a></td>";
echo "</tr>";
}
echo "</table>";
}
?>

</div>
<div id="foot_event" align="center">            
            <table border="0" width="550" height="80">
            <tr>
            <td align="center">
            <p class="foot">©BMI Concepts. All Rights Reserved.</p>
            </td>
            </tr>

            <tr>
            <td align="center">
            <p class="foot">Brand Market Intelligence and Its logo are registered trademarks of ARCHLER LTD.</p>
            </td>
            </tr>
            </table>
            </div>
</div>
</body>
</html>

`

database sql file:

`

Inline Code Example Here

-- Database: `rnzsnet_contact`
--

-- --------------------------------------------------------


CREATE TABLE IF NOT EXISTS `login` (
  `user` varchar(20) NOT NULL,
  `password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `login`
--

INSERT INTO `login` (`user`, `password`) VALUES
('WEBADMIN', 'WEBPASSWORD');

`

Anyone help me please?

after i have uploaded to server(cpanel) it is not working.

What exactly is not working? Did you also upload the database? Perhaps you need to change the credentials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.