FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Strange PHP Problem





pckid2
Okay, the register page on my site seems to be broken and I don't know why.

First, see for yourself. Go to http://wiipages.my-place.us and click on the register button. Usually, the register page should apper in the Iframe that contained the button, but instead it's blank, and if you right click on it and go to properties it will say 'Size: Not Availible' or sometimes '0 bytes'. This is really strange because in Filezilla, it says it's 2124 bytes, as seen here:



Also, here is the code to the register file, register.php:

Code:
<html>
<?php


// Connects to your Database
mysql_connect("________", "__________", "________") or die(mysql_error());
mysql_select_db("________") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] ) {
die('You did not complete all of the required fields');
}

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}

// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match.');
}

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database
$insert = "INSERT INTO users (username, password, email)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')";
$add_member = mysql_query($insert);
$insert2 = "INSERT INTO slots (username)
VALUES ('$_POST['username']')";
$add_member2 = mysql_query($insert2);
?>

<h1>Registered</h1>
<p>Thank you, you have registered - you may now login.</p>

<?php
}
else
{   
?>
<font face = "arial">
<form action="register.php" method="post">
<table border="0">
<tr><td colspan=2><h1>Register</h1></td></tr>
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60" size="15">
</td></tr>
<tr><td>Email:</td><td>
<input type="text" name="email" maxlength="60" size="15">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="10" size="15">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2" maxlength="10" size="15">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>
</font>

<?php
}
?>
</html>


Any help would be appreciated Very Happy
ncwdavid
Ok first where is the register page? I can't find it?
MrBlueSky
ncwdavid wrote:
Ok first where is the register page? I can't find it?


It's that blue highlighted thingy Very Happy
pckid2
Oh yeah, sorry, wrong link. That's the link to the news site, sorry, it's here
mathiaus
When I try, I get an error. Maybe you have turned PHP reporting down?
Change this line (to what I have below), this will hopefully solve the problem (then works for me).
Code:
VALUES ('".$_POST['username']."')";
pckid2
Thanks, mathiaus, you always seem to be fixing my problems.

I had the code like that before, but I changed it to try and get it to work properly, when you registered, it made two records in users and none in slots, so I think I still need to fix that bit. Any suggestions?

Edit: Wow, I must of fixed the other error earlier, it's all working now!
Related topics
Strange Fire fox problem
simple php problem, please help...
A PHP problem !
HTML + PHP problem
A php problem
PHP problem...
PHP Problem: Unable to execute ext. commands
PHP Problem...
[PHP] Problem with Dynamic Sig's Font Color
Form and PHP problem
PHP imagecreate + CSS problem.
PHP imagecreate + CSS problem.
Could there be a PhP problem on the server?
[help]Mysql & php problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.