hi this is what i'm making

www.gojyotish.com

go here and enter
username="nagz"
pass="nagz"

the problem you'll see is that after submitting the information the page will return bak as it was, nothing wd be notified regarding the success of the login.

But if you just refresh the page, you will see that "Welcome saurabh" is appearing on th top right.....

y is this happening, i'm using cookies to store the name....

Recommended Answers

All 2 Replies

We cannot see your PHP code, so there is no possible way we can tell you what is wrong, please post up some code so that we can look at it.

this is index.php

<?php
if(isset($_POST['submit']))
{
     $dbc=mysqli_connect('localhost','gojyotis_nagzadm','abcd)(*&1','gojyotis_gojyotis')
       or die('Error connecting to database');
     $id=trim($_POST['id']);
     $pass=trim($_POST['pass']);
     $query="select * from user where id='$id' and pass='$pass'";
     $result=mysqli_query($dbc,$query)
       or die('Error quering database');
     if(mysqli_num_rows($result)==1)
     {
        $row=mysqli_fetch_array($result);
        setcookie('user',$id);
        setcookie('uname',$row['fname']);
     }
     else
     {
        echo "<script language='javascript'>";
        echo "alert('Wrong Id or Password')";
        echo "</script>";
     }
     mysqli_close($dbc);
}
?>
<!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" />
<meta name="author" content="Saurabh Nagar, Nagz" />
<meta name="keywords" content="jyotish, astrology, numerology, future, prediction, life, stars, vedic, news,free" />
<meta name="description" content="Get prediction about your life, career, love and more on GoJyotish.com and that too absolutely FREE!!" />
<meta name="verify-v1" content="VbbrnvMvgRUl/6B6Isdcze+W9NyJdqNAyugTaNASRjg=" />
<link href="gojyotis.css" rel="stylesheet" type="text/css" />
<title>Go Jyotish!</title>

<link rel="shortcut icon" href="images/fav.ico" />


<script type="text/javascript">
function start()
{
window.location = "http://www.gojyotish.com/index.php";
}
</script>
<?php 

echo($er);
 include("include1.php");
?>
</head>
<body >
<div id="main">
<?php include("header.php");?>

<div id="login">
<?php
	
if(!isset($_COOKIE['user']))		
		{
?>
<br />
 <form action="index.php" method="post">
    <p> Username :
      <input name="id" type="text" />
      <br />
      <br />
    </p>
  Password :
    <input type="password" name="pass" />
    <br />
    <br />
    <input type="submit" value="Log Me In!" name="submit" /> 
<a href="reg.php"><font size="-1">Register </font></a>
<a href="reco_pass.php"><font size="-1">ForgotPassword?</font></a>
 </form>
 <?php
 


}
else 
{
	$user=$_COOKIE['uname'];
	echo("Welcome ".$user);
        
}
?>
</div>


<div id="data" style="position:absolute; left:317px; top:254px; width: 502px; height:193px;">
<img src="images/indexpic.png" width="500" height="177" alt="Go Jyotish!">
<p> Welcome to GoJyotish.com.</p>
<p>Now you can get answers to all your question regarding your life and that too absolutely </b>FREE!! All you need to do is register with GoJyotish and send us your question by clicking here.</p>
<p>You can also read your numerolgy report and get to know yourself better.</p>
<p>Our gemstone section will guide you in buying the right gemstone based on your sunsign, if you want you can purchase quality gemstones from GoJyotish at cheapest rates.</p>
</div>
</div>
</body>
</html>

this is the include file which contains menu...

<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style>

<span style="display:none" id="fm07">
Menu provided by FlashMenus.net. <a href="http://www.flashmenus.net">Free flash menus, free online flash menu 

builder. Drop down flash menus</a> Copyright Flash-Extensions.net, All Rights Reserved. <a href="http://www.flash-

extensions.net">Flash menu, flash extensions and drop down menus.</a> <a href="http://www.freewebmenus.com">Web 

menu</a>. <a href="http://www.flash-extensions.net/products/flash-extensions/chameleon-flash-menu-

bar/features/">Flash menu bar</a>. <a href="http://www.flash-extensions.net/products/flash-extensions/picasso-

navigation-bar/features/">Navigation bar</a>.
</span>
<!-- Do not delete this code. It will be invisible in your web page. -->

<script type="text/javascript" src="http://www.flashmenus.net/flash-menu.php?sid=1235294585&top=186&left=316&zind=&width=&height=">
</script>
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.