Dodavanje SSL domenu

Nisam nešto previše ulazio u proceduru ali sam proveo dobrih 5 sati pokusavajući da ubacim sertifikat na svoj domen. Naravno dodao sam. Pišem proceduru da ne bih zaboravio kako se to radi.

Pre svega, jedan SSL je za samo jedan domen tj IP adresu. Pokusašao sam sa dodatnim domenom i odmah sam naišao na problem jer ako bi prvi domen radio odmah po postavljanju narednog domena prvi bi prestao da radi dok bi drugi radio bez problema. U suštini zadnji koji se postavi taj jedino i radi.

Ja koristim DirectAdmin licencu. Kupio sam je pre par godina za $299 i to je jedna od promišljenih investicija i možda i najpametnija jer sve radi kako treba i ne košta me ništa. Neke druge su me koštale i previše tako da sam prestao da ih plaćam.

Da bi dodali SSL idite na https://www.startssl.com/ i tamo dodajte sertifikat za rad sa Firefoxom. U suštini naredni put samo kliknete na authenticate i odmah ste logovani. Zatim vertifikujte email adresu, domen i generišite ssl.key koji ćete da dekodirate u private.key i generišite webserver key. Obe ove datoteke su potrebne. Posle toga vam je potrebna još samo datoteka za startssl konverziju i to je to.

Dodavanje u directadmin je lako. Kliknete na domen, SSL, pa onda pastujete private.key sadržaj i odmah ispod toga ssl.crt. Obratite pažnju na to da kliknete na “Paste a pre-generated certificate and key”. Onda dodate “sub.class1.server.ca.pem” sadržaj u “Click Here to paste a CA Root Certificate”. I to je to.

Naravno samo jedan domen i jedna IP adresa. Ovo važi za besplatni SSL class1 sertifikat. Možete da kupite i multidomain iliti wildcard certificate ali ja nemam potrebu. Bar ne još uvek.

Sličice nema. Pokušavam sa ovim glupim paint.NET da se složim i dogovorim ali mi ne ide. GIMP mi je pretežak. Videću sa MS Paint šta mogu da uradim.

Update: Spasite sebe muka i lepo pazarite SSL serifikat za skoro $4 od ovih ljudi SSLS tj namecheap-a.

Mysql & PHP utf8 problem

Recently I had to write some software for the company I’m working for. It’s web application for converting raw exported data from Oracle database to human readable excel file. And it’s not naive app. Not at all. I am still responsible for cca 200.000 entries and upper top management makes decisions relying on this app. So it’s serious.

updated: problem solved long time ago, I can’t remember what was it. I think I did convert data from the php end. That way mysql tables left intact.

 

 

PHP Mysql extending class

So, lets say you want to extend php/mysql class we were talking about earlier.

class nastavak extends baza {

private $nast;
private $drugi;

public function __construct(){
echo "This is the extended class";
parent::__construct("","root","","test");
parent::sqlquery("select * from imena");
parent::stampaj();
}
}

What happened here? Well, we have added another class on top of baza class and that way we have extended it. It means new class (extended) has everything from parent class (baza) and what we have added inside of it (nastavak).

Overriding in the next article.

PHP Mysql class for websites

I had some free time and decided to write one simple php class for manipulating mysql. It’s really simple code, it can help new programmers learn how to build their own classes.

<?php

class baza {

 private $username;
 private $password;
 private $local;
 private $errors;
 private $resource1;
 private $db_sel;
 private $sqlupit;

 public function __construct($l="localhost",$u, $p, $db_selected){
 $this->username=$u;
 $this->password=$p;
 $this->local=$l;
 $this->db_sel=$db_selected;
 $this->conn();
 $this->db_selected();
 $this->listaj_db();
 }

 private function conn(){
 $this->resource1=mysql_connect($this->local,$this->username,$this->password);
 if (!$this->resource1){
 echo "Postoji problem sa konekcijom <br />";
 }
 else {
 echo "Sve je super <br />";
 }
 }

 private function db_selected(){
 mysql_select_db($this->db_sel);
 }

 private function listaj_db(){
 $result = mysql_query("SHOW DATABASES"); 
 while ($row = mysql_fetch_array($result)) { 
 echo $row[0]."<br>"; 
 }
 
 }
 
 public function sqlquery($n){
 $this->sqlupit=mysql_query($n);
 }
 
 public function stampaj(){
 //$result = mysql_query("SHOW DATABASES"); 
 while ($row = mysql_fetch_array($this->sqlupit)) { 
 echo $row[1]."<br>"; 
 }

 }
}

$n=new baza("","root","","test");
$n->sqlquery("select * from imena");
$n->stampaj();

?>

Please comment if you have some questions.

Reading Good To Great right now

I was at the book store and got myself a new book Good to Great. It was really cheap and I couldn’t resist temtation to buy it and as soon as I got home I have started reading it.

So far so good. Interesting read.

collinsUpdate 2015: I did read this book and tried to implement what I have learned but you are probably stupid if you think that only work will bring you to the top. In short, I was working like an ass and others took credits and went to a better positions because you are someone’s bitch. I’m sure I won’t do it again. Respect is fine but thank you leads you nowhere.