php

PHP HTML Entities

I want to display on screen data send by the user, remembering it can contain dangerous code, it is the best to clean this data with html entities. Is there a better way to do html entities, besides this: $name = clean($name, 40); $email = clean($email, 40); $comment = clean($comment, 40); and this: $data = array("name", "email," "...

PHP: Escaping RegEx-reserved characters - anyone know what's wrong with this?

I'm trying to escape regex-reserved characters with a backslash (don't ask -- suffice it to say I'm NOT trying to parse HTML :) ) And I'm getting something odd. $regex_chars = array('[' , '\\' , '^', '$' , '.' , '|' , '?' , '*' , '+' , '(' , ')'); $regex_chars_escaped = array('\[ ' , '\\\\ ' , '\^ ', '\& ' , '\. ' , '\| ' , '\? ' ...

C# socket problem

I am creating a socket server in C# and a client in PHP. The conversation between client and server is something like this: client connects server sends welcome message client sends data server sends response (repeat step 3 - 4 until client disconnects) It works until step 3. The data from the client is received by the server. Howeve...

Managing big applications with CakePHP

Hey guys! I have an application here that is growing bigger and bigger. The address is this: www.aquitanda.com [brazilian portuguese]. Basically, it's a website where you can buy and sell stuff on your own, which means people can create their own webstores. I have, for this project, 4 big "interfaces". One of them is the commom interf...

PHP logon / logoff design question

I am thinking of implementing a small tracking system that will track users logon / logoff times and also track who is currently logged on. It all makes sense to me except for the tracking of when a user logs off. Its easy enough when a user clicks a "log off" button which calls a function that can update the database with the logoff tim...

call a php controller with ajax (how to disable layout)

Hello, I will explain more, because it might not be clear enough I want to set the ajax url to: www.domain/controller/method I already have everything in place for this with normal php. But if I have to do this with ajax, I am not getting the intended result. The result should be some json variable being echo'd back to me. It is not e...

PHP example for PayPal Adaptive Payments ConvertCurrency API

Trying to wrap my head around the new PayPal Adaptive Payments API - specifically the ConvertCurrency functionality. Has anyone had any luck with this in PHP? Documentation: https://www.x.com/docs/DOC-1400 ...

Is it possible to use AES with an IV in ECB mode?

From http://php.net/manual/en/function.mcrypt-encrypt.php, I saw the following codes using AES with an IV in ECB mode, <?php $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = "This is a very secret key"; $text = "Meet me at 11 o'clock behind the mon...

Video editing using PHP

Is it possible to record a voice onto the uploaded video using PHP? ...

Jquery get all input values and create an array (with names)

Hay guys, I'm doing some work where i have a large collection of forms. Seems these aren't 'posted' the traditional way (i.e using a submit button). I need a way to collect all the names and values of all form data when clicking a link (document.location is then used for redirects). I want names to stay intact so that i can used a simpl...

PHP - OOP - Storing big objects to be saved in session

I'm trying to set up a new class for my web application, rewriting my code starting from original procedural programming. Since I need to populate my object using many different(complex) queries, and this object'll be stored in session, I decided to create another static class containing all long queries. Is it more convenient to define...

[PHP 4] Same session variable for different systems

Hello, i have a huge problem with a system i have been assigned to maintain. In reality it is many systems over an intranet. The problem is, the original programmer created many systems for the intranet which all of them connect to the database through a script, where the user name, pass,db params,etc are stored in $_SESSION variables....

Is it possible to protect from downloading a video from a site.

Hi, Is it possible to protect a video from a site from being downloaded? While users could record a video by using some hardware device, it should not be possible to download a video using some link - exactly like google videos. For example, if I have Real One Player in my system, I have an option to download the video; this should be...

Generating word stacks from arrays

I'm trying to do a simple word cloud exercise in PHP but with little twist. I have everything else done but I can't figure out how to do a loop that combines the words. Here's example that will make it little bit easier to understand what I'm trying to do: I have array like this: $arr = array('linebreak','indent','code','question',...

PHP SoapClient request

I'm trying to send a SOAP request to a newsletter service using this WSDL: dev-service.go.mayoris.com/wcf/SubscriptionService.wsdl?wsdl Here's my PHP: $client = new SoapClient($wsdl_url, array( 'login' => 'myusername', 'password' => 'mypassword', 'trace' => true )); $client->AddSubscriber( new SoapParam('MyFirstName',...

Running jQuery command from modal window to affect main page

Hi all, I'm currently trying to write a jQuery script which opens a modal box then (upon user entry) changes a value on the original page. Currently I've got the script working on just the page itself (without the modal), but when I try to run the command from the modal the value on the main page doesn't change? Does anyone know how I...

htaccess 404 error redirection for /cat/sub/.html like urls

Hi friends, How can I redirect such link (below) to 404 error page? http://www.blabla.com/category/sub/.html I generate a SEO friendly links, normally products has url like blabla.com/category/sub/product.html the page doesnt give any error. it just display blank content. I mean i can see static texts like CATEGORY NAME header a...

Float not correct in MySQL

Hi, I am entering '35444650.00' as a float into my MySQL and it keeps reformatting to 35444648.00, any help welcome... ...

Invalid PHP JSON encoding

I'm working on a project in PHP (5.3.1) where I need to send a JSON string to a webservice (in python), but the result I get from json_encode does not pass as a valid JSON (i'm using JSLint to check validity). I should add that the structure I'm trying to encode is fairly big (13K encoded), and consists partially of UTF8 data, and while...

PHP/MySQL - Storing array in database

Hi, I'm working on a PHP app which requires various settings to be stored in a database. The client often asks if certain things can be added or changed/removed, which has been causing problems with the table design. Basically, I had a lot of boolean fields which simply indicated if various settings were enabled for a particular record...