as for the credentials: i think i can check them with a script:
As you see, this form authenticates the user through check_user-pass.php. Well - It should look for those credentials on my database; if they exist, returns OK, else returns value NO.
So my question is: exactly what code should I include in check_user-pass.php?
I tried to add more code but couldn't do that as well! My current code is:
note: The name in you form is user_name but in your script you look for username
$username=$_POST['username'];
should be
$username=$_POST['user_name'];
EDIT:
If you use crypt to encrypt your password before you put them in the database, try this
$sql="SELECT * FROM $tbl_name WHERE username='$username'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
$row = mysql_fetch_assoc($result);
if (crypt($password, $row['password']) == $row['password']){
session_register("username");
session_register("password");
echo "Login Successful";
return true;
}
else {
echo "Wrong Username or Password";
return false;
}
}
else{
echo "Wrong Username or Password";
return false;
}
EDIT: myBB seems to use a crapload of md5 hashing for their passwords, try this
$sql="SELECT * FROM $tbl_name WHERE username='$username'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
$row = mysql_fetch_assoc($result);
if (md5(md5($row['salt']).md5($password)) == $row['password']){
session_register("username");
session_register("password");
echo "Login Successful";
return true;
}
else {
echo "Wrong Username or Password";
return false;
}
}
else{
echo "Wrong Username or Password";
return false;
}
ideas and questions
well i just want to verify a set of user-credentials:
- no encryption - what i want to do is just a check of a given set of credentials
- this is what i want to do and everything should be fine.
as for the credentials: i think i can check them with a script:
As you see, this form authenticates the user through check_user-pass.php.
_Idea:_ It looks for those credentials on my database; if they exist, returns OK, else returns value NO.
So my question is: exactly what code should I include in check_user-pass.php?
regards
update:
i can do this with a spimple test the connection script too:
error in establishing db bei dem Versuch ein Script zu installieren.
- mit einem Testconnection-Script versucht das weiterzuverfolgen:
<?php
if(function_exists('mysqli_connect')){if(!($link = mysqli_connect('localhost','username','password','my_db'))){die('could not connect: '. mysqli_error($link));}}else{die("don't have mysqli");}
echo 'connect successfully';
mysqli_close($link);
Samsung Galaxy Watch8 is now selling at its lowest price ever by Fiza Ali
Amazon is now offering Samsung Galaxy Watch8 at its lowest price yet with a 34% discount (purchase link down below). The Galaxy Watch8 is equipped with a 1.5-inch Super AMOLED display with a resolution of 480x480 pixels and support for 16 million colours.
The watch is powered by a penta-core processor with clock speeds of up to 1.6GHz, runs Wear OS, and includes 2GB of RAM and 32GB of internal storage. For connectivity, the watch supports Bluetooth 5.3, Wi-Fi 802.11a/b/g/n on both 2.4GHz and 5GHz bands, and NFC. Furthermore, supported Bluetooth profiles include A2DP, AVRCP, HFP, and HSP. Location services are provided through GPS, GLONASS, BeiDou, and Galileo satellite systems.
Moreover, the Galaxy Watch8 includes a range of sensors as well, including an accelerometer, barometer, bioelectrical impedance analysis (BIA) sensor, electrical heart sensor (ECG), optical heart rate sensor, gyroscope, geomagnetic sensor, infrared temperature sensor, and ambient light sensor.
For media playback, the watch supports MP3, M4A, 3GA, AAC, OGG, OGA, WAV, AMR, and AWB audio formats. In terms of water resistance, it has a 5 ATM rating, which should make it suitable for swimming and everyday exposure to water. Finally, the device is powered by a 435mAh lithium-ion battery, and when it comes to its performance, Samsung rates the battery for up to 40 hours of use with the Always-On Display turned off.
Samsung Galaxy Watch 8 (2025) 44mm Smartwatch: $249.99 (Amazon US) - 34% off
Good to know
This Amazon deal is U.S. specific, and not available in other regions unless specified.
We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only.
Check out Today's Deals on Amazon | or our recent tech deals.
Become a Prime member (for Students or SNAP) via Neowin
Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP)
Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin
As an Amazon Associate, we earn from qualifying purchases.
Recent Achievements
Huge Trailer earned a badge Week One Done
Classifyskilleducation earned a badge Week One Done
Question
tarifa
good dayx dear experts hello to everyone,
i have a php-scritp that does not log to the mysql-db. it throws errors all the time:
i am not sure what goes on - if
my guesses
- i use wrong credentials:
- Socket-Problems - i.e. with the sockets cf https://stackoverflow.com/questions/1435445/error-on-creating-connection-to-pdo-in-php
vgl pdo_mysql.default_socket=/opt/lampp/var/mysql/mysql.sock
as for the credentials: i think i can check them with a script:
As you see, this form authenticates the user through check_user-pass.php. Well - It should look for those credentials on my database; if they exist, returns OK, else returns value NO.
So my question is: exactly what code should I include in check_user-pass.php?
I tried to add more code but couldn't do that as well! My current code is:
note: The name in you form is user_name but in your script you look for username
$username=$_POST['username']; should be $username=$_POST['user_name']; EDIT: If you use crypt to encrypt your password before you put them in the database, try this $sql="SELECT * FROM $tbl_name WHERE username='$username'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ $row = mysql_fetch_assoc($result); if (crypt($password, $row['password']) == $row['password']){ session_register("username"); session_register("password"); echo "Login Successful"; return true; } else { echo "Wrong Username or Password"; return false; } } else{ echo "Wrong Username or Password"; return false; } EDIT: myBB seems to use a crapload of md5 hashing for their passwords, try this $sql="SELECT * FROM $tbl_name WHERE username='$username'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ $row = mysql_fetch_assoc($result); if (md5(md5($row['salt']).md5($password)) == $row['password']){ session_register("username"); session_register("password"); echo "Login Successful"; return true; } else { echo "Wrong Username or Password"; return false; } } else{ echo "Wrong Username or Password"; return false; }ideas and questions
well i just want to verify a set of user-credentials:
- no encryption - what i want to do is just a check of a given set of credentials
- this is what i want to do and everything should be fine.
as for the credentials: i think i can check them with a script:
As you see, this form authenticates the user through check_user-pass.php.
_Idea:_ It looks for those credentials on my database; if they exist, returns OK, else returns value NO.
So my question is: exactly what code should I include in check_user-pass.php?
regards
update:
i can do this with a spimple test the connection script too:
error in establishing db bei dem Versuch ein Script zu installieren.
- mit einem Testconnection-Script versucht das weiterzuverfolgen:
Edited by tarifaLink to comment
https://www.neowin.net/forum/topic/1387573-check-user-name-and-password-on-database-to-verify-the-dataset%C2%A0/Share on other sites
3 answers to this question
Recommended Posts