dt_gry Posted October 7, 2008 Share Posted October 7, 2008 ??? ??? ??? ??? ??? ??? ??? Hi guys, Maybe someone can help me because I am totally confused. What is a T_IF error, and it says that its on line 37 but I just don't see the problem. Any help would be greatly appreciated. Here is My Code! <?php $database_connect = mysql_connect("mysql.thegayestwebsiteever.com","thegayestever","emit098nice054"); if (!$database_connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db("usrmgmt", $database_connect); $entryUsername = username; $sql = "SELECT * FROM user_info WHERE username = '$entryUsername'"; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result)) { die("That UserName already exists in our system! Please enter another username"); } Else { $sql="INSERT INTO user_info(first_name, last_name, billing_address, line_2, city, state_province, zip_postal_code, country, card_type, cc_num, cvv2, exp_month, exp_year, email_address, phone, username, password) VALUES ('$_POST[first_name]', '$_POST[last_name]', '$_POST[billing_address]', '$_POST[line_2]', '$_POST[city]', '$_POST[state_province]', '$_POST[zip_postal_code]', '$_POST[country]', '$_POST[card_type]', '$_POST[cc_num]', '$_POST[cvv2]', '$_POST[exp_month]', '$_POST[exp_year]', '$_POST[email_address]', '$_POST[phone]', '$_POST[username]', '$_POST[password]')"; } if (!mysql_query($sql,$database_connect)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($database_connect); if (!mysql_query($sql,$db_con_usrmgmt)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($database_connect); $db_ if (!database_connect) { die('Could not connect: ' . mysql_error()); } Else mysql_select_db("login_script", $db_con_login_script); { $sql="INSERT INTO login_script(First_name, Last_name, User_name, Password) VALUES ('$_POST[First_name]', '$_POST[Last_name]', '$_POST[username]', '".md5($_POST['Password'])."')"; } if (!mysql_query($sql,$db_con_login_script)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($db_con_login_script); ?> Thanks Guys, dt_gry. Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/ Share on other sites More sharing options...
genericnumber1 Posted October 7, 2008 Share Posted October 7, 2008 if you can't find an error on the line, work your way up until you find it.. in this case it's just one line up $db_ isn't valid.. can't tell you how to fix it since I have no idea what you meant for it to be . Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-658693 Share on other sites More sharing options...
kenrbnsn Posted October 7, 2008 Share Posted October 7, 2008 On line 36, you have <?php $db_ ?> which really doesn't seem to belong. Ken Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-658694 Share on other sites More sharing options...
R0bb0b Posted October 7, 2008 Share Posted October 7, 2008 couple lines down too: <?php Else mysql_select_db("login_script", $db_con_login_script); { $sql="INSERT INTO login_script(First_name, Last_name, User_name, Password) VALUES ('$_POST[First_name]', '$_POST[Last_name]', '$_POST[username]', '".md5($_POST['Password'])."')"; } ?> I don't know what you are trying to do here. Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-658699 Share on other sites More sharing options...
dt_gry Posted October 7, 2008 Author Share Posted October 7, 2008 I am copying those fields from the form to the database and encrypting the password to md5. Okay I fixed that error now I am getting "Unexpected T_Variable on line 42. I know usually this means that you have forgotten to put a ; at the end of a statement but I have one at the end of that line and have looked and don't see where I am missing one. Here is the code <?php $database_connect = mysql_connect("mysql.thegayestwebsiteever.com","thegayestever","emit098nice054"); if (!$database_connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db("usrmgmt", $database_connect); $entryUsername = username; $sql = "SELECT * FROM user_info WHERE username = '$entryUsername'"; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result)) { die("That UserName already exists in our system! Please enter another username"); } Else { $sql="INSERT INTO user_info(first_name, last_name, billing_address, line_2, city, state_province, zip_postal_code, country, card_type, cc_num, cvv2, exp_month, exp_year, email_address, phone, username, password) VALUES ('$_POST[first_name]', '$_POST[last_name]', '$_POST[billing_address]', '$_POST[line_2]', '$_POST[city]', '$_POST[state_province]', '$_POST[zip_postal_code]', '$_POST[country]', '$_POST[card_type]', '$_POST[cc_num]', '$_POST[cvv2]', '$_POST[exp_month]', '$_POST[exp_year]', '$_POST[email_address]', '$_POST[phone]', '$_POST[username]', '$_POST[password]')"; } if (!mysql_query($sql,$database_connect)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($database_connect); if (!mysql_query($sql,$db_con_usrmgmt)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($database_connect); $db_con_login_script = mysql_connect("mysql.thegayestwebsiteever.com","thegayestever","emit098nice054); if (!database_connect) { die('Could not connect: ' . mysql_error()); } Else mysql_select_db("login_script", $db_con_login_script); { $sql="INSERT INTO login_script(First_name, Last_name, User_name, Password) VALUES ('$_POST[First_name]', '$_POST[Last_name]', '$_POST[username]', '".md5($_POST['Password'])."')"; } if (!mysql_query($sql,$db_con_login_script)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($db_con_login_script); ?> Thanks for the help guys dt_gry Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-658706 Share on other sites More sharing options...
kenrbnsn Posted October 7, 2008 Share Posted October 7, 2008 Get yourself an editor that highlights lines and quote. It will be a big help. You are missing a quote in this line <?php $db_con_login_script = mysql_connect("mysql.thegayestwebsiteever.com","thegayestever","emit098nice054); ?> Also, this set of lines doesn't make any sense: <?php if (!database_connect) { die('Could not connect: ' . mysql_error()); } Else mysql_select_db("login_script", $db_con_login_script); { $sql="INSERT INTO login_script(First_name, Last_name, User_name, Password) VALUES ('$_POST[First_name]', '$_POST[Last_name]', '$_POST[username]', '".md5($_POST['Password'])."')"; } ?> Since you have a single line following the "else" and then lines within "{ }" Ken Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-658707 Share on other sites More sharing options...
dt_gry Posted October 7, 2008 Author Share Posted October 7, 2008 Okay I have fixed all the issues mentioned above and the code should now make sense. Here is a link to what I have been working on. http://www.phpfreaks.com/forums/index.php/topic,214895.0.html Now I have yet another problem, when the code is processed and it connects to login_script and table members it only inserts the passwd and not the firstname lastname and user. There is an auto-incremented integer in field one but I have never had a problem with it not being designated before. Here is the new code <?php $database_connect = mysql_connect("mysql.thegayestwebsiteever.com","thegayestever","emit098nice054"); if (!$database_connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db("usrmgmt", $database_connect); $entryUsername = username; $sql = "SELECT * FROM user_info WHERE username = '$entryUsername'"; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result)) { die("That UserName already exists in our system! Please enter another username"); } Else { $sql="INSERT INTO user_info(first_name, last_name, billing_address, line_2, city, state_province, zip_postal_code, country, card_type, cc_num, cvv2, exp_month, exp_year, email_address, phone, username, password) VALUES ('$_POST[first_name]', '$_POST[last_name]', '$_POST[billing_address]', '$_POST[line_2]', '$_POST[city]', '$_POST[state_province]', '$_POST[zip_postal_code]', '$_POST[country]', '$_POST[card_type]', '$_POST[cc_num]', '$_POST[cvv2]', '$_POST[exp_month]', '$_POST[exp_year]', '$_POST[email_address]', '$_POST[phone]', '$_POST[username]', '$_POST[password]')"; } if (!mysql_query($sql,$database_connect)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($database_connect); $db_con_login_script = mysql_connect("mysql.thegayestwebsiteever.com","thegayestever","emit098nice054"); if (!database_connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db("login_script", $db_con_login_script); $sql="INSERT INTO members(firstname, lastname, login, passwd) VALUES ('$_POST[First_name]', '$_POST[Last_name]', '$_POST[username]', '".md5($_POST['Password'])."')"; if (!mysql_query($sql,$db_con_login_script)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($db_con_login_script); ?> Thanks guys, dt_gry Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-659013 Share on other sites More sharing options...
Brian W Posted October 7, 2008 Share Posted October 7, 2008 Comment: Consider using SHA1 over md5, it is a better hasher. If you have the choice, you might as well go with the SHA1. Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-659058 Share on other sites More sharing options...
genericnumber1 Posted October 7, 2008 Share Posted October 7, 2008 Comment: Consider using SHA1 over md5, it is a better hasher. If you have the choice, you might as well go with the SHA1. Lies, you will not put down the MD5! To be honest it doesn't matter, salt your hashes and use whatever you want, the difference isn't really that great. Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-659068 Share on other sites More sharing options...
Brian W Posted October 7, 2008 Share Posted October 7, 2008 Lol, just from reading I found several sources stating that is is better. For one, it took at least twice as long to find collisions with SHA1. But yes, if you Salt with like 16 characters of randomness, you should be doing pretty well even with md5. We are talking about milliseconds per character, so just might as well make it the data to be hashed huge with the salt. Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-659100 Share on other sites More sharing options...
dt_gry Posted October 7, 2008 Author Share Posted October 7, 2008 Thanks for the suggestions guys, however I still need to figure out why the only thing that is copying the DB login_script TBL members is the passwd field. The rest is not copying at all. Thanks for the help guys. dt_gry Quote Link to comment https://forums.phpfreaks.com/topic/127332-unexpected-t_if-error-on-line-37/#findComment-659170 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.