Hello!
I need some help removing a thing called the
BOM[
^] in my PHP code. I'm struggling.
All the Q&As I've seen so far seem to say that this thing appears because of the encoding in which code is saved, whereas my BOM seems to appear from nowhere during execution.
Basically, I have a jquery ajax call...
$.ajax({
type: "POST",
url: "php/session.php",
data: { name: a_name, password: a_password, company: a_company, q: "email" }
})
.done(function (msg) {
a_email = msg;
updatePersonals();
setTimeout(function () { slide("#Page7") }, waitback);
});
and the code executed if q=email in session.php is as follows:
if (checkUser($name, $password)) {
$company = $_POST["company"];
$datafile = clean('../../accounts/' . $company . '/' . $name . '/' . $CONST_account . '/');
if (!file_exists($datafile)) {
mkdir($datafile, 0777, true);
}
$fp = fopen($datafile . 'email2.txt', 'w');
fwrite($fp, $rank);
fclose($fp);
die;
if (file_exists($datafile)) {
$contents = file_get_contents($datafile);
echo $contents;
} else {
echo ':-( Your information is corrupted.';
}
} else {
echo 'This_should_not_h@ppen.com';
}
Now if a member was named "Imaginary Dude", and was at a company called "BoringWork", then I expect the code at "NOTE 1" to produce a directory of "../../accounts/Boring Work/Imaginary Dude/".
Unfortunately, I get an folder of "../../accounts/Boring Work/Imaginary Dude/".
I've got the code before the "die;" because I'm trying to pass the user's email to the client, and this code seems to reveal that I was getting errors because somehow this  thing, called a BOM by my research so far, is mucking up my filepath.
So does anyone know what this BOM (aka ) thing is, and why I'm getting it? I'm stuck.