hello.
i'm up to doing something new and i thought about a web editor.
this will be free.
So if you do not know what a web editor is, check webs.com.
I've just started coding again after a couple of weeks ago and i took the time to learn myself ajax, more javascript, more jquery and more php. So hopefully everything will be OK when this project is finished.
here's some snippets.
"Global" class
user class:
core class
im not done coding any of these files yet, i still have a bunch of stuff left.
there's probably bugs in the code, i'll fix that later.
print screens:
and that's everything i got atm.
i'll be updating every week probably, still have a lot of school.
bye. (sorry for my bad english)
i'm up to doing something new and i thought about a web editor.
this will be free.
So if you do not know what a web editor is, check webs.com.
I've just started coding again after a couple of weeks ago and i took the time to learn myself ajax, more javascript, more jquery and more php. So hopefully everything will be OK when this project is finished.
here's some snippets.
"Global" class
PHP:
class Globala{
public function __construct($files){
if(is_array($files)){
foreach($files as $file => $value){
if($this->fileExists($value)){
try{
// Försöker inkludera varje fil..
$this->incFile($value);
}catch(Exception $error){
die($error->getMessage());
}
}else{
echo 'Ngt fel i global.class.php, err 1';
}
}
}else{
echo 'fel 2';
}
}
public function fileExists($file){
return file_exists($file . '/');
return $this;
}
public function incFile($files){
foreach(glob($files . '/*.php') as $file){
include $file;
}
return $this;
}
}
user class:
PHP:
public function __construct($db){
$this->_db = $db;
$_SESSION['userid'] = $this->randomizeToken();
$this->setToken();
Core::set(@$_SESSION['userid']) ? $this->_userid = $_SESSION['userid'] : true;
}
public function setToken(){
$this->_usertoken = $_SESSION['usertoken'];
}
public function randomizeToken(){
return base64_decode(openssl_random_pseudo_bytes(32));
}
public function getUserInfo($column){
$this->_db->pquery("SELECT * FROM users WHERE id=?")->pbind('i', array($this->_userid))->prun();
$got = $this->_db->pget();
$gotten = $got->fetch_assoc();
return $gotten[$column];
}
core class
PHP:
public function __construct(){
// EMPTY ATM
}
public static function isEmpty($value, $m){
return empty($value) ? die($m) : true;
}
public static function set($value){
return isset($value);
}
public function inPage($page){
return $_SERVER['SCRIPT_NAME'] == $page;
}
public function only($session){
switch($session){
case true:
return true;
break;
case false:
header("Location:index.php?page=index");
return false;
break;
default:
return false;
break;
}
}
public function offlinePage($session){
switch($session){
case true:
header("Location:index.php?page=home");
break;
case false:
return true;
break;
default:
return false;
}
}
public function page($page){
return $_GET['page'] == $page;
}
public function createFile($path, $format){
$l = 'abcdefghijklmnopqrstuvwxyz0123456789_';
$new = str_shuffle($l);
return fopen($path . $new . $format, 'w');
}
public function deleteFile($link){
return unlink($link);
}
im not done coding any of these files yet, i still have a bunch of stuff left.
there's probably bugs in the code, i'll fix that later.
print screens:
You must be registered for see links
- frontpageand that's everything i got atm.
i'll be updating every week probably, still have a lot of school.
bye. (sorry for my bad english)