php

Starting screen from PHP to execute intensive Java application

Hello, I am wondering how to start a screen session from PHP, I have tried with shell_exec(), system() and passthru(), but no avail. I have gotten the screen session started for the execution time of the script, but after it has finished loading, it kills the screen session it just created. (By starting a screen session and executing '...

stubs, dynamic homepage in cakePHP

Hey everyone. I'm working on a site for a client that wants to be able to update modifying their content. The brief was to allow them to edit pages, but not create or delete them. For the site I decided to work with cakePHP, as I've heard good things. First up, a quick explanation of my setup. I've got a single table, called 'contents'...

Unify variable types of array elements

After hours of debugging, I found an error in one of my scripts. For saving different event types in a database, I have an array of unique data for each event that can be used to identify the event. So I basically have some code like $key = md5(json_encode($data)); to generate a unique key for each event. Now, in some cases, a value...

HTML select tag

How to specify each option at a select tag?,using which attribute (name,id,....)? and how to recieve it in the server script to detect which option is selected? ...

Grab And Format XML Data From PHP File As JSON

Hi, I'm writing an app currently that uses the ExtJS framework. I'm pulling an XML feed from an external site using cURL, loading as simplexml, json_encode-ing it, and writing it to a file a .JSON file which I will later access with ExtJS data store. However, the formatting is becoming funky because the XML generated from the PHP fi...

MYSQL insert string from html's text area with semi-colon...advise?

Hey ya guys This is in regards to PHP, Mysql and Html's textarea. I want to dump a user's input from html's textarea into my mysql database. The situation is that if the user has semi-colons within the text itself, mysql will reject the insert command for obvious reasons. What I want to know is that are there any ways to force mysql to...

PHP MySQLi Stored Procedures return call

I cannot figure a way to retrieve the return variable in PHP. It works just perfect in MySQL, but this from PHP doesn't for some reason. '; if ($this->multi_query("CALL testOut(@outvar); SELECT @outvar;")) { do { if ($result = $this->store_result()) { ...

Debugging PHP SOAP call

Hi folks, I am new to SOAP and dealing with a web service where it would seem no one has interfaced using PHP previously. They have no example code excepting C# but I do have that. eServices.asmx provides WSDL if that is the correct way to say that. The error that I am getting is "Server did not recognize the value of HTTP Header SOA...

receive and parse mails on the server via php

Hi, maybe mine it's a bit a simple question; I would like to instruct my server to receive mails and to parse them via a php script. How can I do it? Thanks ...

Form submit: I want a modal instead of a redirect

I have a form in Wordpress. When it is submitted, the page redirects to another page. But I want the page to stay the same, and for a modal to appear instead of a page redirect. The following code is from the functions.php file that handles the form submission. I'm not sure if this where I would introduce a modal. But this is where the...

Recomendations for PHP & MySQL Statistics Reporting for a WebApp

background: I have 'inherited' a php webapp in my small company and after years of nagging have finally gotten the go to throw away the spaghetti code and start again. We want to log every action that is made in the system for example: user X viewed item Y user X updated item Y new item Y on city Z and later provide graphs on diffe...

Is there a definitive anti-XSS library for PHP?

I already know how XSS works, but finding out all the many different ways to inject malicious input is not an option. I saw a couple libraries out there, but most of them are very incomplete, ineficient, or GPL licensed (when will you guys learn that GPL is not good to share little libraries! Use MIT) ...

security and mail() function in php

Hi, I'm using mail() to send simple mails. For convenience, i'm using a header to set a "from" address. I wonder, I can put whichever address there and pretend to be anyone; I tried just towards myself for curiosity and actually it works! Is this normal? It's the correct way to use the mail function? and is there any way to recognize the...

allowing only 5 words on input php?

i want to know how i can allow only 5 wword on text input using php? i know that use the strlen function for character count, but i was wondering how i can do it for words, thanks :)) ...

How can I encypt a string in PHP, and decrypt it in Java?

I am looking for a very basic encryption that is built into both languages where I can encrypt a string in pHP, and be able to get the data back out in Java. So it cannot be things like MD5. ...

PHP and MySQL: Formatting URLs correctly when using pagination to display images of multiple galleries.

I've set up a simple gallery system in PHP that is built to display one image per page. My URL parameter simply uses a gallery variable and a page variable and does not use the image iD in any way to pull the image. This is because I'm setting my htaccess settings to make a friendly URL: http://mysite.com/images/1/ ^ Would pull the ...

PHP array: count or sizeof?

To find the number of elements in a PHP $array, which is faster/better/stronger? count($array) or sizeof($array) ? Edit Thanks to Andy Lester, I have refined my question to mean from a multilingual perspective. The manual commenters say "[sizeof] does not mean the same in many other languages based on C" Is this true? ...

PHP Scripts Unresponsive After 120 Seconds

This one really has me stumped. I have not ran across this problem on any other servers I have worked on. This is on an Ubuntu 10.04.1 LTS server with PHP 5.3.2-1ubuntu4.5. When I have a PHP script that does not have any output for over 120 seconds, the script will not show any subsequent output; however, any non-output will still be e...

Good Ajax book for a PHP guy?

I have a background in assembly, basic, pascal, ada, c & c++. All pc or embedded stuff. Decades of it. I also have a few years of PHP. I haven't coded any client-side stuff, and think that I would like to look into Ajax (is that the best compliment to PHP?). What's a good book to start me off? ...

What is essential in protecting API from abuse?

Just wanted to learn what steps should be taken to prevent API from abuse... ...