as i am new to this i am trying to do a password recovery but....... as i say i am new
i made anew activity called forgotpwd and a php file caled pwdrecovery.php
my coude for forgotpwd activity is the following
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim txtEmail As EditText
Private btnsendnewpwd As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("frmforgotpwd")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnsendnewpwd_Click
Dim strEmail As String = txtEmail.Text.Trim
If strEmail = "" Then
Msgbox("Please enter Email", "Error")
Return
End If
If Validate_Email(strEmail) = False Then
Msgbox("Email format is incorrect", "Error")
Return
End If
Dim forgotpwd As HttpJob
forgotpwd.Initialize("forgotpwd", Me)
forgotpwd.Download2("
http://www.mydomainname.com/pwdrecovery.php", _
Array As String("Action", "forgotpwd", "Email", txtEmail.Text))
ProgressDialogShow("Connecting to server...")
Msgbox("A mail was sent to your e-mail. Please click on the link to finish registration", "forgotpwd")
Activity.Finish
End Sub
' // Source:
https://www.b4x.com/android/forum/threads/validate-a-correctly-formatted-email-address.39803/
Sub Validate_Email(EmailAddress As String) As Boolean
Dim MatchEmail As Matcher = Regex.Matcher("^(?i)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])$", EmailAddress)
If MatchEmail.Find = True Then
Log(MatchEmail.Match)
Return True
Else
Log("Oops, please double check your email address...")
Return False
End If
End Sub
and the code for php is the following:
<?php
$host = "localhost";
$db = "tmydb";
$user = "myuserdb";
$pw = "test";
$con = mysql_connect($host,$user,$pw) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES 'utf8'");
$action = $_GET["Action"];
switch ($action) {
case "forgotpwd":
$user = mysql_real_escape_string($_GET["UserID"]);
$email = mysql_real_escape_string($_GET["Email"]);
$q = mysql_query("SELECT * FROM tbl_member WHERE Email= '$email'");
$user =$rows['UserID'];
$pass = $rows['pass_word'];
$count = mysql_num_rows($q);
$to = $email;
$subject = 'Your password is';
$message = 'Hi ' . $user . ',' . "\r\n" . 'this is your password is' . $pass ;
$message = wordwrap($message, 70, "\r\n");
$headers = 'From:
[email protected]' . "\r\n" . 'Reply-To:
[email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
}
else
break;
}
break;
default:
echo("Unauthorized action! Please use the app to register.");
}
?>
but the app stops inProgressDialogShow("Connecting to server...")
what i am making wrong???