php

strange quote behaviour in generated html

I am using the following code snippet to generate a html form for use in a popup window: $uploadhtml = "<form action='up.php' method='post' enctype='multipart/form-data'> <label for='file'>Filename:</label> <input type='file' name='file' id='file'/> <br /> <input type='hidden' name='pk' value='".$pk."'> <input type='hidden' name='usern...

PHP Class Name Conflict

I'm attempting to mix a PHP REST framework (Recess) with an webapp building framework (VCL4PHP), they unfortunately like to name their classes the same. Cache, Application (probably others, but I gave up at Application). Are there namespaces in PHP or any way I can get around this without rewriting one or the other frameworks or am I S...

Remove Subdomains from Form Post

How would I go about extracting just the base URl from a long string that was inputted into a form? Example: User inputs: http://stackoverflow.com/question/ask/asdfasneransea Program needs just: http://stackoverflow.com and not /question/ask/asdfasneransea What is the easist way to do this using PHP? ...

Zipping files through shell_exec in PHP: problem with paths.

I'm working on a web backup service part of which allows the user to download a zip file containing the files they have selected from a list of what they have backed up. The zipping process is done via a shell_exec command. For this to work I have given the apache user no-password sudo privileges to the zip command. My problem is, sin...

What to include in email headers, using php mail()?

Hi, When I want to send email, my codes look like these: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: me@localhost' . "\r\n"; // Email Variables $toUser = 'you@something'; $subject = "Testing"; $body = '<html><head><title></title></head><body> ...

PHP sandbox/sanitize code passed to create_function

Hello, I am using create_function to run some user-code at server end. I am looking for any of these two: Is there a way to sanitize the code passed to it to prevent something harmful from executing? Alternately, is there a way to specify this code to be run in a sandboxed environment so that the user can't play around with anything ...

PHP Class construct with three optional parameters but one required?

So basically I understand this ... class User { function __construct($id) {} } $u = new User(); // PHP would NOT allow this I want to be able to do a user look up with any of the following parameters, but at least one is required, while keeping the default error handling PHP provides if no parameter is passed ... class User { ...

How to automate migration (schema and data) for PHP/MySQL application

I have an application in PHP/MySQL. I am searching for an automated way upgrading database behind the application. I don't need to have the compatibility with older versions once it is upgraded. I have read jeff's and K. Scott Allen's articles on this. I am still not sure how to implement this for a PHP/MySQL application. Is there any...

How do I create image roll over nav buttons in Wordpress

It's easy enough in Wordpress to create a nav bar based off wp_list_pages and wp_list_categories. But these output text, and you can't effect each output li in a different way. I know I can manually create the nav bar, but is there a good way to replace the wp_list_ output with images? ...

PHP SQL Wrapper

Anyone have suggestions on wrappers for SQL within PHP? I've been using ezSQL, which is awesome, but wanted to see if anyone had any other suggestions. ...

PHP character encoding problems

Hello guys. I need help with a character encoding problem that I want to sort once and for all. Here is an example of some content which I pull from a XML feed, insert into my database and then pull out. http://pastebin.com/d78d24f33 As you can see, a lot of special html characters get corrupted/broken. How can I once and for all sto...

Simple PHP form: Attachment to email (code golf)

Imagine a user that would like to put a form on their website that would allow a website visitor to upload a file and a simple message, which will immediately be emailed (ie, the file is not stored on the server, or if it is then only temporarily) as a file attachment with the note in the message body. What is the simplest way to accomp...

Am I using Yfrog's API correctly to make a HTTP request with POST data?

I am trying to use YFrog's API. I think I am using it correctly to try and send a HTTP POST request that is of content type XML. However, as the response body, I am always getting a 404 error for some reason. Here is their API: http://yfrog.com/upload_and_post.php Here is my attempt of PHP code to upload. $data = array('media' => 'htt...

Help with search coding please.

I am doing a project where I want a person to enter the name of any artist/band into a text box where it will seach my mysql database for the event information and display the results/content on another page. The code below is within my index.php where it should get the information from search.php (below also). I've looked all over and I...

How do you change a text variable to an int in PHP?

I have a variable that is definited by a POST call from a form where it is inputed into a text field. Is there any way to convert this variable to an interger? From the form: Lenght: <input name="length" value="10" type="text" id="lenght" size="2" /> From the php code: $length = $_POST['lenght']; $url = substr($url, 0, $length); ...

PHP Errors on a cronjob, works fine at prompt.

I am running the following script on a cronjob... cd /etc/parselog/ php run_all.php >/dev/null and am getting the following errors: [05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0 [05-May-2009 20:30:1...

is it possible to decrypt encoded php by ioncube?

is it possible to decrypt encoded php by ioncube? ok here is more information on my project. i had posted it here but for some reason the admin said its not a real question http://stackoverflow.com/questions/824547/are-ioncube-decoders-real-closed i really need to know the answer to this question, and what my options are. to refrase ...

why does drupal append ?1 to my css file links

My designer noticed that in the source for a drupal site, all the .css files were getting appended a ?1 that he was concerned would break things. Why is it doing this? <link type="text/css" rel="stylesheet" media="all" href="/modules/modules/node/node.css?l" /> <link type="text/css" rel="stylesheet" media="all" href="/modules/modules/sy...

Suppress the default template from a view with CakePHP

I'm doing some experimenting with AJAX in CakePHP and it seems to work except that the view that gets returned includes the default template. How can I get rid of that (or even just specify a different empty template for a view)? ...

PHP/SQL Database querying good practice and security.

So I'm a slightly seasoned php developer and have been 'doin the damn thing' since 2007; however, I am still relatively n00bish when it comes to securing my applications. In the way that I don't really know everything I know I could and should. I have picked up Securing PHP Web Applications and am reading my way through it testing thing...