Jump to content

EZEQUIEL

Advanced members
  • Content Count

    11
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by EZEQUIEL


  1. On 2/10/2018 at 3:15 PM, Perseus said:

    I've started actively working on this. I've created a new repo since there's pretty much no similarity between the architecture of the two websites. You can check it out at http://github.com/Perseus/topcms, but I'd suggest not trying to install it yet. I'm still working on it (daily, this time haha)

    I will work in your project, I have here o lot of code for add . 


  2. On 7/14/2018 at 3:14 PM, Wantows said:

    how to install in zend server?

    you not nedd xend server for it... But if you  desire you can do it.  

     

    1) Rename root  public_html to be  public_html/public 

     

    2) search in goolgle about 1)

     

    3) in your root project  u will need run composer update or mover all  vendor files.

     

    4... I can make a video for you  IF you need it. 


  3. Hello. 

     

    I need help to make a website MALL  customized,  so I need know what SQL query command i can use to do it.

     

    exemple: I  did have my create account  customized , used for exemple-> 

    INSERT INTO AccountServer.dbo.account_login (name, password,originalpassword) VALUES ('<login>', '<MD5 password uppercase>','originalpassword)');

     

    This exemple working perfect

     

     

    how i can make same with ITEM ?  I want add a item to my char from my website customized, so what table and values i need  do to query ?


  4.  here a code 100% works

     

    <?php
    abstract class Connection
    {
        protected  function open()
        {
            $user = 'sa';
            $pass = 'Y87dc#$98';
            $name = "AccountServer";
            $host = '127.0.0.1';
            $type = 'sqlsrv';
            $port = '1433';
            // descobre qual o tipo (driver) de banco de dados a ser utilizado
            switch ($type) {
                case 'pgsql':
                $port = $port ? $port : '5432';
                $conn = new PDO("pgsql:dbname={$name}; user={$user}; password={$pass};host=$host;port={$port}");
                break;
                case 'mysql':
                $port = $port ? $port : '3306';
                $conn = new PDO("mysql:host={$host};port={$port};dbname={$name}", $user, $pass);
                break;
                case 'sqlite':
                $conn = new PDO("sqlite:{$name}");
                break;
                case 'ibase':
                $conn = new PDO("firebird:dbname={$name}", $user, $pass);
                break;
                case 'oci8':
                $conn = new PDO("oci:dbname={$name}", $user, $pass);
                break;
                case 'sqlsrv':
                $conn = new PDO("sqlsrv:Server={$host};Database={$name}",$user,$pass);
                break;
            }
            // define para que o PDO lance exceções na ocorrência de erros
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $conn;
        }
    }
    class Database extends Connection {
        protected $data;
        protected $table;
        public function __set($prop, $value){
            $this->data[$prop] = $value; // atribui o valor da propriedade
        }
        public function __get($prop){
            return $this->data[$prop];
        }
        public function store()
        {
            $prepared = $this->data;
            if (empty($this->data['id'])){
                // cria uma instrução de insert
                 $sql = "INSERT INTO {$this->table} " . 
                    '('. implode(', ', array_keys($prepared))   . ' )'.
                    ' values ' .
                    "('". implode("','", array_values($prepared)) . "')";
            }
            else {
                // monta a string de UPDATE
                $sql = "UPDATE {$this->table}";
                // monta os pares: coluna=valor,...
                if ($prepared) {
                    foreach ($prepared as $column => $value) {
                        $set[] = "{$column} = {$value}";
                    }
                }
                $sql .= ' SET ' . implode(', ', $set);
                  $sql .= ' WHERE id=' . (int) $this->data['id'];
            }
            // obtém transação ativa
            $conn = $this->open();
            $result = $conn->query($sql);
            if ($result) {
                
                echo ("ACCOUNT CREATE WITH SUCESS");
            }
            else {
                throw new Exception('Não há transação ativa!!');
            }
        }
        public function setTable($table){
            $this->table=$table;
        }
    }
    
    ?>
    
    <?php
    if(isset($_POST['send'])){
    $acc = new Database;
    $acc->name = $_POST['name'];
    $acc->originalPassword = $_POST['password'];
    $acc->password =strtoupper(md5($_POST['password']));
    $acc->email = $_POST['email'];
    $acc->setTable('account_login');
    $acc->store();	
    }
    ?>

     

    • Like 1
×
×
  • Create New...