[DEV] SellIt [PHP / MySQLi]

Status
Not open for further replies.

Zeus

Active Member
Jun 30, 2012
150
30
That indenting... I hope that's just because you pasted it into this post ;P

No it's not actually like that, it's just DevBest which fucks it up, I don't know why. But anyway i've re-coded all of the register :p

PHP:
<?php
 
    require_once "global.php";
   
    define('regSelected', true);
    if($users->LoggedIn()) {
        header('Location: dashboard');
    }
 
   
    if(!$config->regEnabled) {
        header('Location: /?regEnabled');
    }
    $tpl->assign('regError', null);
    if(isset($_POST['submit'])) {
        $email = $db->real_escape_string($_POST['email']);
        $pass = $db->real_escape_string($_POST['password']);
        $rpass = $db->real_escape_string($_POST['rpassword']);
        $fname = $db->real_escape_string($_POST['fname']);
        $lname = $db->real_escape_string($_POST['lname']);
 
        if ($result = $db->query("SELECT * FROM `users` WHERE `email` = '".$email."'")) {
              if($result->num_rows != '0') {
                $tpl->assign('regError', '<div class="alert alert-error">Account email taken, please login</div>');
            }
        } if(strlen($lname) == '0' || strlen($fname) == '0') {
                $tpl->assign('regError', '<div class="alert alert-error">Please fill in all fields</div>');
            } else if(strlen($pass) < '6') {
                $tpl->assign('regError', '<div class="alert alert-error">Password legnth needs to be at least 6 characters</div>');
            } else if($pass !== $rpass) {
                $tpl->assign('regError', '<div class="alert alert-error">Both passwords needs to be the same</div>');
            } else if(!$users->checkEmail($email)) {
                $tpl->assign('regError', '<div class="alert alert-error">Your email is not valid</div>');
            } else {
                $users->addUser($email, $hash->encrypt($pass), $fname, $lname);
                $_SESSION['email'] = $email;
                header ("Location: dashboard");
            }
 
    }
       
       
    $tpl->assign('pageTitle', 'Register!');
    $tpl->draw('header');
    $tpl->draw('navi');
    $tpl->draw('register');
?>
 

iHarrison

Member
Mar 11, 2012
321
131
No it's not actually like that, it's just DevBest which fucks it up, I don't know why. But anyway i've re-coded all of the register :p

PHP:
<?php
 
    require_once "global.php";
 
    define('regSelected', true);
    if($users->LoggedIn()) {
        header('Location: dashboard');
    }
 
 
    if(!$config->regEnabled) {
        header('Location: /?regEnabled');
    }
    $tpl->assign('regError', null);
    if(isset($_POST['submit'])) {
        $email = $db->real_escape_string($_POST['email']);
        $pass = $db->real_escape_string($_POST['password']);
        $rpass = $db->real_escape_string($_POST['rpassword']);
        $fname = $db->real_escape_string($_POST['fname']);
        $lname = $db->real_escape_string($_POST['lname']);
 
        if ($result = $db->query("SELECT * FROM `users` WHERE `email` = '".$email."'")) {
              if($result->num_rows != '0') {
                $tpl->assign('regError', '<div class="alert alert-error">Account email taken, please login</div>');
            }
        } if(strlen($lname) == '0' || strlen($fname) == '0') {
                $tpl->assign('regError', '<div class="alert alert-error">Please fill in all fields</div>');
            } else if(strlen($pass) < '6') {
                $tpl->assign('regError', '<div class="alert alert-error">Password legnth needs to be at least 6 characters</div>');
            } else if($pass !== $rpass) {
                $tpl->assign('regError', '<div class="alert alert-error">Both passwords needs to be the same</div>');
            } else if(!$users->checkEmail($email)) {
                $tpl->assign('regError', '<div class="alert alert-error">Your email is not valid</div>');
            } else {
                $users->addUser($email, $hash->encrypt($pass), $fname, $lname);
                $_SESSION['email'] = $email;
                header ("Location: dashboard");
            }
 
    }
     
     
    $tpl->assign('pageTitle', 'Register!');
    $tpl->draw('header');
    $tpl->draw('navi');
    $tpl->draw('register');
?>

That's much better! :)
 

Zeus

Active Member
Jun 30, 2012
150
30
That's much better! :)

Thanks, hehe.

Re-coded the User Dashboard today, it displays a list of the users services on it and also coded the 'Purchase' page. I've decided to go ahed and re-code the entire admin dashboard and integrate RainTPL into that too as it's extremely hard to edit at the moment and is really messy coding wise. I'll take a break from coding it at the moment and get straight onto it within an hour or so.
 

Clit

Posting Freak
Feb 25, 2012
1,065
103
Looking forward to this, ETA on public release? Private release?
 

Zeus

Active Member
Jun 30, 2012
150
30
Looking forward to this, ETA on public release? Private release?

Going to be released within the next 1 - 2 weeks.

Also, i've took the decision to discontinue this project after it's released. The file system is easy to use and extremely easy to edit too. There's not much to expand on as i've literally done everything I can for this.
 
Status
Not open for further replies.

Users who are viewing this thread

Top