This question already has an answer here:
- How do I echo text in capital letters? 2 answers
trying to edit some code for a personal project but having no luck. I want to have the username and password in $shapassword output as all uppercase in the database. Below is the code, specifically looking at this
$shapassword = sha1($username . ":" . $password);
Here is the full code
public function register($post)
{
if (!isset($post['username']) || empty($post['username']) || !isset($post['password']) || empty($post['password']) || !isset($post['passwordrep']) || empty($post['passwordrep']) || $post['password'] != $post['passwordrep'] || !isset($post['email']) || empty($post['email'])) {
die("Unknown error!");
}
$username = $this->escape($post['username']);
$password = $this->escape($post['password']);
$shapassword = sha1($username . ":" . $password);
$email = $this->escape($post['email']);
if (!$this->checkEmail($email)) {die("Error - E-Mail alreadly exists in our database.");}
if (!$this->checkUsername($username)) {die("Error - Username already exists in our database.");}
$query = "INSERT INTO " . $this->core->loaded['table'] . " (";
foreach ($this->core->loaded['fields'] as $field => $value) {
if ($query == "INSERT INTO " . $this->core->loaded['table'] . " (") {
$query = $query . "`" . $field . "`";
} else {
$query = $query . ", `" . $field . "`";
}
}
$query = $query . ") VALUES (";
$qe = $query;
foreach ($this->core->loaded['fields'] as $field => $value) {
if ($query == $qe) {
$query = $query . "'" . $this->format($username, $password, $shapassword, $email, $value) . "'";
} else {
$query = $query . ", '" . $this->format($username, $password, $shapassword, $email, $value) . "'";
}
}
$query = $query . ");";
$this->DBC->query($query);
if ($this->DBC->errno) {die($this->DBC->error);} else {die("true");}
if ($this->config->email_notification) {
$subject = $this->format($username, $password, $shapassword, $email, $this->config->email_subject);
$text = $this->format($username, $password, $shapassword, $email, $this->config->email_text);
$headers = "From :" . $this->config->email_email;
mail($email, $submit, $text, $headers);
}
}
}
I'm fairly certain this is a simple fix, but I haven't been able to get it to work. If you could help that would be great, thanks.
</div>