Jump to content

Register Issue


Recommended Posts

I know i'm a noob for using a free template, just temporary ;)

Anyway so when i try to register i get this error message

If your not going to put a decent input in please don't bother.

So basically my question is does anyone know the problem? Im pretty sure its to do with creating a mysql table, if it is does anyone know what i need to enter as I'm not the best at this coding lark ;)

Thanks in advance

Below is what happens when i submit the register form


Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fragzyyx/public_html/register.php on line 66

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fragzyyx/public_html/register.php on line 67

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fragzyyx/public_html/register.php on line 78

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fragzyyx/public_html/register.php on line 79

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fragzyyx/public_html/register.php on line 87

Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in /home/fragzyyx/public_html/register.php on line 88

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fragzyyx/public_html/register.php on line 89



Heres my code!


-- # Created by wrx 1/26/2010
-- # This file is Creative Commons Attributions 2.5 license
-- # Attribution — You must attribute the work in the manner specified by the author or licensor 
    (but not in any way that suggests that they endorse you or your use of the work).
  # Share Alike — If you alter, transform, or build upon this work, you may distribute the 
    resulting work only under the same, similar or a compatible license.
-- # Filename : register.php
//require "global_func.php";
echo "
<!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'>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<link rel='stylesheet' type='text/css' href='style.css' />
echo("<b><font color=red size=+1>Your IP has been banned, there is no way around this.</font></b></body></html>");
<div id='wrap'>
 <div id='header'>
   <h1><img src='images/titlenew.png'></h1>
   <div align='right'>
      <form action=authenticate.php method=post name=login id='sc'>
    <table width='400' border='0' cellspacing='10' cellpadding='10'>
	<tr><td colspan='4'> </td></tr>
    <img src='images/username.png'><input name='username' type='text' id='username' class='name'/></td>
       <td><img src='images/password.png'><input name='password' type='password' id='password' class='pass'/></td>
       <td align='center' valign='bottom'><input type='image' src='images/login.png' name='submit' id='submit'  value='Login' class='submit'/></td>
	<td align='center' valign='bottom'> </td>
   <ul id='nav'><b>
     <li class='first'><a href='login.php'>HOME</a></li>
     <li><a href='loginnews.php'>NEWS</a></li>
     <li><a href='contact.php'>CONTACT</a></li>
     <li><a href='register.php'>REGISTER</a></li></b>
 <!-- /header -->
 <div id='content'>
   <div class='main fr'>
     <div class='mainin'>
       <td align='center'><h2>Gang Wars Registration</h2></td>";
global $c;
if($_POST['promo'] == "Your Promo Code Here")
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=mysql_query("SELECT * FROM users WHERE username='{$username}'",$c);
print "Username already in use. Choose another.";
else if($_POST['password'] != $_POST['cpassword'])
print "The passwords did not match, go back and try again.";
$_POST['ref'] = abs((int) $_POST['ref']);
$q=mysql_query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}",$c);
die("Registration Error");
if($_POST['ref']) {
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ref']}",$c);
mysql_query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, display_pic,searches) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, 'Male', unix_timestamp(), '{$_POST['email']}', -1, '$ip','images/id_template.jpg',100)", $c);
mysql_query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)", $c);

if($_POST['ref']) {
mysql_query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}",$c);
event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c);
mysql_query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$ip')", $c);
print "You have signed up, enjoy the game.<br>
<a href='login.php'>Login</a>";
print "<form action=register.php method=post>
<table border='0' width='100%'>
<tr><td>Username: </td><td><input type=text name=username></td></tr>
<tr><td>Password: </td><td><input type=password name=password></td></tr>
<tr><td>Confirm Password: </td><td><input type=password name=cpassword></td></tr>
<tr><td>Email: </td><td><input type=text name=email></td></tr>
<tr><td>Terms: </td><td><a href='terms.php'>By Registering to Gang-Wars<p> you agree to the TOS!</a></td></tr>
<input type=hidden name=ref value='";
if($_GET['REF']) { print $_GET['REF']; }
print "'>
<h2><b>Due to current registration issues please use old register format by clicking <a href='register2.php'>here</a></b><h2>.
<tr><td align='center' colspan='2'><input type=submit value=Submit></td></tr></form></table>";
///////////////////End Registration//////////////////////////

	echo"  </div>
   <div class='side fl'>
     <div class='sinner'><center>
       <p><img src='images/screenshots.png'><img src='images/screenshots.png'><br /><img src='images/screenshots.png'><img src='images/screenshots.png'><br /></p>
	<br /></center></div>
     <div id='bg'>
  <center><a href='register.php'><img src='images/registergif.gif'></a></center>
 <!-- /content -->

 <!-- /footer -->
  <br />
Edited by illusions
Added Code Tags
Link to comment
Share on other sites

I don't see any code that tries to connect to your database. ($c can't be referenced if you don't include a global file with a connection in it).

Your queries are trying to select from your database, but they have no idea which database to connect to, so they throw an error.

You either need to include the global file that connects to your database, or to write the code that connects to the database on that page (use the cron pages as a reference).

Link to comment
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...