# login works fine on desktop but stops working on mobile

**URL:** <https://www.phphelp.com/t/login-works-fine-on-desktop-but-stops-working-on-mobile/24301>\
**Category:** General Database (Oracle, SQL Server, etc)\
**Created:** [June 2, 2015, 2:03pm UTC](https://www.phphelp.com/t/login-works-fine-on-desktop-but-stops-working-on-mobile/24301 "2015-06-02T14:03:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [June 2, 2015, 2:03pm UTC](https://www.phphelp.com/t/login-works-fine-on-desktop-but-stops-working-on-mobile/24301/1 "2015-06-02T14:03:04Z")

</div>

on desktop you can sign in and it will take you to your account details with everything listed correctly. on mobile it will say you logged in successfully but it’ll take you to the account page as if it were a welcome guest page. it worked on mobile when i uploaded it then suddenly stopped working.

login

[embed=425,349]\<?php  
include(“includes/db.php”);

?\>

```
<div>

<form class="form-signin" method="post" action="">

<h4 class="form-signin-heading">Login</h4>

<input type="text" name="email" class="form-control" placeholder="Email address" required>
<div class="checkbox"> </div>

<input type="password" name="pass" class="form-control" placeholder="Password" required>
<div class="checkbox"> </div>
<button class="btn btn-lg btn-primary btn-block" type="submit" name="login" value="Login">Sign in</button>
<br><p class="text-center"><a href="checkout.php?forgot_pass" class="forgotlink">Forgot Password?</a></p>

</form>
<br><p class="text-right"><a href="customer_register.php" class="forgotlink">New? Register!</a></p>

<?php 
if(isset($_POST['login'])){

$c_email = $_POST['email'];
$c_pass = $_POST['pass'];

$sel_c = "select * from customers where customer_pass='$c_pass' AND customer_email='$c_email'";

$run_c = mysqli_query($con, $sel_c);

$check_customer = mysqli_num_rows($run_c); 

if($check_customer==0){

echo "<script>alert('Password or email is incorrect')</script>";
exit();
}
$ip = getIp(); 

$sel_cart = "select * from cart where ip_add='$ip'";

$run_cart = mysqli_query($con, $sel_cart); 

$check_cart = mysqli_num_rows($run_cart); 

if($check_customer>0 AND $check_cart==0){

$_SESSION['customer_email']=$c_email; 

echo "<script>alert('You logged in successfully')</script>";
echo "<script>window.open('customer/my_account.php','_self')</script>";

}
else {
$_SESSION['customer_email']=$c_email; 

echo "<script>alert('You logged in successfully')</script>";
echo "<script>window.open('checkout.php','_self')</script>";

        }
}

?>

</div> [/embed]

```

account details

[embed=425,349]\<?php  
session\_start();  
include(“functions/functions.php”);

?\>

Deals

\<?php include("../includes/header.html"); ?\>
\<?php cart(); ?\>

#### My Account

My OrdersEdit AccountChange PasswordDelete Account

 \<?php if(isset($\_SESSION['customer\_email'])){ echo $\_SESSION['customer\_email']; } else { echo "

**Welcome Guest:**

"; } ?\>
 \<?php $user = $\_SESSION['customer\_email'];

```
        $get_img = "select * from customers where customer_email='$user'";

        $run_img = mysqli_query($con, $get_img); 

        $row_img = mysqli_fetch_array($run_img); 

        $c_image = $row_img['customer_image'];

        $c_name = $row_img['customer_name'];

        echo "<div><br><img src='customer_images/$c_image' class='img-circle img-responsive center-block'></div>";

        ?>

        <?php 
        if(!isset($_SESSION['customer_email'])){

        echo "<a href='../checkout.php' class='forgotlink'>Login</a>";

        }
        else {
        echo "<p><br><a href='../logout.php' class='btn btn-lg btn-danger btn-block' role='button'>Logout</a></p>";
        }

        ?>

        </div>

        <div class="well">
            <h4>My Account</h4>
            <p>Here you're able to view your orders, Edit your account, Change your Password, and sadly Delete your Account.</p>
        </div>
    </div>

    <div class="col-md-8">
        <div class="well">

            <?php 
        if(!isset($_GET['my_orders'])){
            if(!isset($_GET['edit_account'])){
                if(!isset($_GET['change_pass'])){
                    if(!isset($_GET['delete_account'])){

        echo "
        <h2 style='padding:20px;'><i class='glyphicon glyphicon-user'></i> Welcome $c_name </h2>  
        <b>You can see your orders progress by clicking this <a href='my_account.php?my_orders' class='forgotlink'>link</a></b>";
        }
        }
        }
        }
        ?>

        <?php 
        if(isset($_GET['edit_account'])){
        include("edit_account.php");
        }
        if(isset($_GET['change_pass'])){
        include("change_pass.php");
        }
        if(isset($_GET['delete_account'])){
        include("delete_account.php");
        }

        ?>

```

* * *

Copyright © Deals

[/embed]

---

<div class="post-metadata">

**Author:** ![grwebugy](https://www.phphelp.com/user_avatar/www.phphelp.com/grwebugy/32/1076_2.png) [@grwebugy](https://www.phphelp.com/u/grwebugy)\
**Post date:** [June 7, 2015, 9:02pm UTC](https://www.phphelp.com/t/login-works-fine-on-desktop-but-stops-working-on-mobile/24301/2 "2015-06-07T21:02:36Z")

</div>

As a start, you might want to replace this js redirect with a php redirect.

[php] echo “”;[/php]

header(‘Location: [http://www.example.com/](http://www.example.com/)’);

More Info: [http://php.net/manual/en/function.header.php](http://php.net/manual/en/function.header.php)
