php

how to restrict PHP script with file system access?

I have a PHP script, which MAY try to access files in the directories that have sensitive data. I want to restrict such operations. I want to allow this script to access files/directories only in the directory I'm specifying. Is it possible to do? Thanks. ...

SQL result doesn't work when reassigned

The code: $msr = db_query("SELECT * FROM users WHERE username='$username'"); if (db_num_rows($msr) == 0) return null; When function db_query($query) { return mysql_query($query) or die(mysql_error() . " when querying: $query"); } function db_num_rows($queres) { return mysql_num_rows($queres) or die(mysql_error()); } Shows...

Drupal 6: template.php redirections

I haven't worked to much within the template.php file in the Drupal installation, but this time I need to theme a node form. Following an excellent guide I found at http://drupal.org/node/601646, I set up the following snippet. function amity_island_theme($existing, $type, $theme, $path) { if ((arg(0) == 'node') && (arg(1) == 'add') &...

Issues using a Fedex Webservice via WDSL/SOAP

Hi Everyone, I downloaded the sample code to request a rate from fedex's website... i placed the WSDL file in the proper location, I have my acct number, password, meter number, and key. When I run the script I get this error: Error in processing transaction. ERROR prof 1000 Authentication Failed The script they give is as ...

Having more issues with mysqli. Numerical data in results

When I do a print_r, I get a number 1 between the array blocks. I have no idea where it is coming from. This is causing errors in my log. I can fix this by testing with is_array but I want to know where this is coming from. I'm making two queries but yet I have a third array in there. What is going on????? mysqli_result Object ( [...

Passing JavaScript Array To PHP Through JQuery $.ajax

I want to manipulate a javascript array in PHP. Is it possible to do something like this? $.ajax({ type: "POST", url: "tourFinderFunctions.php", data: "activitiesArray="+activities, success: function() { $("#lengthQuestion").fadeOut('slow'); } }); Activities is a sing...

exec() or system() on doxygen command returns me "Exiting"

Itry to run this script public function execDoxygen($doxyFile) { $command = "doxygen $doxyFile"; exec($command, $output); return $output; } and the outputs is "Exiting..." if I run it separetely in a terminal with the same file it works well. If I run exec("doxygen --help") it works correctly. Why does it ...

Problem with Apache and PHP (using PEAR)

Hello! I have a problem with Apache, which restarting, when I want to open PHP code in browser. Code : require_once 'DB.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); $db_host = 'localhost'; $db_user = 'root'; $db_pass = 'marylover'; $db_name = 'test'; $dsn = "mysql://$db_user:$db_pass@unix+$db_host/$db_name"; $db = DB::connect($dsn); ...

Making reference to a fileset to another Phing build script

Here is my scenario: I have a generic phing build script to make an archived build of my application. But for some of my clients, I want to encode some php files and exclude files from the default build. My initial solution was to create a "configuration" build file for each of my clients and add two filesets like "before-encode" and "...

Uppercase Booleans vs. Lowercase in PHP

When I was learning PHP, I read somewhere that you should always use the upper case versions of booleans, TRUE and FALSE, because the "normal" lowercase versions, true and false, weren't "safe" to use. It's now been many years, and every PHP script I've written uses the uppercase version. Now, though, I am questioning that, as I have se...

optional parameters in CodeIgniter

Hi I'm trying to write a function in a CodeIgniter controller which can take optional parameters. However, I always get Missing Argument warnings. I'm not trying to suppress the warnings - I'm trying to declare the parameters as optional (maybe they could be empty strings if they don't exist, or something). What is it I'm missing? Tha...

clicking on submit button using php

Hi, I have a webpage with a submit button and I would like php to parse the webpage and click the submit button and get the response (it can be a link or another html page.) Is there any way to click a submit button using php? I know there is something like htmlunit for java that allows one to pro-grammatically fill the form fields an...

problem with php mail 'From' header

Hi, I'm building a website that sends and email to a user when he registers. My code (the gist of it): <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! \nThis is a simple email message."; $headers = "From: [email protected]"; $headers .= "\r\nReply-To: [email protected]"; $headers .= "\r\nX-Mailer: PHP/"...

Register And Login To SMF With CURL

I'm working on a website that has a forum area, I will probably use the SMF forum software for the forum. Users can register and log in on the website. I would like to achieve that when they register on the website, they get also registered on the forum (they don't have to register twice). And also when they log in to the website that wo...

using comet i-frame with jquery?

i havent found any good tutorial with code examples on how to use comet with jquery. found this link: http://www.zeitoun.net/articles/comet_and_php/start but they are using prototype. and i found a comet plugin for jquery on the jquery website but there is no documentation and i cant figure out how to use it. are there any good tutori...

A problem with passing Japanese characters(UTF-8) via json_encode

Hi, I'm having a trouble transferring Japanese characters from PHP to JavaScript via json_encode. Here is the raw data read from csv file. PRODUCT1,QA,テスト PRODUCT2,QA,aテスト PRODUCT3,QA,1テスト The problem is that when passing those data by echo json_encode($return_value), where $return_value is a 2-dimentional array containing above dat...

How to access 3rd Party cookies in the Browser ?

How to access 3rd Party cookies in the Browser ? ...

WordPress: don't show 404 when no posts exist

Currently there is a bug in WordPress if you have a Posts Page set under: Settings->Reading->A Static Page->Posts Page If there are posts, than the page (e.g. with a slug called news) displays the post, and uses index.php from the theme. But, with this configuration, if there are no posts, then it calls the theme's 404 page. Thi...

checking for existance of URL in php

Hi, I just want to know, If I display a URL link in PHP, is there anyway to check for validity after the user click so as to display him a nice custom message that the URL is broken or something like that. I do not mean error 404 page. I guess error 404 is only for internal website pages but not external links. Please correct me if I a...

PHP Bayesian Classifier

Hi All, I'm looking for a Naive Bayesian Classifier for PHP, ideally something equivalent to the Reverend Bayes version written in Python. Does anyone know of such a library? Basically I need to be able to train it with a set of labels and words i.e. GOOD = okay, happy, fun; BAD = wrong, rubbish, awful etc and then pass it a string val...