VitalEnd Posted June 30, 2010 Share Posted June 30, 2010 Hi, sorry if this is posted but i cannot find it anywhere, it may be cimple for whoever is reading this but i have just recently started working with mccodes and i am looking for a function to go in the register page which will automatically send the user an email when they first login which will welcome them to the game and give them a few tips. Secondly when changing a username in preferences it seems 2 people can have the same name. I would like to know how to fix this so it displays: "This username has already been taken". Something like that, any help would be much appreciated, thank you. Quote Link to comment Share on other sites More sharing options...
Analog Posted June 30, 2010 Share Posted June 30, 2010 For MC v2, welcome mail $time = time(); $db->query("INSERT INTO mail VALUES ('',0,0,$i,$time,'mail subject here','mail text here')"); $db->query("UPDATE users SET new_mail=new_mail+1 WHERE userid=$i"); Add this after the insert query that adds the players information... Now, I'm not sure if this is what you need. As you have not stated which version of MC you are working with. Quote Link to comment Share on other sites More sharing options...
iSOS Posted June 30, 2010 Share Posted June 30, 2010 Add this in the name change function in preferences. $nCheck = mysql_query("SELECT `userid` FROM `users` WHERE (`username`= '".mysql_real_escape_string(strip_tags($_POST['ENTERVALUEHERE']))."')"); if(mysql_num_rows($nCheck)) { echo ('This username has been taken, please try again. <a href = "preferences.php">Go Back</a>'); exit($h->endpage()); } Hasn't been tested, just wrote it here, make sure to change the "$_POST['ENTERVALUEHERE']" in the query to the actual value as I don't have mccodes. Quote Link to comment Share on other sites More sharing options...
VitalEnd Posted June 30, 2010 Author Share Posted June 30, 2010 awesome Wasn't expecting such a quick response and coding posted up aswell, thanks alot guys :) Quote Link to comment 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.