Location of the Videos
maggnetic
Posts: 14 Joined: Sat Dec 31, 2011 2:44 am
Post
by maggnetic » Thu Feb 21, 2013 8:27 pm
help me every time i go to my store an try to buy an item it tells me that in not login this is my store.php
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
?>
</div>
<div id="table">
<?php
$creature = $_GET['creature'];
$counter = 0;
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from store where amount > 0 ";
$invinfo2=mysql_query($invinfo) or die("could not select anything from the store.");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Stat<font color='ffffff'>______</td><td>Stat Add<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>____________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td>$invinfo3[type]</td><td>$invinfo3[price]</td><td><A href='buyitem.php?randid=$invinfo3[randid]'>Buy Item</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There is nothing in the store at this time.<br>";
echo "<a href='battle.php?creature=$creature'>Go Back</center>";
exit;
}
echo "<center><a href='battle.php?creature=$creature'>NeverMind</center></a>";
?>
</div>
Mardonis
Posts: 139 Joined: Wed Jun 29, 2011 7:54 pm
Post
by Mardonis » Thu Feb 21, 2013 9:00 pm
Does this: include_once 'logo.php';
need to be this: include_once 'login.php';
overras
Posts: 91 Joined: Sun Oct 03, 2010 7:25 am
Post
by overras » Fri Feb 22, 2013 3:39 pm
session_start(); must be first defined. But , is enough to define it one time in connect.php, anyway try this:
Code: Select all
<?php
session_start();
include 'connect.php';
include 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
?>
</div>
<div id="table">
<?php
$creature = $_GET['creature'];
$counter = 0;
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from store where amount > 0 ";
$invinfo2=mysql_query($invinfo) or die("could not select anything from the store.");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Stat<font color='ffffff'>______</td><td>Stat Add<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>____________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td>$invinfo3[type]</td><td>$invinfo3[price]</td><td><A href='buyitem.php?randid=$invinfo3[randid]'>Buy Item</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There is nothing in the store at this time.<br>";
echo "<a href='battle.php?creature=$creature'>Go Back</center>";
exit;
}
echo "<center><a href='battle.php?creature=$creature'>NeverMind</center></a>";
?>
</div>
maggnetic
Posts: 14 Joined: Sat Dec 31, 2011 2:44 am
Post
by maggnetic » Tue Feb 26, 2013 3:22 am
no its not a login its a logo
maggnetic
Posts: 14 Joined: Sat Dec 31, 2011 2:44 am
Post
by maggnetic » Tue Feb 26, 2013 3:25 am
overras the code you gave me doesnt seem to work it does the samething
Callan S.
Posts: 2042 Joined: Sun Jan 24, 2010 5:43 am
Post
by Callan S. » Tue Feb 26, 2013 5:55 am
So are you logging in with a log in script? And that doesn't give any errors? Does that log in script have 'session_start();' at the top of it?
Jackolantern
Posts: 10891 Joined: Wed Jul 01, 2009 11:00 pm
Post
by Jackolantern » Tue Feb 26, 2013 2:20 pm
Have you checked to make sure that you are accessing exactly the same session variable that you set when you logged in. I did that tons of times before. $_SESSION['name'] in one, and $_SESSION['player'] in another and things like this.
The indelible lord of tl;dr
maggnetic
Posts: 14 Joined: Sat Dec 31, 2011 2:44 am
Post
by maggnetic » Thu Feb 28, 2013 6:09 pm
callan my login scipt doesnt have a session-start(), does it need to have it?
hallsofvallhalla
Site Admin
Posts: 12026 Joined: Wed Apr 22, 2009 11:29 pm
Post
by hallsofvallhalla » Thu Feb 28, 2013 11:02 pm
yeah make sure the session variable you are setting is called player and that the previous page is not unsetting it.