New User Welcome Message

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
Guy71173cp
Posts: 148
Joined: 03 Aug 2010, 16:08
Contact:

New User Welcome Message

Post by Guy71173cp »

Hello.

I don't know if this is SmartFox related, but, is there a way to know if a user is new, and the first time the user logs in, it gives them a welcome message? If possible, I'd like a link to a tutorial, or maybe you could just post what you need for it. Thanks!
reecedogcp78
Posts: 71
Joined: 12 Dec 2010, 18:16

Post by reecedogcp78 »

Well,

Create a mySql Login system and in the database have a column named new with either true or false in, then check the collum via PHP Or a serverside extension when you login Also when the user see's it for the first time use PHP Or extension to set it to false.

I have done this before I reccomend you learn some basic ActionScript 2 or 3 before you continue using SmartFoxServer

Regards.
~Reecedog,

Experienced blogger with 100 thousand hits gathered.

New to SFS But also very good with it :)
Guy71173cp
Posts: 148
Joined: 03 Aug 2010, 16:08
Contact:

Post by Guy71173cp »

Hey, I know you from Twitter! Remember me? I was one of the first Twitter users to make a virtual world ;) Yes, I am an AS2 programmer, I do have lots of knowledge about it. Thanks for your reply. I'm just not good with PHP and databases. :P

Thanks for your reply :D
reecedogcp78
Posts: 71
Joined: 12 Dec 2010, 18:16

Post by reecedogcp78 »

I Dont remember you but im @thereecedogcp ATM Also I dont often give out code but for a login use the code below:

Code: Select all

 <?php 
 // Connects to your Database 
 mysql_connect("YOUR MYSQL HOST", "USERNAME", "PASS") or die('&res=DB'); 
 mysql_select_db("mycpgtk1_blobworld") or die('&res=DB'); 
$name = mysql_real_escape_string($_POST['name']);
$password = mysql_real_escape_string($_POST['password']);
 	$check = mysql_query("SELECT * FROM users WHERE name = '".$name."'")or die('&res=DB');
 
 //Gives error if user dosen't exist
 $check2 = mysql_num_rows($check);
 if ($check2 == 0) {
 		die('&res=CHECK2'.$name);
 				}
 while($info = mysql_fetch_array( $check )) 	
 {
 $_POST['pass'] = stripslashes($_POST['pass']);
 	$info['password'] = stripslashes($info['password']);
 	$_POST['pass'] = md5($_POST['pass']);
 
 //gives error if the password is wrong
 	if ($_POST['pass'] != $info['password']) {
	if($info['type'] == "fbanned" || $info['type'] == "fhide"){
	die('&res=banned');
	}else
	{
 		die('&res=Pass');
		}
 	}
	else 
 {
//check if banned 
 $send = mysql_query("UPDATE users SET ip =  '".$_SERVER["REMOTE_ADDR"]."' WHERE name = '".$name."'");

if($info['type'] != "banned"){
 // if login is ok then we add a cookie 
 	 $_POST['name'] = stripslashes($_POST['name']); 
	 $name = $_POST['name'];             
	 $now = $time = date("F j, Y, g:i:s a");
	   $send = mysql_query("UPDATE users SET lastlogin =  '".$now."' WHERE name = '".$name."'");
$name = ucwords(strtolower($name));  
die("&res=OK&username=".$name);

}else
{
die('&res=banned');
}
 } 
 } 
 ?> 
Thats for logging in via a mySql and you have to create the database and code on the client etc...
~Reecedog,

Experienced blogger with 100 thousand hits gathered.

New to SFS But also very good with it :)
Post Reply