ok awesome so i am almost done, just one last little problem. The internalKey is not a auto-incrementing key nor can it be since the id column is already. i need to figure out how to increment this to match the id column, or to copy the id key into the internalKey column. i know there is a way to count the rows and turn that into a variable, just not sure how to do it yet.
// add user
if($action=='addUser')
{
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$company = $_POST['company'];
$fullname = $_POST['fullname'];
$email = $_POST['email'];
$city = $_POST['city'];
$state = $_POST['state'];
$phone = $_POST['phone'];
//this needs to be fixed, it has to be the same as the id field of that same row since it is autogenerated.
$internalKey = '***THIS MUST MATCH ID FIELD IN SAME ROW***';
if($password==$password2)
{
$conn = mysql_connect("$dbhost","$dbuser","$dbpass") or die ("Cant connect to Database");
$db = mysql_select_db("$dbname") or die ("database gone.");
$sql = "INSERT INTO `etomite_web_user_attributes` (id, internalKey, company, fullname, email, city, state, phone) VALUES ('NULL', '$internalKey', '$company', '$fullname', '$email', '$city', '$state', '$phone')";
$sql2 = "INSERT INTO `etomite_web_users` (`id`, `username`, `password`) VALUES ('NULL', '$username', '$password')";
$result = mysql_query($sql) or die ("SQL1 Not working try again");
$result2 = mysql_query($sql2) or die ("SQL2 Not working try again");
if($result)
{
header("Location: index.php?id=74");
}
}
}
here are the files as promised, and warning this is a quick hack. I know it could have been done much cleaner and probably will be but i hope this can help out someone else out there.
usrProf.php - main php file
config_inc.php - db config info
addUser.chunk
updateProfile.chunk
chgPasswd.chunk
viewProfile.chunk
TemplateVariables.txt
getUserID.snippet
getLoginName.snippet
there is not much, if any, validation being done. but it does work, well except for the above stated issue. but i am looking for some old code i had that did something like what i need done. maybe someone here can help out, either way it will be done by monday morning for sure!
Thanks,
Todd
http://greymatterhosting.com/downloads/modX2_web_usr_reg.tar.gz