PDA

View Full Version : Problems in user.php


Dean C
08-03-2002, 07:28 PM
Whenever i try to edit a user in the admin cp ... i click save changed and get this error:


There is already an [user] named Mist


obviously the username changes wen u edit a different user...

i installed the awards hack.. cudn't get it to work... so i uninstalled it and got a funny error..

i re-uploaded the original user.php...

and i got this error...

i thought i might be because i had installed the contributor label hack but hadn't applied the changes to user.php

so i did that and i still get the same error :(...

hopefully some1 can help me out :D

Thanks in Advance

- Mist

Xenon
08-03-2002, 10:56 PM
you must have this block in your user.php: if ($exists=$DB_site->query_first("SELECT userid
FROM user
WHERE username='".addslashes(htmlspecialchars($ausername))."'
AND userid <> $userid")) {
echo "There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
exit;
}

if it doesn't exist in this form you don't have uploaded an original file.

as you can see the block is just executed if there is another user called "....".
so if you have this block correct, and and get this error when editing a user, you perhaps have a problem in your database.

Dean C
08-04-2002, 01:47 PM
that code is already there... and its exactly the same as the code u gave me above... :(

and also i did upload the original and that didn't fix it... i have a feeling it has something to do with these querys i ran:

if u can give me thr query to reverse each one id give that a try:

Query1:

CREATE TABLE award (
awardsid smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
name varchar(60) NOT NULL,
url varchar(100) NOT NULL,
aw smallint(4) NOT NULL,
PRIMARY KEY (awardsid)
);


Query2:

CREATE TABLE useraward (
id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
awardsid smallint(5) NOT NULL,
userid smallint(5) NOT NULL,
name varchar(60) NOT NULL,
url varchar(100) NOT NULL,
aw smallint(4) NOT NULL,
PRIMARY KEY (id)
);


Quer3:

ALTER TABLE user ADD award TINYTEXT NOT NULL


Thanks in Advance :D

- Mist

Xenon
08-04-2002, 02:01 PM
i'd say you should use phpmyadmin to delete the extra tables and the extrafield to user-table...

the queries should be:
DROP TABLE `award`
DROP TABLE `useraward`
ALTER TABLE `user` DROP `award`

then check your usertable if you have more users called Mist... ;)

Dean C
08-04-2002, 08:29 PM
i ran those queries with success...

and you were right... the problem was more than one user in the user table called "Mist" hehe.. dont know how it happened :S

Thanks for your help Xenon :D

Xenon
08-04-2002, 08:35 PM
:)
you're welcome

i hope everything is right now

Dean C
08-05-2002, 09:43 AM
it is :D