>
>
> IDE: Eclipse
> Windows OS:8.1
> Simulator Android/iOS
> Device Android/iOS
>
> I am trying to validate user credential from my app login page within
codename1 by accessing a web sever php code that validates the user login
credential against a database on the web server.
i have little idea about the connection form my codename1 app to the php
web server script can anyone provide a little clarity please. i need to
help with understanding the
Connection request and connecting to the php script that performs the
validation and return the result to m app.
here is a copy of my php script
<?php
session_start();
if($_POST)
{
$username=$_POST['Name'];
$password=$_POST['pass'];
//Pull file into program to retrieve username,password,database name and
server name
$file1=file(path to text file);
//use to stor values from topsecret file into varibles
$dbserver=trim($file1[0]);
$uid=trim($file1[1] );
$pw=trim($file1[2]);
$dbname=trim($file1[3]);
//connect to database with varibles
$link=mysqli_connect($dbserver, $uid, $pw, $dbname)
or die('could not connect:'. mysqli_error($link));
//sql query to display data that matches price range and product
$query = 'Select * from users where username LIKE"%' . $username
. '"
and password LIKE "%'. $password .'%"';
$query = mysqli_query($link, $query) or die('query failed'.
mysqli_error($link));
$num=(mysqli_num_rows($query));
//if user values doesnt matches any value in the database javascript is
executed and infrom user that no product fits thier values
if($num <1){
echo '<script language="javascript">';
echo 'alert("Login Credentials invalid")';
echo '</script>';
echo '<script type="text/javascript">
window.location = "http://zenit.senecac.on.ca:port#/lab5/login.php"
</script>';
}
if($num >0)
{
$_SESSION['user']=$username;
header("Location:
http://zenit.senecac.on.ca:17362/cgi-bin/lab5/protectedstuff.php");
}
}
?>
<html>
<title>Login Page</title>
</head>
<body>
<h1>Login Information</h1>
<form method="POST" action"facebook.com">
<tr>
<td> Username:</td>
<td><input name="Name" type="text" value=""></td> <td> <?php echo $erone;
?></td>
</tr>
<br><br>
<tr>
<td>Password:</td>
<td><input name="pass" type="password" value=""></td><td> <?php echo
$ertwo; ?></td>
</tr>
<tr><td><br></td></tr>
<tr>
<td></td>
<td><input name="submit" type="submit"></td>
</tr>
</form>
</body>
</html>
>
>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/5634d901-1cba-44f9-9f32-6659eacb618d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.