Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by picokojama

  1. This is good alternative for local testing... Thanks
  2. Hi everyone, Is it possible and how to set up cron job on local server, I am using windows 8.1 with xampp installation. I wasn't sure does the topic need to go on server's forum section, but I don't really understand concept behind cron jobs (I allways set it up in cpanel), so I posted it here. Thanks in advance.
  3. Well, method is good enaught... I just found extra level of security, disablad php from running in directory with .htaccess Thanks
  4. Hi there, I know how to secure file upload by checking file extension, but how can I secure from files that looks like images(have .jpg extension), but they are something else, like .exe file with .jpg extension (don't know for mac and ubundu, but you can do that trick on windows) Thanks advanced
  5. picokojama

    OOP error

    Hi everyone, I have something like more advanced problem, so I hope someone will help. No need for looking for variables and functions matches, I have good editor, and if there is any, it is because I am translating code to english. Here I have class DBobject, which contains all common database methods, but my focus is on two: public static function find_by_sql($sql) { global $pdo; // pdo connection works fine $query = $pdo->query($sql); $object_array = array(); while($row = $query->fetchAll()) { $object_array[] = static::instantiate($row); } return $object_array; } public static function instantiate($row) { $class = get_called_class(); $object = new $class; // because it can be used for users, pages... I don't wont to repeat my code foreach ($row as $attribute => $value) { $object->$attribute = $value; } return $object; } It is parent class of many classes, and I am looking in the class Comments protected static $table_name='komentari';protected static $db_fields=array(// all of my fields are here);public $id;public $user_id;// and all of database fields as variables And now, when I want to call it... $comment = Comment::find_by_sql(// here I select user based upon id); // this should return object with attributes from my database (because I returned object in instantiate function), am I right?echo $comment->content; // I exept here to echo lorem ipsum dolor sit amet.... And I get error that I called attribute of non-object $comment, aldo I returned the object in instantiate method
  6. picokojama

    PHP timezone

    Or you can change php.ini file once for all
  7. Hi! I have one issue with date translating. Here is my code: <?php $day = date("l"); $daynum = date("j"); $month = date("M"); $year = date("Y"); if($day == "Monday"){ $day = "Ponedjeljak"; }elseif($day == "Tuesday"){ $day = "Utorak"; } /* etc, translating day */ if($month == "January"){ $month = "siječnja"; }elseif($month == "February"){ $month = "veljače"; } /* etc, translating month */ elseif($month == "December"){ $month = "prosinca"; } echo $day . ", " . $daynum . ". " . $month . " " . $year . "."; ?> Now, problem is: Why output is "Utorak, 11. Dec 2012." (there should be "Utorak, 11. prosinca 2012.")? It translated only day, but not month, although code for month is similar to code for day.
  8. I also have one problem with date. Here is my code... <?php $my_t=getdate(date("U")); print("$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year]"); ?> It works, output is, for example "Sunday, December 9, 2012"Now, I want to translate it to my language, which means that I don't want to display "Sunday, December 9, 2012" but "Nedjelja, 9. prosinca, 2012." It is no matter if you don't understand this, I was wondering if anyone can just write how to not display "Sunday" but, for example, "Sunnyday" Thanks
  • Create New...