php

Sharing controllers, models and views between separate projects in CodeIgniter

Kohana, due to cascading file system and modules, allows to share code in common projects, that contains controllers, views and models directories. How can I do it in codeigniter? I want to create sites, that will share some code (admin area views, some models). That is easy in Kohana, we just have to add another directory for Kohana::fi...

Using the ternary operator in PHP

I am trying to print out yes if a boolean table field from a database query is true, and no if it is false. I am doing this: echo "<td>"{$row['paid'] ? 'Yes' : 'No'";}</td>"; Why is this incorrect? ...

What is the last Unix time?

What is the last Unix time in decimal? I'm going to set it as the expiration date of cookies (using PHP). Is it possible to cause problem? ...

Optimise file upload

Hi, I have a small php script which allows me to upload image file on the server. The only problem is that it takes a whole life to upload a 586 kilobytes image file. It there anyway to optimise this?. I'm running a 256kb/s download and 58 kb/s upload. Thanks ...

PHP-Doctrine2: Items - Shops - ItemsAtShops - how to conveniently implement using Doctrine2?

Hello. Somehow I can't figure out how to implement the following relations using Doctrine 2 syntax: I have Items and Shops. Each item has different price and different quantity at each shop. So, I have Items table, Shops table and ItemsAtShops table. How do I reflect the last one in Doctrine? I guess I need to create ItemsAtShops enti...

phpmyadmin: data is not importing correctly for varchar(utf8_bin)

I installed latest mysql and phpmyadmin 3.3.2deb1 on ubuntu. When I import already created sql file of data then it store garbage data (for example: 416e746967756120616e642042617262756461) for varchar field but all other fields are successfully imported. When I used same file before latest installation then it was importing data correctl...

regular expression - incremental replacement

Hi All, Is there any way to do integer incremental replacement only with regex. Here is the problem, I have text file containing 1 000 000 lines all starting with % I would like to have replace # by integer incrementally using regex. input: % line one % line two % line three ... output: 1 line one 2 line two 3 line three .....

saves as and Print dialog doesn't seem to work together in php...

I have a products page list and i am exporting it to a word document and also allowing user to print the document window.print... I click ExportToWord button saves as dialog opens and i canceled it... Next when i click print button the print dialog appears for a second and minmizes and the Saves as dialog appears containing the word docu...

using php to save remote images files at local sever but not completely successfully

I know some people already ask it but my probelm is when downloading remote images files(each file size is smaller than 200KB). But some files won't be completly saved. And some files can not be saved, or some files are saved but not 100%, I will see some gray shadow at image. The worst is everytime is different error ouput.(it's interne...

Flash LoadVars with PHP script.

Hi All, I have a flash movie that I need to read in a value from a PHP script in order to set which frame it starts from, I am using the following code: if (loaded == total) { var lvContent = new LoadVars(); lvContent.load("http://MY URL/Includes/getID.php"); trace("Who: " + lvContent.pageID); ...

google site search to list my database content

I am in the process of deciding which engine to use to incorporate extensive search features on my database entries into my site. I have been suggested Zend_Lucene, but am debating between Google Site Search. The question I forgot to ask was will Google Site Search provide me with database searching ability? ...

Suddenly getting a 502 Bad Gateway error

My boss was f***ing around with this page and suddenly it stopped working and started giving us a 502 Bad Gateway error. Is there anything you can see that explains why this happened? <ul id="menu"> <li><a href="?p=tenuta_a_deo.html">About A Deo</a></li> <li> <a href="?p=our_wines">Our Wines</a> <ul> <li><a href="?p=ou...

Why Rich:toolTip not work Under rich:calendar

Why is Rich:toolTip not working under rich:calendar? <td> <rich:calendar id="valuereq" requiredMessage="Requested Date Required" inputClass="inside_text" value="#{projectDetailManageBean.projectDetail.requestDate}" datePattern="M/dd/yy" required="true"> <rich:toolTip for="valuereq">Select Request Date</rich:toolTip> </rich:calend...

cp1250_general_ci to UTF-8 help

Hello, I'm fetching data from external database (I cannot edit it so don't suggest that please) which has internal encoding set to cp1250_general_ci. I need to display that data as UTF-8 but I cannot get it to work. I'm using this to fetch the data: $dsn = 'mysql:dbname=eklient;host=127.0.0.1'; $user = 'root'; $password = 'root'...

Securing a shared lighttpd setup

(Yes, I know that questions pertaining to lighttpd fit better on SF, but I thought it was more apt to be asked here since it's primarily concerned with security policy.) We're planning to set up a small web server in my college, so that people could get some web space to put up web pages and the like. They could also upload PHP pages. T...

PHP GD doesnt support a specifc image, any solution/workaround?

If I run $res=imagecreatefromJPEG ('http://www.theweddingoutlet.com/core/media/media.nl?id=29428&amp;c=697473&amp;h=8320018df7b40ec6eff8'); I get False + error : gd-jpeg: JPEG library reports unrecoverable error: (no further details). What is wrong with this specific image that makes it unsupported by GD? How can I make GD support i...

Creating a php script to run as cron job - using Zend Framework library...

Hi guys I'm creating a php script that would be called as a cron job. However I need to use the functionalities of the Zend framework. The thing is that relative referencing of files especially in includes don't work when programming for being run via command line so I'm stuck with how do I use the zend libraries here. I don't want to go...

how to search multiple tags in doctrine

I have a database with many-to-many relations on tag and person. I am in trouble when tried to search a person with multiple tags. I tried this but its fail: $person = Doctrine_Query::create() ->from("Model_Person p") ->innerJoin("p.tags t") ->whereIn('t.id',$t) ->execute(); The above statement ...

What report-writer does WebERP use?

WebERP is an open-source ERP tool. It has a cool custom report writer that allows you to generate reports by selecting fields from existing tables. Just wanted to know if anyone is aware of the component used there in.. And share their experience with it! Thanks & Regds, PG ...

How to create a PHP SOAP Client for calling a WCF Web service under SSL?

Hello everyone. We have a WCF service under an SSL Web Server installed in IIS. The web service was created with .NET 3.5 and WCF 3.0. We can access it with a .NET 3.5 client without problems. Let's call the URL where the service is published something like: https://my-server.com/testservice.svc?wsdl We need to make a proof of concep...