Jump to content

connecting / registering


Canadiengland

Recommended Posts

for some reason, when i try to register a new account to my game it says "cannot register user". ive searched for this in my php files but cannot find it. also, when i try to log in to my game, it works and displays the new page. but the moment i refresh it says i am not logged in again. is this a problem with my cookies? does anyone have any ideas?

Link to comment
Share on other sites

<html>
<head>
<style type="text/css">
<!--
body {
background-color: #110f0c;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body>
<font color="#990000">
<link rel="stylesheet" href="loginstyle.css" type="text/css">
<?php

include "connect.php";

if (isset($_POST['submit'])) // name of submit button
{
    $player=$_POST['player'];
    $password=$_POST['password'];
    $player=strip_tags($player);
    $password=md5($password);
    $query = "select * from km_users where playername='$player' and password='$password' and validated='1'"; 
    $result = mysql_query($query) or die("No te Gusta") ;
    $result2=mysql_fetch_array($result);
    if($result2)
    {
       session_start();
       $_SESSION['player']=$player;
       print "logged in successfully<br><br>";
       print "<A href='index.php'>Go to Admin Panel</a>";
    }
    else
    {
echo "<center><table width='750' height='144'><td>";
     include 'top.php'; // top
echo "</td></table>";
echo "<table width='750' height='30'><td width='750'><center><img src='images/statusbar.jpg'>";
echo "<center><br><table class='maintable' width='750' height='500'>";
echo "<td>";
print "<center>Wrong username or password or non-activated account.";
print "<center><A href='index.php'>Back</a></center>";
echo "</td></table>";
    }
}

?>

</body>
</html>

 

authenticate.php

 

 

<?php
parse_str("$QUERY_STRING");

$db = mysql_connect("localhost", "root", "stars") or die("Could not connect.");
if(!$db) 
die("no db");
if(!mysql_select_db("monster",$db))
	die("No database selected.");
if(!get_magic_quotes_gpc())
{
  $_GET = array_map('mysql_real_escape_string', $_GET); 
  $_POST = array_map('mysql_real_escape_string', $_POST); 
  $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
}
else
{  
   $_GET = array_map('stripslashes', $_GET); 
   $_POST = array_map('stripslashes', $_POST); 
   $_COOKIE = array_map('stripslashes', $_COOKIE);
   $_GET = array_map('mysql_real_escape_string', $_GET); 
   $_POST = array_map('mysql_real_escape_string', $_POST); 
   $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
}

?>

 

connect.php

 

 

i know its written horribly but it worked before i stopped workin on it for a while

Link to comment
Share on other sites

loooooooooook

  if($result2)
    {
       session_start();
       $_SESSION['player']=$player;
       print "logged in successfully<br><br>";
       print "<A href='index.php'>Go to Admin Panel</a>";
    }

 

you declare the session start at the middle without the ob_start but you dont get an error. now what i mean is that the if statement is not satisfied

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.