Jump to content

[SOLVED] Is This Weak?


genics

Recommended Posts

hi folks,

 

I've created a login/session script using a tutorial I dug out of somewhere.

 

Anyway, here's my script:

 

<?php

session_start();

$errorMessage = '';

if (isset($_POST['username']) && isset($_POST['password'])) {

include('dbconnect.php');

 

$username = $_POST['username'];

$password = $_POST['password'];

 

$sql = "SELECT user_id FROM auth_user WHERE user_id = '$username' AND user_password = '$password'";

$result = mysql_query($sql) or die('Query failed. ' . mysql_error());

 

if (mysql_num_rows($result) == 1) {

// Start Session

$_SESSION['logged_in'] = true;

header('Location: index.php');

exit;

} else {

$errorMessage = 'Login Incorrect';

}

include('dbdisconnect.php');

}

?>

 

My table is a simple 2 column table:

 

user_id  |  varchar  | 10 | Primary Key

user_password  |  varchar  | 32

 

 

Is there anyway to make this any more secure? Or is this fine?

 

Link to comment
https://forums.phpfreaks.com/topic/44705-solved-is-this-weak/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.