php

zend locale is making me nervous: wrong datepresentation

Hello everyone, First I had problems with getting date's into my db see here. Now I have problems with getting it into the database on the right format. This is my code: public function editAction() { if($this->_request->getParam('id')){ $id = $this->_request->getParam('id'); $data = $this->_evtObj-...

rewriting links in scraped content using mod_rewrite

Hi, I'm looking to create an iframe on my site that contains amazon.com, and I'd like to control it (see what product the user is at). I realize I can't do this because of browser security policy issues, and the only real workaround is to feed the entire page through my server. So I load the page and I change all the href values from som...

SMF and PHP memory usage file upload

I'm helping out in a forum that runs on SMF. The site has been lagging recently and our host tells us it's the file uploads that clogs the servers memory and that SMF is using server memory in a non optimized way. There's probably one file upload every hour at most so the load isn't that high. Any thoughts on this? I don't know php to t...

PHP: filter_var sanitization secure enough?

I have a PHP script with the following line: $query = "SELECT * FROM products WHERE product_id='" . filter_var($_GET[id], FILTER_SANITIZE_NUMBER_INT) . "'"; Is this safe enough? How would you improve this code? ...

virus problem in home page

i have recently maked a site which if i open that in chrome it gives me a malware protection error and if i open it in ff or ie it gives me to install Java plugin, but i haven't add any java applet to home page and not any maleware or trojan on home page why it is showing it to me...... please let me know how can i check my html code fo...

mysql order by issue

if i have a query like : SELECT * FROM table WHERE id IN (3,6,1,8,9); this array of the ids is build in php dynamically , and the order is important to me. $my_array = array (3,6,1,8,9) ; how can i sort the results by the order by which the elements appear in my array ? its possible to do it in MYSQL query, or i must to order it...

UCS2/HexEncoded characters to UTF8 in php

Hi Guys, I asked a question previously to get a UCS-2/HexEncoded string from UTF-8, and I got some help from some guys at the following link. UCS2/HexEncoded characters But now I need to get the correct UTF-8 from a UCS-2/HexEncoded string in PHP. For the following strings: 00480065006C006C006F will return 'Hello' 06450631062d0628...

downloading file from web page using php

Hi, My situation is when user enter the keyword associated with the video file and press enter.Out put is alll the details regarding video file which has match with the key word from MySQL DB.Now here I have stored video file in the server location and stored path of the video file in Mysql database. When user click on the name of the vi...

Retrieving session variables in php

I have a problem in retrieving a session variable in php. While I am using the session variable in the drop down list, when I echo the values I can receive the value but when I use them in query there is no output. Can you guide me? ...

Question related to 404 and PHP

So I'm using a single entry point found in a previous question of mine: http://stackoverflow.com/questions/1712973/how-to-include-config-php-efficiently/1713000#1713000 We all know what 404 errors is, so no explanation needed there. However, when using the single entry point index.php?page=pokemon, it doesn't go to the 404 page when try...

Failed to write session data

Hi, I received this message after long time of using the same application without programming changes: Warning: Unknown(): write failed: No space left on device (28) in Unknown on line 0 Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on ...

How to check if a file has access denied and how to give rights(777) to a file in php?

I am working in php on ubuntu. When I use any image on web page which has denied access, there is warning on page. I want to check it before displaying and if it does not have rights to open then give it access to open. As we do in terminal command. chmod 777 myimage.jpg How to check this and give full access to a file in php. Thanks...

Unit Test in Zend Studio succeeds but fails via CLI

The following UnitTest fails, when executed via Command Line and succeeds when run through Zend Studio. This should not be the case, because assertArrayHasKey expects the second argument to be an array and the method signature contains a type hint to ensure this (which is why it fails via CLI). This is the test case: class AssertArrayH...

mysql *server* protocol implementation for PHP

hello, there are already some applications available which "understand" the mysql protocol and to which it's possible to connect using a mysql client -- for example: you can connect to the sphinx search engine using the (an) mysql client, mysql-proxy understands the mysql-protocol, too. etc. now i wonder if there is an implementation a...

Reassign parent variable in included Dwoo template

Hello ! I have a Dwoo template - in example base.html and there is an array $data. {assign '' 'globalVar'} {* $globalVar empty right now *} {foreach $data element} {include '_partial.html'} {/foreach} ... <b>{$globalVar}</b> And here is _partial.html <p> {$element.someText} </p> {assign "$globalVar $element.someVar" 'gl...

What's wrong with this code?

What's wrong with my code? I keep getting this error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in functions.php on line 4 error reading database function gameTableCheck($gn) { $result = mysql_query("SHOW TABLES LIKE '$gn'",$db) or die ('error reading database'); //This is line 4 if (mysql_n...

How to enforce initialization of class variables without a constructor?

I have two classes: abstract Entity, abstract ClassA extends Entity, ClassB extends ClassA Entity is an generic class for all kinds of entities, such as Cars or Students. There is an static class variable called $_entity_name, which contains the exact class name of the entity in the ER diagram. The big problem: Entity can't set the va...

Need advice on how to setup this rather odd site (in Django)

I could really do with some advice here. I'm new to Django, but understand the fundamentals. Though I need some advice on how to setup this site (that's not too conventional really). I have a client who has a site that is mainly static HTML pages (alot of them) which he prefers as he does the content in Dreamweaver. Trust me, I've tried...

how to know if my users got a 500 Error?

Hi, my boss says "when I try to serf the website I get a server error... after a reload I get every thing back to normal". I think that he gets 500 error. how can I log it? I want to know when and where it happens. any ideas? ...

Quickly add + to positive strings [PHP]

Hay all, is there a PHP function which adds "+" to positive strings? i.e function(4) // returns +4 function(1.0) // returns +1.0 function(-1) // returns -1 function(0) // returns +0 Thanks EDIT: wants to take and return strings. ...