I have a account Database for a Android App. In this Database i have the rows "_id, username, password, function, login_counter".
Now i want to auto update the row login_counter after the frist login from this user. The Default value is "0". After the 1st login it must change to "1"
(Reason: This system shall prevent the 2nd user to use the login data from the 1st user', after the 1st Login from User 1 the Data is stored to an local sqlite DB, all other logins ar automatic, no logout is provided)
So how can i do this via php? I think to do this via php is the simplest way to do it. If i'm wrong please tell me the better way to do it (Such as directly from android (java)?) i dont know, tell me pls :)
Currently i have only the db_connect and the add_user php files. Works great from browser :)
Ok i hope you understand what i want. And that you can help me :)
Thank You!
Edit 1 (MyCode)
<?php
// DB Verbingung Aufbauen
include("connect.inc.php");
// Diese Funktion wird verwendet, um einen Benutzer anzulegen.
function add_user($username, $password, $function) {
// Passwort verschlüsseln
$password = md5($password);
//Gegen SQL-Injections schützen
$username = mysql_real_escape_string($username);
// MySQL-Query generieren und ausfuehren
$sql = "INSERT INTO user (username, password, function)
VALUES ('$username' , '$password', '$function')";
if(mysql_query($sql))
echo "Benutzer '$username' erfolgreich angelegt!<br> Daten: <br> Passwort: '$password'<br> Funktion: '$function'";
else
echo "Fehler beim Anelgen des Benutzers '$username'!<br>";
}
//Den Login Counter nach dem ersten Login eines Users Automatisch von 0 auf 1 setzten
function update_login_counter ($login_counter) {
//TODO: Code einfügen fürn Updater
}
//User adden
add_user