PDA

View Full Version : Registration page not registering new users to MYSQL


cleako
12-29-04, 12:07 AM
Hello everyone, I've got a bit of a problem..

I've got this registration page, http://www.dareborn.com/register.php and when the user hits submit, it sends them to a page saying:

Registration Failed
We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.
Please try again at a later time.

(I copied that out of the php code)
Problem being: MYSQL database isnt accepting new user registrations AKA new rows.

My database is mysql09.powweb.com, database name: da, table: da

I had an old friend write the php to the whole site back in July, saved the php files to my harddrive, and so forth. Then yesterday, he sent me the entire database that it used, stripped of the actual data such as usernames.. passwords.. but it has the core data needed. I uploaded that to the MYSQL database I'm using, connected it via the database.php file and it seems to work, all except for creating new users. (Theres no registered ones to login to yet so I dont even know if the login works)

I'm attaching register.txt (the php code to it) and attaching the database.txt (also in php)

If someone could explain how to fix the code (either in the php files or in the MYSQL database) so it will allow new data to be fed in the database, I'd really appreciate it.

BTW: I've deleted some of the html code inside of register.txt(.php) to make it under 10kb - the html code was non required input boxes.

EDIT: I've updated the register.txt file with the changes sudgested, still doesnt work..

cleako
12-29-04, 12:18 AM
oh and heres whats in the mysql database

cleako
12-29-04, 01:24 PM
this is the database.php which contacts the mysql database for all the php pages

dieverse
12-29-04, 01:39 PM
There are some differences between your database and what you are trying to insert with the php code. I didn't look at all of the code, but from the little code I saw what seemed to be a few mistakes.

1) In your user table you have:
`PASSWORD` varchar(32) default NULL,
I think you should make this consistent with your other fields and make it all lower case. You refer to this field in lower case in the code also.

2) Another example of differences between your code and the database is your database doesn’t have these fields:

squad,clanname,url,totmembers

but you try to insert data into them within your addNewUser() function.

Basically you probably have a couple of careless mistakes in the code. Just try double checking all of your inserts match the database.

cleako
12-29-04, 02:06 PM
alright, i've removed squad,clanname,url,totmembers out of register.php and i've made password lowercase in the database.

I dont know how to manually add a username and password - just enough to allow me to actually "log in" on the site though. I guess i'm supposed to add a row under username along with password.. hasn't worked though.

What I see at the bottem of the users table is this:

Indexes : [Documentation]
Keyname Type Cardinality Action Field
PRIMARY PRIMARY 0 Edit Drop id
username UNIQUE None Edit Drop username

could that username there have anything to do with the problem?

Still getting the Registration Failed message. What do you mean by addNewUser() function? Much of this was written by a friend whom I cant get ahold of anymore, I've figured out how to customize it.. I'm also using Dreamweaver.

cleako
12-29-04, 05:25 PM
Still not working.. any ideas anyone?

This is what he was talking about:

$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regresult'] = addNewUser($_POST['user'], $_POST['pass'], $_POST['email'], $_POST['name'], $_POST['msn'], $_POST['yahoo'], $_POST['icq'], $_POST['aim'], $_POST['country'], $_POST['birth'], $_POST['attack'], $_POST['defence'], $_POST['strength'], $_POST['hitpoints'], $_POST['ranged'], $_POST['prayer'], $_POST['magic'], $_POST['cooking'], $_POST['woodcutting'], $_POST['fletching'], $_POST['fishing'], $_POST['firemaking'], $_POST['crafting'], $_POST['smithing'], $_POST['mining'], $_POST['herblore'], $_POST['agility'], $_POST['thieving'], $_POST['runecrafting'], $_POST['combat'], $_POST['overall'], $_POST['user_level'], $_POST['squad'], $_POST['clanname'], $_POST['url'], $_POST['totmembers'], $_POST['dl'], $_POST['other']);
$_SESSION['registered'] = true;
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[PHP_SELF]\">";

cleako
12-29-04, 11:50 PM
:s i need help on this guys.. my site is paralized until this bug is fixed

cleako
12-30-04, 02:20 PM
^bump^

mongoose643
12-30-04, 06:20 PM
Hello cleako,

I've been having a similar problem. I have not checked my user registration section yet but it seems that mine may not work either. However the problem I did come in contact with is an admin feature that updates the page contents. I know, I know, you're probably thinking I use the "UPDATE" feature but I had problems getting that to work back when I first built the site but a series of queries that deleted then inserted a new row worked just fine so I decided to go with that instead. Now that isn't working at all and I haven't the faintest idea as to why unless it is a "PowWeb" issue and not a "me" issue. If I find a solution I'll let you know but I have a feeling that PowWeb admin will have to fix this one.

mongoose643
12-30-04, 06:22 PM
btw,

If that is the case. My site is toast too, and I'm supposed to get paid soon as well. You also might not want to actually provide your MYSQL connection data because someone could log in to PHP my admin or create a script on their own site and steal and/or corrupt your data. I don't think that it would be any better for your site if that happened because your current users might not exist any more.

cleako
12-30-04, 08:02 PM
Alright.. I'll take it out.. but I have all the data backed up in a text file. Hmm strange that it would do that, maybe if I put my database somewhere else, like on lycos.uk.co or something.. hmm

cleako
12-30-04, 08:03 PM
Yikes.. I can no longer delete that post/edit it

cleako
12-31-04, 10:28 AM
^bump^

Deskdirect
12-31-04, 11:10 AM
This is just one of the many problems my site is experiencing since the php update by Powweb. My images uploading isn't working despite me uploading a now required php.ini and I'm thinking the image using anti-robotic script that I use on my register page is also causing the same issue you're having.

This is the error from my registration page -
The confirmation code you entered was incorrect
Could not connect to the email server

I am at a lost to figure this out.

Annette

mongoose643
12-31-04, 01:07 PM
I spent several hours yesterday trying to fix mine and I finally got everyting to work. Actually, I'm not sure how the script worked in the first place it was missing so much information. I also got it to update insead of delete/insert. Anyway, I'm sorry but I don't think my problem was related to yours. However, you may want to spend a some time pouring over your scripts and database very thouroughly with a copy of PHP/MySQL for DUMMIES beside you. I would look at it for you but I'm running out of time after killing so much of yesterday on my own stuff.

I just looked at a little of your registration script. I have had some problems with the "include()" statement in the past so I suggest trying the "require_once()" statement instead. It works exactly the same way.

Ex.
include("database.php");
require_once("database.php");
require_once "database.php"); also works.

I hope this helps.

in case you're wondering - WhiteMike is my nick name. My actual name is Michael White (I'm not a racist; for some reason ppl think that when they read my sig.)

cleako
1-1-05, 02:49 AM
ahh :) Alright, i'll try that with the require_once("database.php"); The thing is.. this script and all the other php files, they actually DID work before, back in july when they were hosted off of a friend's domain.. he exported all the data from his database it used, and I saved the php files from his site. I've done lots of editing lately, as seen at www.dareborn.com but time and time again, the register.php still doesnt work, despite constantly going back and trying to fix it. I'll see about the book.. but I'm using Dreamweaver to go through all the php nowdays.

cleako
1-1-05, 02:52 AM
Also, I've even tried running that fix.php that updates the sessions problem in php.ini.. it made no effect

cleako
1-1-05, 07:16 PM
^bump^

cleako
1-2-05, 02:27 PM
^bump^ This problem MUST be fixed, because if it isnt, then i need to cancel my hosting with pow web.