Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8196937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:37:54+00:00 2026-06-07T05:37:54+00:00

PHP code is: <?php // Inialize session session_start(); // Include database connection settings include(‘config.inc’);

  • 0

PHP code is:

<?php

// Inialize session
session_start();

// Include database connection settings
include('config.inc');

// Retrieve username and password from database according to user's input
$sql ="SELECT * FROM user WHERE (email = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')";

$login = mysql_query($sql);


// Check username and password match
if (mysql_num_rows($login) == 1) {
    // Set username session variable
    $_SESSION['username'] = $_POST['username'];
    // Jump to secured page
    header('Location: http://localhost/site/client/index.php');
}
else {
    // Jump to login page
    header('Location: http://localhost/site/acces-client/index.php');
}

?>

This works:

The following form can successfully get the user logged and redirected:

<table border="0">
<form method="POST" action="loginproc.php">
<tr><td>Email:</td><td>:</td><td><input type="text" name="username" size="30"></td></tr>
<tr><td>Mot de passe:</td><td>:</td><td><input type="password" name="password" size="30"></td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td><td><input type="submit" value="Envoyer"></td></tr>
</form>
</table>

This does not work:
by “does not work”, I mean there is no redirect. Although the correct URL is called (http://localhost/site/client/index.php).

$.post("http://localhost/site/loginproc.php", {username: email, password: motdepasse})
    .success(function(result3){
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:37:56+00:00Added an answer on June 7, 2026 at 5:37 am

    Following works:

    $.post("http://localhost/site/acces-client/loginproc.php", {username: email, password: motdepasse})
            .success(function(jqXHR, textStatus, errorThrown) {
            window.location = 'http://localhost/site/client/index.php';
        })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

javascript code: $.getJSON(comprueba_login.php, {usuario:$(#usuario).val(), pwd:$(#contrasena).val()}, function(data){ alert(resultado: + data.resultado); }); php code: <?php include
I use PHP code below for login without using database. It redirects to home.php
My PHP Code returns always NO regardless there is a username and password. Flex/MXML
My PHP code: include something.php $mysite = writeContent(); //footer.php ob_start(); echo <script...all my javascript
The PHP code won't delete item from database using $noteid. If I put a
My php code fails to connect to the mysql database on my web server.
I am running following PHP code to interact with a MS Access database. $odbc_con
I am using following PHP code to connect to MS Access database: $odb_conn =
My php code looks like that if (isset($_REQUEST['term'])) { $term = trim(strip_tags($_REQUEST['term']));//retrieve the search
My PHP code is as follow <?php error_reporting(~E_NOTICE); //include('db.php'); if($_GET['fname']) { $fname=$_GET['fname']; //echo $fname.'gytgy';

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.