Hallo Liebe Towner,
Da ich immernoch an meiner CMS entwickle, wollte ich eine neuere Version vorstellen.
Diesmal bin ich überzeugt das CMS vollkommen fertig zu schreiben, und erst dann releasen.
Hier noch ein paar kleine neue Updates, und Veränderungen zu der CMS.
- Index (http://prntscr.com/26puut)
- Register (http://prntscr.com/26puy9)
- Me-Page (http://prntscr.com/26puzx)
- Community-Page (http://prntscr.com/26pv22)
- Staff-Page (http://prntscr.com/26pv3w)
- News-Page (http://prntscr.com/26pv9z)
Konstruktive Kritik ist in Ordnung, aber solche Kommentäre wie *hässlich* und *Schrott* akzeptiere ich nicht.
- Core Class:
PHP
<?php
ini_set('display_errors', 0);
class DBConnection
{
public $mysqli;
public $query;
public function __construct()
{
$this->mysqli = new mysqli(host, username, password, datenbank);
if($this->mysqli->connect_errno){
echo $this->mysqli->connect_error;
}
}
public function Query($query)
{
$this->query = $this->mysqli->query($query);
if(!$this->query)
{
die(printf("<center><b color="red"><h3>Query Fehler</h3>: %s\n", $this->mysqli->error));
}
return $this->query;
}
public function NumRows($rows)
{
return $this->query->num_rows;
}
public function FetchAssoc($assoc)
{
return $this->query->fetch_array(MYSQLI_ASSOC);
}
public function FetchAssocNormal($assocnormal)
{
return $this->query->fetch_assoc();
}
public function FetchRow($row)
{
return $this->query->fetch_row();
}
public function SqlEscape($escape)
{
return $this->mysqli->real_escape_string($escape);
}
}
?>
Alles anzeigen
- User-Class:
PHP
<?php
session_start();
require_once("Class.MYSQLI.php");
class USER
{
public $row;
public $my_id;
public $DBConnect;
public function __construct($mysqli)
{
$this->DBConnect = $mysqli;
}
public function SetzeSessions($username, $password)
{
$_SESSION["username"] = $username;
$_SESSION["password"] = $password;
header("location:./me");
}
public function GenerateUserTicket()
{
$data = "ST-";
for ($i=1; $i<=6; $i++){
$data = $data . rand(0,9);
}
$data = $data . "-";
for ($i=1; $i<=20; $i++){
$data = $data . rand(0,9);
}
$data = $data . "-fireworkscms-beta-fe";
$data = $data . rand(0,5);
return $data;
}
public function UserInformation($username)
{
$this->row = $this->DBConnect->FetchAssoc($this->DBConnect->Query("SELECT username, credits, motto, vip_points, activity_points, auth_ticket, id, look, last_online FROM users WHERE username = '".$this->DBConnect->SqlEscape($username)."'"));
}
public function AccountExistiertNicht()
{
if($this->DBConnect->NumRows($this->DBConnect->Query("SELECT username, id FROM users WHERE username = '".$this->DBConnect->SqlEscape($_SESSION["username"])."' AND id = '".$this->DBConnect->SqlEscape($this->row["id"])."'")) == 0)
{
header("location:./logout.php?sessiontoken=".htmlspecialchars($_SESSION["username"])."");
}
}
public function IstEingeloggt()
{
if(isset($_SESSION["username"]))
header("location:./me");
}
public function IstNichtEingeloggt()
{
if(!isset($_SESSION["username"]))
header("location:./index");
}
}
?>
Alles anzeigen
Liebe Grüsse Steekarlkani.