• Log in or sign up for an account here: https://www.sythe.org/login

Can people make mass accs in apps?

Joined
Aug 21, 2009
Sythe Gold
0
Messages
14,450
Location
Canada
Most email sites have users enter a code to prove that they are human. Is it necessary to implement this into phone apps? Is it even possible for someone to create mass accs on a mobile phone with the use of a bot?
 
Two Factor Authentication User
SytheSteamer
St. Patrick's Day 2014
Sythe's 10th Anniversary
Tier 1 Prizebox
That depends on the app and the issuer.
 
That depends on the app and the issuer.


Say I am creating a simple app that has a uitextfield for a email and a password (to create a login). What should I implement to avoid spam account creation?
 
Gohan has AIDS
Sythe's 10th Anniversary
Definitely just have a link to auto authenticate the account. Will be pretty easy with php. Is your database MYSQL?
 
If you're storing the login info online then I'd make a link. If the login is local to each phone I'd generate a random number and email it.
 
Definitely just have a link to auto authenticate the account. Will be pretty easy with php. Is your database MYSQL?

Yes it is mysql. How would I have the app send them an email with a verification link? :S
 
Gohan has AIDS
Sythe's 10th Anniversary
First step;

check the user has an internet connection either wifi or network. (otherwise your app with crash)

Use a reliable host such as microsoft who're a little more worldwide friendly than google etc..

snippet
Code:
-(BOOL)isNetworkAvailable {

char *hostname;
struct hostent *hostinfo;
hostname = "microsoft.com";
hostinfo = gethostbyname (hostname);
if (hostinfo == NULL) {
    return NO;
} else {
    return YES;
}
}

Second Step

make the app POST information to your php script

Username, email, whatever else and some sort of security key

I used an NSMutableURLRequest to post mine in an app, it's quite simple. Then just log the response for either a success or an error.

Third Step

Create your .php file and have it error handle the $_POST, Then use PDO to connect to your database and insert the information, then provide an echo for your success/error message that will be logged in your app.

I also wouldn't recommend using mysql queries, as they're outdated and probably won't continue to be supported. They're also very prone to injections and flooring your database. Make sure you use PDO, it's not hard to learn and the best way to learn.

A simple bindValue into your query will save a lot of headache in the future.

EDIT: Also, to send the email.. You will just use the $_POST information to send a simple email from your server. This will be the easy part.
 
First step;

check the user has an internet connection either wifi or network. (otherwise your app with crash)

Use a reliable host such as microsoft who're a little more worldwide friendly than google etc..

snippet
Code:
-(BOOL)isNetworkAvailable {

char *hostname;
struct hostent *hostinfo;
hostname = "microsoft.com";
hostinfo = gethostbyname (hostname);
if (hostinfo == NULL) {
    return NO;
} else {
    return YES;
}
}

Second Step

make the app POST information to your php script

Username, email, whatever else and some sort of security key

I used an NSMutableURLRequest to post mine in an app, it's quite simple. Then just log the response for either a success or an error.

Third Step

Create your .php file and have it error handle the $_POST, Then use PDO to connect to your database and insert the information, then provide an echo for your success/error message that will be logged in your app.

I also wouldn't recommend using mysql queries, as they're outdated and probably won't continue to be supported. They're also very prone to injections and flooring your database. Make sure you use PDO, it's not hard to learn and the best way to learn.

A simple bindValue into your query will save a lot of headache in the future.

EDIT: Also, to send the email.. You will just use the $_POST information to send a simple email from your server. This will be the easy part.



Thank you SmokeHut. I guess I will have to learn php :P Also about your way of checking for internet. Is there something wrong with using the following?




Code:
// Following 3 lines in viewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkEstablished:) name:kReachabilityChangedNotification object:nil];
reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];

- (BOOL)networkEstablished:(NSNotification *)notification
{
        NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus];
        if(remoteHostStatus == NotReachable) { return false };

        return true;
}




To check for specific connection types you can also do stuff like:


Code:
if(remoteHostStatus == ReachableViaWiFiNetwork)
        NSLog(@"Wifi connection established");

if(remoteHostStatus == ReachableViaCarrierDataNetwork)
        NSLog(@"Carrier Data connection established");



Is this technique outdated? I found it awhile back on stack overflow.
 
Gohan has AIDS
Sythe's 10th Anniversary
Nothing seems wrong with the code you've suggested to me ( I haven't tried it though ).

I used the version I supplied as it was literally just checking for a connection to retrieve/give a very small amount of data. Where as your version might be more suitable for when a file or data needs to be downloaded exceeding what would be considered a small amount of data.

For the php it's really simple, and much easier than objective-c.

Just make sure to make it as secure as possible, as you don't want all your data being leaked/wiped.

Here's a quick one I've knocked up for you.

Code:
<?php
$user = '***';
$pass = '***';
$db_loc = '***';
$db_name '***';
$db = new PDO('mysql:host=$db_loc;dbname=$db_name', $user, $pass);

if (isset($_POST['submit']))
{
	if ($_POST['security'] == '****')
	{
		if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['email']) && isset($_POST['age']) && isset($_POST['location']) && isset($_POST['extra']) && isset($_POST['extra2']) && isset($_POST['extra3']))
		{
			$query = "INSERT INTO tableTitle(
				username,password,email,age,location,extra,extra2,extra3) VALUES (
				?,?,?,?,?,?,?,?)";

			$stmt = $db->prepare($query);
			$stmt->bindValue(1, $_POST['username']);
			$stmt->bindValue(2, $_POST['password']);
			$stmt->bindValue(3, $_POST['email']);
			$stmt->bindValue(4, $_POST['age']);
			$stmt->bindValue(5, $_POST['location']);
			$stmt->bindValue(6, $_POST['extra']);
			$stmt->bindValue(7, $_POST['extra2']);
			$stmt->bindValue(8, $_POST['extra3']);
			$worked = $stmt->execute();

			if ($worked == true) 
			{
				echo 'Submission Successful';
			} else {
				echo 'Database Connection Issue';
			}
		}
		else
		{
			echo 'Not all components are complete, unable to submit request.';
		}
	} 
	else 
	{
		echo 'Security Code Invalid.';
	}
}

?>

That gives you a good starting grid of at least what to look at. If you need any help retrieving data safely just give me a PM. Also, you may want to look at encrypting the password. I'd suggest using the "blowfish" method of doing so.
 
I think it is impossible,it always requires to enter a code to prove that they are human
 
duelarena.gg
Back
Top