Jump to content

[SOLVED] Making a field Case sensitive?


darknessmdk

Recommended Posts

Ummm....php is case sensitive.

 

<?php
$user = "MyName";
$input = "myname";

if ($input == $user) {
   echo 'Hello';
}else {
   echo 'Bad';
}

$input = "MyName";

if ($input == $user) {
   echo 'Hello';
}else {
   echo 'Bad';
}
?>

 

Should echo "BadHello"

Link to comment
Share on other sites

When I login to my site, I can use upper case or lower case and it accepts it. Maybe the mysql isnt case sensitive??

 

heres my code:

 

<?
session_start();
if(isset($_SESSION['uusername']) && isset($_SESSION['upassword'])) {
$uusername = $_SESSION['uusername'];
$upassword = $_SESSION['upassword'];
} elseif (isset($_POST['uusername']) &&isset($_POST['upassword'])) {
$uusername = $_POST['uusername'];
$upassword = $_POST['upassword'];
} else {
//print("Username/Password not defined");
include("index.php");
exit();
}
?>



<?
include("database.php");
$result = mysql_query("SELECT * FROM uregister WHERE uusername = '$uusername' AND upassword = '$upassword'");

$countrows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($countrows >= 1) {
$_SESSION['uusername'] = $uusername;
$_SESSION['upassword'] = $upassword;
$_SESSION['uid'] = $row['uid'];
$_SESSION['names'] =$row['uusername'];
$_SESSION['accounts'] = 'user';
$_SESSION['ids'] = $row['uid'];

$ulastlogin = date("m/d/Y");

$uid = $_SESSION['uid'];

$result = mysql_query("UPDATE uregister SET ulastlogin = '$ulastlogin' WHERE uid = $uid");





$_SESSION['ufirstname'] = $row['ufirstname'];
include("uloginok.php");
exit();
} else {
//print "Sorry, check your username/password.";
include("index.php");
exit();
}
mysql_close($linkID);

?>

Link to comment
Share on other sites

$result = mysql_query("SELECT * FROM uregister WHERE uusername = '$uusername' AND upassword = '$upassword'");

$countrows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($countrows > 0 && $row['uusername'] != $uusername) {
      //print "Sorry, check your username/password.";
      include("index.php");
      exit();
}

 

PHP is case sensitive, mysql is case insensitive.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.