php

acessing PHP variables in javascript

OK, so I'm not a programmer so please don't beat me up too much... I have a situation where I have some javascript (for jqgrid) that I would like some of the values to be populated from a PHP variable. What I did to get around this is to use PHP and put all the javascript code within a 'here document'. All looks to work well but I tho...

Drupal Exclude taxonomy listing pages from search.

I have a Drupal 5 site that needs to have has taxonomny listing pages excluded in the search results. For instance http://site.com/category/role/guest-speaker returns a listing of all of the nodes tagged with guest-speak in the vocabulary role. I tried Advanced Search module. This just prevents searching for terms. I then had a hunc...

How to get Id name with jquery and pass to php script?

Hello, I have been trying to get the id of a button(in this case a link) with jquery and send the id or class name to a php script so I can enter that id or class name in a sql query. I thought that this would be the easiest thing to do, but it has turned out to be the most difficult thing since nothing seems to work. I have on one pag...

In PHP xmlparser, why can't I store a global from my character_data_handler()?

(or Here are the code essentials: $host = ""; ... xml_set_character_data_handler($xmlparser, "tagContents"); ... function tagContents($parser, $data) { global $current; global $host; if ($current == "HOST") { $host = $data; // Trying to store a global here } if ($current == "PATH") { echo ...

What is the MessageFormatter Class in PHP 5.3 good for?

With PHP +5.3 and 6 comes a couple new i18n classes. One of them is the MessageFormatter Class which seems to be an incomplete idea. I'm hoping I'm just overlooking something. The example given seems to show that if you ALREADY KNOW THE LANGUAGE YOU ARE USING, then this class will format the numbers for you correctly. <?php echo msgfm...

Can someone explain this code snippet in PHP?

preg_replace(array('#/(.?)#e', '/(^|_|-)+(.)/e'), array("'::'.strtoupper('\\1')", "strtoupper('\\2')"), $text); I've never used regex this way,how does it work? ...

Pretty URL to string parameters

I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2 I plan to have pretty url to transform the previous url to : /profile/whatever/2 I know I have to use .htAccess and to redirect everything to index.php. That's fine. My problem is more in the index.php (Front Controller). How can I build back the ...

any php function to send email without mail()

i am using mail() function to send email from PHP without any authentication. This function only work on my web server, but does not work on a local machine. I am looking for best PHP function to send a email with authentication which would work on any machine without modifying the php.ini i am using PHP with IIS and windows thanks...

Use PHP to download a .gif from a URL.

How? I think I've done this with .PDFs at one time in the past, but I lost the code, and now nothing is turning up on the web about how to go to a URL, get a .gif and copy the .gif file into my directory. Thanks for any help. ...

Choosing between java or php for GWT!!

For my new heavy database read application ,i need to use GWT and mysql. But in choosing between java and PHP,i have some confusions, 1)JDBC with mysql is slower than PHP with mysql (PHP won) 2)if am going to use PHP ,i have to use JSON for transferring data between server and client. 3)This json parsing and handling overhead can be easi...

database transaction rollback processing in PHP

try { $con->beginTransaction(); $this->doSave($con); $con->commit(); } catch (Exception $e) { $con->rollBack(); throw $e; } The code above is quite standard an approach to deal with transactions, but my question is:what if $con->rollBack() also fails? It may cause db lock,right?If so,what's the perfect way to go? ...

General guidelines for parsing name=value pairs from a long user-input text string

I'm developing a system (in PHP) that will take in a string of text (from email, initially) and need to determine the beginning and end of a section of the text that contains name=value pairs of data, and parse that section so that the name=value pairs can be processed into a form submission. I am looking for ideas on what to use as deli...

Get content from XML PHP5

Hi, I´m working on a paymentsolution and need some help with the PHP. I´m doing a HTTPRequest and in response I will get some XML. The XML Could look like this: <?xml version="1.0" encoding="utf-8" ?> <payer> <purchase_list> <freeform_purchase> <line_number>1</line_number> <description>d...

Need php form to name which required fields have not been filled out.

My php form has required fields, but the message does not let the user know which field hasn't been entered. How can I do this? //if statement to check required fields if ($name && $phone && $email && && $address && $city && $state && $zip && $month && $date && $year && $contact)... //if some required fields were not filled out ...

Get crypt() Blowfish results in PHP 5.3 identical to those generated by PHP 5.2

Is there a way in PHP 5.3 to get crypt() blowfish (salt starting with $2a$) results identical to those generated by PHP 5.2? In 5.3, Zend implements all encryption algorithms internally, thus producing different results. Also, in 5.3, blowfish needs a cost parameter. Basically, is there a way to call whatever system mechanisms were used...

Dynamically set TinyMCE file path for file browser and image viewier using PHP

I am using tincymce as the content editor and file manager in a PHP admin area. How can I change the file path dynamically so that I can use one instance of the editor for different organized functions? I can easily pass a variable to the tinymce.init configuration, but I am not aware of and can not find a configuration option for the f...

How can I use CSS to set as my <li> background if I'm using the Zend framework?

Everything else 100% works, so I'm 100% positive the error lies in the file path I'm using for the image. The image doesn't load. Either A) I need the file to appear in the Zend workspace, how do I do that. or B) My path is wrong. Here's my file heirarchy: And here's my CSS code: #nav-menu li{ float: left; margin: 0 0....

Exceptions in native PHP functions

Hi guys :) Most functions in PHP returns true/false: var_dump (is_int ("1")); // false Can I configure PHP to return exceptions instead of boolean ? try {is_int ("1")} catch (Exception $e) {exit ($e->getMessage ());} Thanks. ...

Find if number is between two numbers in different fields in a MySQL database

How would you format a query on a MySQL database via PHP to find if an IP address falls between two numbers in two different fields? Numerical representation of IP address to find: 1265631252 Database format: IP FROM IP TO REGISTRY ASSIGNED CTRY CNTRY COUNTRY "1265631232","1265893375","arin","1152835200","US","USA","U...

FireFox 3.6 for Mac not reading cookie / redirecting properly

Hello, I have a nifty little cookie-based home page redirection scheme going for my website. Basically, the first time a user browses to the website, they are presented with two choices (Products vs. Machining Services). When the user clicks one of the two buttons, a JavaScript function stores a cookie with the appropriate choice ("pr...