AD password issue
-
Hello,
I have change my AD password and put an apostrophe (') in it, since I have issue with it. When I change something in “general” or “active directory” the password is change in mysql, the apostrophe is replaced by “'”. -
@lenain said in AD password issue:
'
Is the “':”. giving a problem? MYSQL is typing it that way as a HTML code. I have no coding knowledge nor do I know MYSQL very well but this may be of some use:
Source:
https://stackoverflow.com/questions/9596652/how-to-escape-apostrophe-in-mysql
Quote:
Possibly off-topic, but maybe you came here looking for a way to sanitise text input from an HTML form, so that when a user inputs the apostrophe character, it doesn’t throw an error when you try to write the text to an SQL-based table in a DB. There are a couple of ways to do this, and you might want to read about SQL injection too. Here’s an example of using prepared statements and bound parameters in PHP:$input_str = “Here’s a string with some apostrophes (')”;
// sanitise it before writing to the DB (assumes PDO)
$sql = “INSERT INTOtable
(note
) VALUES (:note)”;
try {
$stmt = $dbh->prepare($sql);
$stmt->bindParam(‘:note’, $input_str, PDO::PARAM_STR);
$stmt->execute();
} catch (PDOException $e) {
return $dbh->errorInfo();
}
return “success”;
In the special case where you may want to store your apostrophes using their HTML entity references, PHP has the htmlspecialchars() function which will convert them to “' ;”. As the comments indicate, this should not be used as a substitute for proper sanitisation, as per the example given.