Jump to content

Recommended Posts

Hi , I'm getting this output to the screen on loading my page that has the registration in it. Any help greatly appreciated. Thanks. Derek.

 

0)) { die ("Username taken."); } else { mysql_query("INSERT INTO usersystem (username, password) VALUES ( '$username', '$password' )") or die (mysql_error()); echo "Account created.";) } ?>

 

here is the code

 

<?php

include("db.php");

if (isset($_POST['username']) && isset($_POST['password']))
{

//Prevent SQL injections

$username = mysql_real_escape_string($_POST['username']);

$email = mysql_real_escape_string($_POST['email']);


//Get MD5 hash of password

$password = md5($_POST['password']);

//Check to see if username exists

$sql = mysql_query("SELECT username FROM usersystem WHERE username = 'username'");

if (mysql_num_rows($sql>0))

{

die ("Username taken.");

}

else
{
mysql_query("INSERT INTO usersystem (username, password) VALUES ( '$username', '$password')") or die (mysql_error()); echo "Account created."

}

?>

Link to comment
https://forums.phpfreaks.com/topic/208782-php-registration-script-error/
Share on other sites

That's just the raw php code in the file. If you do a 'view source' in your browser, you will see all of the php code.

 

Either php is not installed on your web server, you browsed using a file system path to the file instead of a URL so that the web server was completely bypassed, the file name does not have a .php extension, or there is some other reason why the php code is not being seen as php code on your web server.

Thank you I fixed some syntax errors and I was using the directory path by mistake. Also, I can't figure out why I'm getting an error at the end of my file next to </html> on line 151. Any more help greatly appreciated. thanks for helping me so much before. Derek

 

<?php

include("db.php");

if (isset($_POST['username']) && isset($_POST['password']))
{

//Prevent SQL injections

$username = mysql_real_escape_string($_POST['username']);

$email = mysql_real_escape_string($_POST['email']);


//Get MD5 hash of password

$password = md5($_POST['password']);

//Check to see if username exists

$sql = mysql_query("SELECT username FROM usersystem WHERE username = 'username'");

if (mysql_num_rows($sql>0))

{

die ("Username taken.");

}

else
{
mysql_query("INSERT INTO usersystem (username, password) VALUES ( '$username', '$password')") or die (mysql_error()); 
echo "Account created.";

}

?>
<!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" />
<title>Realm of the Sun Dragon</title>


<title>The Kingdom of Loathing</title>
<link rel="stylesheet" type="text/css" href="css/mainpage.css">
<style type="text/css">
<!--
.style4 {
font-weight: bold;
font-family: "Times New Roman", Times, serif;
font-size: xx-large;
color: #B9A428;
}
.style5 {
color: #FFD646
}
-->
</style>
</head>
<link href='icon/dragon_icon.jpg' rel='icon' type='image/jpg'/>
<body bgcolor=white link=black alink=black vlink=black text=black">

<center>
<table cellpadding=5>
<tr>

<td><img src="dragon_images/glass_dragon_left_tiny.jpg"></td>
<td>
<center>
  <font class="style4 style5">Realm of the Sun Dragon</font><br>
  <br>
</font></center>
</td><td><img src="dragon_images/glass_dragon_right_tiny.jpg"></td>
</table>
</center>
<center>

<table cellpadding=3><tr>
  <td style=" font-family: arial; font-size: 12px; ">
    <div align="center"><a href="whatis.html">What is ROSD?</a>
        <b>::</b>
      
        <a href="createplayer.php">Create an Account</a>
        <b>::</b>
        <a target=_blank href="#">Forums</a>
        <b>::</b><a href="sendmail.php">Contact Us</a>
      
        </font></div></td>
</tr></table>

<table>
<tr>
<td valign=top>

<table  width=250  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor= #996600><b>Enter the Realm:</b></td>
</tr><tr><td style="padding: 5px; border: 1px solid gold;"><center><table><tr><td><table align=center>
<form name="Login" action="register.php" method="post">

<tr><td align=right class=small>Login:</td><td align=left><input class=text type=text name=username size=16 ></td></tr>
<tr><td align=right class=small>Password:</td><td align=left><input class=text type=password name=password size=16></td></tr>
<tr><td colspan=2><center> 
           <input class=button type=submit value="Log In" name=submit id=Submit></center>
<p>

<font size=1>If you've forgotten your password, or need your activation code resent, please <a href="forgotpassword.php">click here</a>.
<p>
Logging in constitutes agreement to abide by the <a href="policies.html">Policies of ROSD</a>.</td></tr>
</form>
</table>

</td></tr></table></center></td></tr><tr><td height=4></td></tr></table><table  width=250  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=#996600><b>Sign Up!</b></td>
</tr><tr><td style="padding: 5px; border: 1px solid gold;"><center><table><tr><td><span class=small>Don't have an account?  Create one -- it's free!</span><center><form style='display: inline;' action=createplayer.php><input type=submit class=button value="Create a Character">
</form></td></tr></table></center></td></tr><tr><td height=4></td></tr></table><table  width=250  cellspacing=0 cellpadding=0><tr>
  <td style="color: white;" align=center bgcolor=#996600><b>Support the Realm:</b></td>
</tr><tr><td style="padding: 5px; border: 1px solid gold;"><center><table><tr>
  <td><font size=2>
<b>A friendly message from the Creator, Derek.</b>

<p>
As the number of ROSD players increases, so does the cost of hosting.  I very much want to keep the game free, so please consider supporting the development and maintenance of the Realms by donating (once you're logged in...) or picking up some groovy merchandise from our <a target=_blank href="#">Store</a>.
<p>
With a donation of 10 dollars or more, you'll receive an in-game gift!  Check the donate page (accessible from your top menu after you've logged in) for details.
  </font>
</td></tr></table></center></td></tr><tr><td height=4></td></tr></table></td>
<td valign=top>
<table  width=350  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=#996600><b>Announcements:</b></td>
</tr><tr><td style="padding: 5px; border: 1px solid gold;"><center><table><tr><td><font size=2>There are currently <b>780</b> players logged in.<p>Looking for ROSD players in your area?  Check out the <a target=_blank href="forum.php">community forum</a>!
<p><b>July 23</b><br>
  Sample
<p><b>July 19</b><br>
  Sample
<p><b>June 30</b><br>
  Sample.


<p><center><a href="oldannouncements.php">old announcements</a> / <a href="trivialupdates.php">trivial updates</a>
</center></font></td></tr></table></center></td></tr><tr><td height=4></td></tr></table><table width=350  cellspacing=0 cellpadding=0><tr>
  <td style="color: white;" align=center bgcolor=#996600><b>Go beyond...</b></td>
</tr><tr><td height="243" style="padding: 5px; border: 1px solid gold;"><center>
  <img src="dragon_images/front_dragon_gold.jpg" alt="" width="242" height="309" />
</center></td></tr><tr><td height=194></td>
</tr></table></td>

</tr></table>
</center>


<p align="center"> <font face=Arial>Copyright © 2010 by <a href="http://derekvanderven.com"> Derek Van Derven</a></font></p>

</body></html>

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.