php

Drupal menu with submenus only shows submenu of current page. NOT a CSS problem

This is not a CSS problem. The HTML isn't there. I need the menu, with submenus to exist in HTML on EACH page. Right now, the submenu only exists in HTML for the submenu related to the page being currently viewed. Here's an example of what it SHOULD be like. <ul id="menu"> <li>Page1 <ul class="sub"> <li>sub1.1</l...

Database, Jquery, Ajax and Zend Framework. How to use all togheter?

I have a form rendered in the view which action is setted to the same page /index. <form action="" name="formRegistro" id="formRegistro"> and a JQuery function which is called when the form is submitted $('#formRegistro').submit(function() { // Retrevies data from the form data = $('#someInput').val() //Execute AJAX $.get( ...

How do I add paths to the Apache PATH variable?

I've set in my custom.conf file in apache2 this: SetEnv PATH $PATH:/opt/local/lib/mysql5/bin:/this-is-a-test However it's not working. When I call: $hey = shell_exec('env'." 2>&1"); var_dump($hey); I get: ... PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local...

Dynamic status bar image creation in php

I am new to image creation in php. If you change the param value, bar progress should also be changed to passed value How can i implement something like that? I would be grateful if anyone can shed some light Thanks for the help inadvance UPDATE: I figured it out myself, thank you Greg and all for the suggestions ... please test t...

CakePHP - Sorting using HABTM Join Table Field

Hello Cake Gurus, here's my problem: Table1: Posts id - int title - varchar Table2: Categories id - int name - varchar HABTM JoinTable: categories_posts id - int post_id - int category_id - int postorder - int As you can see, the join table contains a field called 'postorder' - This is for ordering the posts in a particular cat...

How to diganose an unlogged Error 500 on Apache?

We are running a very simple Symfony script, that randomly returns an Error 500. The system administrator says he can't find any trace of an Error 500 on the error logs, however using Curl or Firebug, it is obvious that an Error 500 is being returned. The script simply parses a POST request submitted to an URL on our server. We already...

PHP: How to overwrite values in one array with values from another without adding new keys to the array?

I have an array with default settings, and one array with user-specified settings. I want to merge these two arrays so that the default settings gets overwritten with the user-specified ones. I have tried to use array_merge, which does the overwriting like I want, but it also adds new settings if the user has specified settings that doe...

Type conversion between PHP client and Java webservice

I have a web service implemented as EJB. One of its methods returns Map<String,String>. On client side I use php : $client = new SoapClient($wsdl,array("cache_wsdl"=>WSDL_CACHE_NONE)); $result = $client->foo($params); Everything works fine, but I would like $result->return to be an associative array. Now it looks like array(10) { [...

How to update multiple rows with one single query

I use Postgresql + PHP. Say I have this table: Books ( id, title, year ) and this array of titles in PHP: $titles = array ("bible","kafka","Book of Eli"); now I want update all rows where the title is in the $titles array above. So I need a query like this: UPDATE books SET year = '2001-11-11' WHERE title is in $titles; Is is ...

PHP: Using a method as a callback

I was trying to use array_walk_recursive for something, and wanted to use one of the class' methods as the call back, so trying: array_walk_recursive($TAINTED, "$this->encode()"); and variations thereof all failed. I eventually settled for: array_walk_recursive($TAINTED, 'className::encode'); which works, but I've read on here th...

How to remove htmlentities() values from the database?

Long before I knew anything - not that I know much even now - I desgined a web app in php which inserted data in my mysql database after running the values through htmlentities(). I eventually came to my senses and removed this step and stuck it in the output rather than input and went on my merry way. However I've since had to revisit...

php cURL. preg_match , extract text from xhtml

I'm trying to extract the price from the bellow html page/link using php cURL and preg_match . Basically I'm expecting for this code to output 4,550 but for some reasons I get Notice: Undefined offset: 1 in C:\wamp\www\test.php on line 22 I think that the pattern is correct because if I put the html itself in a variable and escape the...

How to deny payment via PayPal IPN?

Hello all, I need to create dynamic 'Pay Now' buttons on my site, and PayPal says the way to do this is via an HTML FORM with preset variables for the price, currency, and item of the purchase. I use PayPal IPN to notify me when a payment has complete. However, what's to stop someone from modifying the query parameters of the Pay Now ...

$_SERVER['HTTP_REFERER'] not working with Header

I have a site that allows public access to some pages, but requires a login for others. I have a link to the login from all pages, and what I'd like to do after a successful login is send the user back to the page they were on when they clicked the login link. I know the HTTP_REFERER can be spoofed, and sometimes stripped out by certain ...

mysql fetch error

<? $res = $database->userLatestStatus($u); while($row=mysql_fetch_assoc($res)){ $status=$row['status']; echo "$status"; } ?> This is the code on my page, which is throwing up the following error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource.... The database fun...

How effective can this Tagging solution be?

Im working on an image sharing site and want to implement tagging for the images. I've read Questions #20856 and #2504150 I have few concerns with the approach on the questions above. First of all it looks easy to link an image to a tag. However getting images by tag relation is not as easy. Not easy because you will have to get the im...

Survey on logging classes / frameworks / writers

I am curious what writers (handlers, loggers) are you using. Text file and db its quite obvious, but what are other possibilities ? Firephp maybe (as in Zend_Log), mail, jabber, url ? Is anyone using syslog() or error_log() ? Are you using streams (especially custom ones) ? Are you using custom error levels or you limit yourself to pre...

How to execute PHP code from within javascript escape/unescape ?

<Script Language='Javascript'> <!-- document.write(unescape('<?php if ( ! defined('PROJECTNAME')) exit(''); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; </body> </html> ')); //--> </Script> I did not copy paste the whole code. There is more PHP code w...

In PHP how do I complete a regex that returns only what was grouped

I want to perform a regex using grouping. I am only interested in the grouping, its all I want returned. Is this possible? $haystack = '<a href="/foo.php">Go To Foo</a>'; $needle = '/href="(.*)">/'; preg_match($needle,$haystack,$matches); print_r($matches); //Outputs //Array ( [0] => href="/foo.php"> [1] => /foo.php ) //I want: //A...

PHP all word date

I want to express the date in PHP as "May Fourteenth Two-thousand and ten", any ideas? Extra but not necessary would be the time like "Eight forty-eight PM"? ...