Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db_name = "voyageurdb";
- $mysql_user = "root";
- $mysql_pass = "";
- $server_name = "localhost";
- $con = mysqli_connect($server_name ,$mysql_user ,$mysql_pass ,$db_name);
- if(!$con){
- echo "Connection error..".mysqli_connect_error();
- }else{
- echo "<h3>Database connection success...</h3>";
- }
- ?>
- <?php
- require"voyageur_init.php";
- $Email = $_POST["txt_email"];
- $Password = $_POST["txt_password"];
- $sql_query = "Select name from user_info where user_name like '$Email' and user_pass like '$Password';";
- $result = mysqli_query($con, $sql_query);
- if(mysqli_num_rows($result) > 0) {
- $row = mysqli_fetch_assoc($result);
- $First_name = $row["txt_firstname"];
- echo"Login Success...Welcome".$First_name;
- }else {
- echo"Login Faild...Try Again...";
- }
- ?>
- <?php
- require "voyageur_init.php";
- $First_name = $_POST["txt_firstname"];
- $Last_name = $_POST["txt_lastname"];
- $Email = $_POST["txt_email"];
- $Phone_no = $_POST["txt_phone"];
- $Password = $_POST["txt_password"];
- $sql_query = "insert into user_info values('$First_name ','$Last_name','$Email','$Phone_no','$Password');";
- if(mysqli_query($con, $sql_query)) {
- //echo"<h3>Data Insertion Success...</h3>";
- }else {
- //echo"Data Insertion Error...".mysqli_error($con);
- }
- ?>
- protected String doInBackground(String... params) {
- String reg_url = "asanka1055.byethost6.com/voyageur_register.php";
- String login_url = "asanka1055.byethost6.com/voyageur_login.php";
- String method = params[0];
- if(method.equals("Register")) {
- String firstname = params[1];
- String lastname = params[2];
- String email = params[3];
- String phone = params[4];
- String password = params[5];
- try {
- URL url = new URL(reg_url);
- HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
- httpURLConnection.setRequestMethod("POST");
- httpURLConnection.setDoOutput(true);
- OutputStream os = httpURLConnection.getOutputStream();
- BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
- String data = URLEncoder.encode("firstname", "UTF-8") + "=" + URLEncoder.encode(firstname, "UTF-8") + " & " + URLEncoder.encode("lastname", "UTF-8") + "=" + URLEncoder.encode(lastname, "UTF-8") + " & " +
- URLEncoder.encode("email", "UTF-8") + "=" + URLEncoder.encode(email, "UTF-8") + " & " + URLEncoder.encode("phone", "UTF-8") + "=" + URLEncoder.encode(phone, "UTF-8") + " & " + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8");
- bufferedWriter.write(data);
- bufferedWriter.flush();
- bufferedWriter.close();
- os.close();
- InputStream is = httpURLConnection.getInputStream();
- is.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement