php

is there a size limit to a text file?

HI All I am creating a log file for our website which will log every log-in by all the users to our orders area. I wish to know if you think its good to enter this log info in just one single file or should this be split up once the log file hits a certain size? My concern is that this file will get rather large over time, but im not c...

How does my php function for converting a date to facebook timestamp look? New to PHP.

any suggestions to make it better? function convertToFBTimestamp($date){ $this_date = date('Y-m-d-H-i-s', strtotime($date)); $cur_date = date('Y-m-d-H-i-s'); list ($this_year, $this_month, $this_day, $this_hour, $this_min, $this_sec) = explode('-',$this_date); list ($cur_year, $cur_month, $cur_day, $cur_hour, $cur_min, $cur_sec) = expl...

Zend Framework-Do images, mp3s, scripts, etc, just go in public folder?

I guess these are all questions that everyone must just know, because I'm not seeing this in the documentation :-D I understand that the public folder is the folder that the world has access to. I know it is the case with the css folder, but in migrating a traditional php website over, will my /images folder, /js folder /mp3s, etc W...

SQL Server Query Slow from PHP, but FAST from SQL Mgt Studio - WHY???

I have a fast running query (sub 1 sec) when I execute the query in SQL Server Mgt Studio, but when I run the exact same query in PHP (on the same db instace) using FreeTDS v8, mssql_query(), it takes much longer (70+ seconds). The tables I'm hitting have an index on a date field that I'm using in the Where clause. Could it be that PHP...

Prevent access to files outside a certain directory in PHP

I've found out the hard way that my website can be hacked by passing a query string parameter that has many ../s to access files outside of the website directory, and then hack the website. Is there a way, perhaps through the php.ini, to not allow file includes outside of a certain root directory? To make things worse, most of what is ...

How can I use MVC ideas without using classes?

As of right now, I am still shaky on classes, so I don't want to use any classes for my site. I'm still practicing with classes. But how can I implement the MVC idea without classes? Would this work for a MVC? index.php (the view) index_controller.php index_model.php Is this right for what a MVC should be? Vie...

Dynamic Variables Within Functions

Why does this work: function myfunction($v) { $query = $v['host'] == '1'; return ( $query ); } $output = array_filter($recordset,myfunction); print_r($output); Whereas this script, which tries to accomplish the same thing with variables, does not? $column1 = 'host'; $value1 = 1; $query1 = '$v[\''.$column1.'\'] == '.$value1; ...

preg_match , regexp , php , extract text from html

I'm trying to extract "Florida (FL)" from http://www.auctionarms.com/search/displayitem.cfm?itemnum=9736364&amp;oh=216543. My code is //get location $pattern = "/(State)<\/i>\:<\/td>(.*)<\/td>/"; preg_match_all($pattern, $htmlContent, $matches); print_r($matches); any idea why is not working ? ...

php json encode

This below output come from php json_encode.What we see here is 0849 is twice.Since javascript only use sn to get value why we need the "0" value.The main problem is speed execution. If 800 kb data might can be reduce to 400 kb {"success":"true","total":968,"data":[{"0":"0849","sn":"0849" }] If no solution i have to make a script t...

PHP removing more than one white-space

So, If I have a string like "hello what is my name" How can I take all of the spaces and replace each with only one space? Thanks! ...

php,codigniter, upload the zip file problem

function upload( &$data = array() ) { $config['upload_path'] = 'system/application/orginalimage/'; $config['allowed_types'] = 'gif|jpg|png|zip'; $config['allowed_type'] = 'application/zip'; $config['allowed_type'] = 'application/x-zip-compressed'; $config['allowed_type'] = 'application/x-compress'; $c...

how to upload zip/rar files in codeigniter

how to upload zip/rar files in codeigniter itried like this $config['allowed_types'] = 'application/x-zip|application/x-zip-compressed|application/octet-stream|application/x-compress|application/x-compressed|multipart/x-zip'; but not working . please help me................. ...

how can i update my dynamic ip with curl php

i have registered a domain and now i want to host it on my own home server ... i want to setup a system with php curl so that i login to my domain website and update my name servers i.e http://mycompany.com/webhosting/domain/manage.php?action=showNS&amp;domain_id=10003489 i want to login to that site and auto update my dynamic ip addr...

Show parts of the result of an SQL statement using PHP

I have an SQL query which returns a set of data (around 40-50 tuples). I would like to display the results 5 at a time on an HTML page using PHP. I already managed to have the right SELECT statement, but i am having problems to display the results 5 by 5 using a "more" button. Can you please help? Note that every time i call the query,...

Best way to send attachment mail with out using SMTP classes in PHP

can any one please advice me to send attachment mail with out using SMTP classes in PHP ...

results show well in the class file, but show strange characters when I include it in the main system?

I am currently building a blog system, and the class file i.e class Blog{}, is running ok, when I try it on its own, but, when I try to use it in the pages of the site that have css, it looks weird and full stop, and apostrophes are replaced by strange characters! please help, this is my first time of using oo for development, ...

what's wrong with this function?

function get_ibo_id() { if($registerquery = $this->conn->query("SELECT ibo_id FROM fasttrack WHERE count < 8 && flag = 1 ")){ $this->increase_count(); while ($row = $registerquery->fetch_assoc()) { return $row[ibo_id]; } } else return "No id"; } it always enters the if ...

Kohana 3 simple relations..

I'm trying to write a very simple cms (for learning purposes) in kohana 3 web framework. I have my db schemas and i want to map it to ORM but i have problems with relations. Schemas:articles and categories One article has one category. One category might has many articles of course. I think it is has_one relationship in article table....

PHP: How do I access child properties from a method in a base object?

I'd like for all of my objects to be able to return a JSON string of themselves. So I created a base class for all of my objects to extend, with an AsJSON() method: class BaseObject { public function AsJSON() { $JSON=array(); foreach ($this as $key => $value) { if(is_null($value)) continu...

Automatic backup

I need to backup automatically daily my database in mysql and all image files on the server. Is there a way to backup these things and send it on my email address ? ...