php

Date formatting in PHP

Hello, I've a date formatted like "Tue Jan 05 11:08:27 +0000 2010" and I want to convert it's format to "yyyy-mm-dd 00:00" in PHP. How can I do that? ...

MVC - is it okay for business models to know each other?

Simple question: in MVC, is it okay for one model to interact with another? For example, with an Auth model...can it interact with the User model - or is there a better way to go about it? Should the middle man be the controller? ...

Which is faster? An empty statement or a return

I've always been curious about this. Between the two code example which is more processor efficient? I understand that various languages may be different and I need to know what the answer is in PHP, but I am also curious about javaScript, CFScript, and ActionScript if the answer would be different. Thanks ps:The example may not be exa...

PHP Storing Sessions: Can't Seem to Serialize Session Variables

Hello all, I am making use of seralize and unseralize to set and get session variables from my Database. A user is in a session and every time they click save. I do this: $array = serialize($_SESSION); //and save to DB field When a user loads a session, I load the variables too to continue that session like so: //get row from DB $_...

What would be the most effective way to insert tags into a table

Hello, I have the following tables; CREATE TABLE IF NOT EXISTS `tags` ( `tag_id` int(11) NOT NULL auto_increment, `tag_text` varchar(255) NOT NULL, PRIMARY KEY (`tag_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; CREATE TABLE IF NOT EXISTS `users` ( `user_id` int(11) NOT NULL auto_increment, `user_display_...

Get user input from form, write to text file using php

As part of a subscriber acquisition I am looking to grab user entered data from a html form and write it to a tab delimited text file using php.The data written needs to be separated by tabs and appended below other data. After clicking subscribe on the form I would like it to remove the form and display a small message like "thanks fo...

Force Content-Type on files with no Extension in EclipsePDT?

I use Eclipse-PDT to work on my PHP projects and find it inconvenient when Eclipse does not recognize my php files that have no extension. Our project contains many cli/bash-style php scripts that have no file-extension (for whatever reason). This results in no code-completion, highlighting, etc for these particular files. It treats them...

How i turn like 1592.50 into 1593 with php ?

Hi all, i want a way to check if the number has comma, then it return it into the next number. example : <? $mynum = "6265.50"; // output : 6266 , and not 6,266 like the function of number_format() ?> Thanks ...

Drupal-6: Why won't this node save?

I have constructed a set of nodes. After running them through node_save(), I get back an nid, and I can navigate to the page for that node, but they are empty. (No data is shown for any of the fields.) When I go to the edit url for that node, I get this error message: warning: call_user_func_array() [function.call-user-func-array]...

PHP - Can names of private functions inside classes be repeated?

class One { private function thisfn() {} } class Two { private function thisfn() {} } is this legit? btw does it matter if it's a private/public function inside a class? And also, can I create a new function named thisfn() outside of any class (and make it public)? like: function thisfn() {} ...

Basic MySQL/PHP Filtering

I know this is a very basic question, thats why I just want a simple answer please, there is several ways to my user input safe for mysql. Is using this the BEST method mysql_real_escape_string() On all user submitted items going into a mysql query? If I use the above, do I need to use another function on that date when I get it bac...

Pass entire $_POST variable to popup

I have a PHP webpage that takes which accepts a rather large POST array. I have a button on the page that opens a PHP popup window. Is there a convenient way to pass the entire $_POST array to the popup? Edit: It is an entirely different page. I open it with JavaScript: window.open ...

Is this a job for Mysql Foreign Keys?

In the past few years I have read plenty of articles on Foreign Keys in MySQL, nothing recent though. I know they are good to use on something like a forum topic that has child post's under it, if I delete a topic with 100 post's connected to that topic, foreign keys will make it delete those 100 topics for me, am I correct so far? I...

Matching Rapidshare links with regex

I want to match a sequence of Rapidshare links on a webpage. The links look like: http://rapidshare.com/files/326251387/file_name.rar I wrote this code: if(preg_match_all('/http:\/\/\rapidshare\.com\/files\/.*?\/.*?/', $links[1], $links)) { echo 'Found links.'; } else { die('Cannot find links :('); } And it retuns Cannot fi...

PHP/AJAX Image Grabbing script similar to functionality Facebook messaging...

Hello, When sending a message on Facebook, if you include a URL it generally grabs a picture from the webpage and adds it at the bottom as a thumbnail. You then have the ability to select through a number of pictures featured on the site. I can see how this could be built, but to save me the hassle I wonder if somebody has already don...

zendframework baseUrl view helper in boodstrap

My website uses the zend framework and runs in a sub folder, for example: http://www.example.com/sub/folder. Now I want to prepend my css links with /sub/folder/ to make the css load in pages like http://www.example.com/sub/folder/product/abc, I thought I found a view helper to do this BaseUrl but BaseUrl seems only to work in actual vie...

PHP create image without declaring image header for entire page

I want to create several images with PHP on my webpage. Is there a way to do this without creating each image in its own PHP file and then placing the URLs to these files in img tags? ...

Get Digg count of an URL using Services_Digg2 with PHP

Has somebody usable info on this, It isnt clear if this api is even capable of searching by url, searched trough G, without much success. Some info about new Services_Digg2 pear package: http://digg.com/api/docs/servicesdigg2 ...

how to proxy a localhost only webpage through a publicly facing authenticated webpage?

I have a web application that requires user authentication. Once logged into this web application I want the users to also be able to see the content of a read only wiki that is running on the same server but is not publicly accessible, however I do not need/want to have the users of my web application to have accounts on that wiki, and...

PHP __PHP_Incomplete_Class Object with my $_SESSION data

I've got a site setup that, on page load, turns all user submitted strings into SafeString objects. For those unfamiliar with SafeString, it basically forces the user to echo out sanitized data preventing XSS and whatnot.. Anyways, there's a problem. My $_SESSION array is being filled with __PHP_Incomplete_Class Object. From what I've ...