php

PHP in linux (LAMP) is not displaying cause of errors when code fails? (Ubuntu)

I was a Windows user and used Wamp. Every time a PHP code failed, the browser would display something like this: error in line number xx. I followed the installation of this tutorial and everything worked. Now when code fail PHP just display a blank page. Any sugestions? (I'm using Ubuntu 10.04). ...

Jquery continuous ajax request

Let's say initially I have an image loaded in my view. Every now and then, I want that image to change via ajax with an interval of 10 sec. How can I do that? Thanks. ...

'created at' and 'updated at' fields

This seems like a really simple one but I'm struggling to figure it out. I want a column in my database that lists when a record was first created and another column that says when it was updated. It's my understanding I should be able to do all this just using MySQL. All help is appreciated :) This stinks still no answer, reasons I'm a...

Function/method argument validation standards.

I was just inquiring about standard practices of argument validation syntax. I'm working with PHP as of currently, but anything that's considered a platform/language agnostic solution would be great. As of currently, I'm aware of two pretty common syntax. For example (my preference): function foo($a, $b, $c){ if(!$a){ throw new Exc...

PHP - Should we sanitize $_FILES['filename']['name']?

Hello all, After the user uploads an image to the server, should we sanitize $_FILES['filename']['name']? I do check file size/file type etc. But I don't check other things. Is there a potential security hole? Thank you ...

PHP Session Problem in Safari, Opera, and IE

Over SSL. Works in Chrome/Firefox but shows an empty value for sessionTestVariable for Opera/Safari/IE: <? // https://mydomain.com/setSession.php session_cache_limiter( 'nocache' ); session_set_cookie_params("899", "/", ".mydomain.com"); session_start(); unset($_SESSION['sessionTestVariable']); // Set sessionTestVariable $_SESSION['ses...

Handling HTTP request

If there is a HTTP request coming to a web server from many clients the requests will be handled in the order. For all the http request i want to use a token bucket system. So when there is a first Request i write a number to a file and increment the number for the next request and so on.. I dont want to do it in DB since the DB size i...

PHP - is it better to use require_once('filename.php') or require_once 'filename.php';

Is this just a stylistic difference, or does using require_once('filename.php') vs require_once 'filename.php' have actual load/efficiency differences? ...

Zend Framwork view script, functions and variable scope

Hi all, I am rather new to ZendFramework and am trying to figure this out. In my view script (index.phtml), I have this bit of code that says: <?php function getErrorString($element) { echo "<pre>"; print_r($this); echo "</pre>"; $string = ''; if(!empty($this->error[$element])) { $string = $string.'<label class="error" for="'.$e...

Questions abt PHP Magic Methods & Delegating

i was wanting to wrap an object in another - favoring composition over inheritance. but i am not sure i am doing it right tho there are no errors. i created a class Wrapped thats is wrapped by Wrapper. i made it such that when a method/property is called on $wrapper, if it exists in the class, Wrapper, it will be returned else, it will...

php parameters over specific port

I have a php page http://mydomain.com/mypage.php this page will be accessible by public and our partner. my partner is supposed to send a POST request over port 7333 to http://mydomain.com:7333/mypage.php . now how can i accept the parameters if and only if they came over port 7333. i want to distinguish between parameters that are comin...

Parse error in php.

in my website all pages contain Follow Us panal so inspite or writing it on all pages I have created a seperate modFollow.php file and included it in all pages, I don't know whether its a correct way or not but I am gettein this error message- my indexpage code - <div class="follow"> <?php include 'modFollow.php'; ?> ...

PHP - "Sal's mall is $emo" vs "Sal's mall is ".$emo - string with quotes concatenation efficiency

In PHP, which is a better way to concatenate strings (with a single-quote) in terms of resources? "Sal's mall is $emo." or "Sal's mall is ".$emo.'.' or 'Sal\'s mall is '.$emo.'.' ...

jQuery - Post array of multiple checkbox values and title to php

I refer to this page: http://stackoverflow.com/questions/1557273/jquery-post-array-of-multiple-checkbox-values-to-php <input type="checkbox" class="box" value="blue" title="A" /> <input type="checkbox" class="box" value="red" title="B" /> <input type="checkbox" class="box" value="white" title="C"/> $('#include').click(function(){ ...

How to combine result sets of a sql query?

I am having 5 checkbox with the food items like Chicken, fruits, vegetables, Snacks,.. like that. What i am trying to implement is when the user selects the checkbox items and clicks submit, it will search for the restaurants providing the selected items, Table will have 2 fields: restid, menu and the data is stored like this in the t...

How can I make a silent mode for TinyMCE editor

I want to create TinyMCE editor on the page, but it should boot and render only after focus on action. How can I do that, please, can you give advice to me. Recession Page may have include scores TinyMCE elements, and page will hang. Therefore, the field should be converted into TinyMCE as needed, initially it's just textarea. ...

PHP - Effects of using the wrong image headers for echo file_get_contents('someImageFile.ext')

It looks like it does not matter what image headers I use for spitting out via php script an image file with unknown extension, call it .ext Are there any actual effects? (Is PHP silently converting it, or bypassing the format?) ...

how to make drupal pages into menus and submenus like administrator menu

Hi everyone, I'am new to Drupal, i just want to create a website which contains pages like about us, contact us and other static information that may be changed after a long time. Now i can create the pages and sub pages to main pages. The links are displaying on the top of the logo and the sub pages were showing on the side of the mai...

Which to use: REMOTE_ADDR or SERVER_ADDR

Any real difference between $_SERVER['REMOTE_ADDR'] $_SERVER['SERVER_ADDR'] I'm tracking visitors to a page, and I've always used REMOTE_ADDR, but recently I saw a script that collected both information. Is this a better practice or not needed? ...

MySQL query results are not a resource

I am having trouble with the query in this code. The problem is one I have had before, the $num = mysql_num_rows($result); part gives me a MySQL error saying it expected a resource. Usually when I have this error it is because I misplaced a single quote some where, but after looking I cannot find any problem, though this query is a bit...