MySQL Help (php)
#1

Hy i use filterscript tkadmin
then i want to made an register system on a website
i made register.php but i get some error
can you guys help me?

HTML Code:
<?php include("servervariables.php");  include('database.php');
if(isset($_GET['l']))
{
	if($_GET['l'] == "a")
	{
		define("logintype", "admin");
	}
}
else define("logintype", "player");
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo SERVERNAME;?></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
	<h1><?php echo SERVERNAME;?></h1>
	<h2><?php echo SLOGAN;?></h2>
</div>
<div id="left">
	<div id="menu" class="boxed">
		<h2 class="heading">Pages</h2>
		<ul>
			<li class="first"><a href="index.php" title="">Home</a></li>
			<li><a href="stats.php" title="">Player Stats</a></li>
			<li><a href="admins.php" title="">Admins</a></li>
			<li><a href="register.php" title="">Register</a></li>
			<li><?php echo'<a href="login.php?l=a" title="">Admin Control Panel</a>';?></li>
			<li><?php echo'<a href="login.php" title="">User Control Panel</a>';?></li>
            <?php if(defined("FORUMURL")) echo "<li><a href='FORUMURL'>Forums</a></li>"; else echo  "<p>&nbsp;</p>";?>
		</ul>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
	</div>
</div>
<!-- end #left -->
<div id="right">
	<div class="boxed">
		<h2 class="heading">News</h2>
<p>
<?php
include("news.php");
mysql_close($con);
?></p>
	</div>
</div>
<!-- end #right -->
<div id="center">
	<div class="boxed">
		<h1 class="heading">Welcome to <?php echo SERVERNAME;?>!
		  </h1><center>
		    <p>
		  <h1>Register </h1>
[COLOR="Red"]<!-- register -->[/COLOR]
		<form method=post action=register.php?action=register name=s>
		<table>
		<tr><td>Username:</td><td><input type=text name=user ></td></tr>
		<tr><td>Email:</td><td><input type=text name=email></td></tr>
		<tr><td>Pass:</td><td><input type=password name=password ></td></tr>
		<tr><td>Verify Pass:</td><td><input type=password name=vpassword></td></tr>
		<tr><td colspan=2 align=center><input type=submit value=Daftar></td></tr>
		</table>
		</form>
			
            <?php
            mysql_connect("localhost","root","");
			mysql_select_db("tkadmin");
			//if registering, check fields.
		if ($action == register ){
	       		if (!$user || !$password || !$email || !$vpassword) {
			print "You must fill out all fields.";
			exit;
        	}
			$dupe1 = mysql_num_rows(mysql_query("select * from 'playerinfo' where user='$user'"));

        	if ($dupe1 > 0) {
  			print "Someone already has that username.";

  			exit;
   			}
			$dupe2 = mysql_num_rows(mysql_query("select * from 'playerinfo' where email='$email'"));
	        if ($dupe2 > 0) {
	  		print "Someone already has that email.";

			exit;
        	}

			//check if passwords are the same
	        if ($password != $vpassword) {
	  		print "The passwords do not match.";

			exit;
        	}
			//end
			//insert
			mysql_query("insert into 'playerinfo' (user, email, password, kills, deaths, score, money, adminlvl) values ('user', 'email', 'password', 'kills', 'deaths', 'score', 'money', 'adminlvl')");
			print "You are now registered. Login.";
			}
			?>
[COLOR="Red"]<!--end of register-->[/COLOR]
	  </center></p>
</div>
</div>
<!-- end #center -->
<div style="clear: both;">&nbsp;</div>
<div id="footer">
	<p id="legal">Copyright <?php echo SERVERNAME;?>. All Rights Reserved. Website created and designed By [HiC]TheKiller and XFlawless. Icons by glyphish.</p>
	<p id="links"><a href="index.php">Home</a> | <a href="stats.php">Stats</a> | <a href="admins.php">Admins</a> | <a href=<?php if(isset($_SESSION['logged'])) echo "adminpage.php"; else echo "login.php?l=a";?>>ACP</a> | <a href=<?php if(isset($_SESSION['logged'])) echo "playerpage.php"; else echo "login.php";?>>UCP</a>  </p>
</div>
</body>
</html>
<? mysql_close($con); ?>
i marked the register system on color of red
the error is on linke 73
HTML Code:
if ($action == register ){
notice of errors:

Code:
Notice: Use of undefined constant register - assumed 'register' in C:\wamp\apps\phpmyadmin3.2.0.1\WEB\register.php on line 73

Notice: Undefined variable: action in C:\wamp\apps\phpmyadmin3.2.0.1\WEB\register.php on line 73
Reply
#2

someone pls help me made the php code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)