Password protect with .htaccess


Run in console on server. In the folder were you want the password file.
Change admin till a user name you like and press enter, you will need
after that to type a password twist.
(mer…)

NodeJS npm commands


npm install jquery
https://jquery.com

npm install bootstrap@3
https://getbootstrap.com

npm install phantomjs
http://phantomjs.org/

npm install express
http://expressjs.com/en/guide/routing.html

NodeJS NginX Config Example


My simple Nginx setup, virtual host on ubuntu.

server { 
        listen 80; 
        server_name node.name.se; 
        access_log /var/log/nginx/node.access.log; 
        location / { 
              proxy_pass http://127.0.0.1:3050/; 
        } 
}
 server { 
        listen 80; 
        server_name nodejs.name.se; 
        access_log /var/log/nginx/nodejs.access.log; 
        location / { 
              proxy_pass http://127.0.0.1:4000/; 
        } 
}

 

Codeigniter


 function temp(){
     $id = $this->input->post('id');
     $rub = $this->input->post('rub');
     $cont = $this->input->post('cont');
     $err = "Inget gjordes du är nog utloggad!";
     if($rub !="" and $cont != ""){

     $a = array('rub' => $rub,
                'cont' => $cont,
                'userid' => $this->session->userdata('id') );

                $this->db1->insert('pro_user_mailer', $a);
                $err = "All good, posten uppdaterades";
     }  else {
         $err = "Fälten verkar vara tomma!";
     }
     echo json_encode(array('err' => $err, 'post' => $a ));
 }

 

Basic query’s in Codeigniter

Loop

// Loop
   $q = $this->db->get_where("", array('' => ''));
if ($q->num_rows() > 0) {
   foreach ($q->result() as $r){
      echo $r->id;
   }
}

// Row
$q = $this->db->get_where("", array('' => ''));
if ($q->num_rows() > 0){
   $r = $q->row();
   echo $r->id;
}


//query
$q = $this->db->query("");
if ($q->num_rows() > 0){
   $r = $q->row();
   echo $r->id;
}

NodeJS


Basic server with express templet folders routs and js och css included!
(mer…)