2016-03-27 8 views
0

versuchen, Code für ein persönliches Projekt zu bearbeiten, aber kein Glück. Ich möchte, dass der Benutzername und das Passwort in $ shapassword als Großbuchstaben in der Datenbank ausgegeben werden. Unten ist der Code, speziell bei diesem hierKonvertieren von Datenbankeintrag in Großbuchstaben

$shapassword = sha1($username . ":" . $password); 

der Suche ist der vollständige 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); 
     } 
    } 
} 

ich ziemlich sicher bin, das eine einfache Lösung ist, aber ich habe nicht in der Lage gewesen, es zu erhalten, Arbeit. Wenn du helfen könntest, wäre das großartig, danke.

+1

Ich sehe nicht, wo Sie versuchen, hier eine Groß Methode zu tun. Und warum benutzt du sha1? Du wirst nicht damit leben, hoffe ich. –

+0

Danke für die schnelle Antwort, ich brauche das $ shapassword in Großbuchstaben auszugeben, ich glaube, es hat etwas mit dem ersten Code-Schnipsel zu tun. Es ist nur ein persönliches Projekt und wird nicht live sein. sha1 ist eine Voraussetzung. – Atronic

Antwort

0

versuchen string strtoupper (string $string)

Beispiel:

<?php 
$str = "Mary Had A Little Lamb and She LOVED It So"; 
$str = strtoupper($str); 
echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO 
?> 
+0

Danke das hat funktioniert! – Atronic

+0

Gern geschehen! – CCC

Verwandte Themen