php

File encryption in php - algorithm

Hello. What is the algorithm according to you is best to encrypt files using PHP? Maximum file size which provides about 100 mb. I care about the speed of the encryption ... ...

How to echo $row["Text'] to a TextField

Using PHP I am able to query MySQL database and see the results echo using: echo $row['Text']; I would like the information to load into TextField myAnswer instead. Can anyone help? Thanks ...

Serving multiple site with one drupal (not using multi site)

Hi All, I am looking for expert advice on how to best serve multiple sites with one Drupal instance (using Pressflow 6.x). Let's consider the company needing this is called "ABC Group of Companies" and it has 3 sister concerns. So, altogether there will be four sites: www.abcgroup.com www.company-a.com www.company-b.com www.company-c....

Best script (PHP/JS) for pop-up accept/deny license agreement?

Hello! I'm looking to create a Pop-up Agree/Deny User License Agreement when people visit any page on my website. Using Magento, if it helps at all. What I'm looking for: Never pop-up's again after user clicks Accept (To prevent pop-up everytime user clicks a link.) Visitor cannot access website until clicking Accept. If visitor clic...

How do I remove content between X and Y using preg_replace?

What would the regular expression be for removing any content between a quote, and the directory "uploads/"? Using a regexpression generator, I get this: (?<=\=")[^]+?(?=uploads/) $block_data = preg_replace('/(?<=\=")[^]+?(?=uploads/)/g','',$block_data); But seems to be removing everything :( ...

How to prevent PhpStorm to save file on exit without prompt ?

Hello, Consider this situation...You're just making changes to few files at once. The code isn't completed yet and the phone is ringing... Then you have to close PhpStorm, turn off your computer and hurry because something important happened. Then after one week you'll come back, launch your phpstorm and notice that everything you wrot...

Postgres/PHP PDO::PDOStatement->bindParam() to character(1) field

I have code similar to the following: $data['someField'] = (isset($_POST['someField'])) ? 'Y' : 'N'; $stmt = $db->prepare("INSERT INTO public.someTable (someField) VALUES (':someField');"); $stmt->bindParam(':someField', ($data['someField']), PDO::PARAM_STR, 1); $db->beginTransaction(); $stmt->execute(); $db->commit(); The field is a ...

Can I cancel a Zend Controller action in the init() method?

During Zend_Controller_Action::init(), is there a way to cancel the action (so it won't be called)? <?php class JsonApiController extends Zend_Controller_Action { function init() { // try JSON decoding the raw request body if ($jsonDecodingFailed) { echo '{"error":"invalid JSON"}'; $this->...

Problem with images in my Joomla template

I created a Joomla template by creating the following files:index.php" , "templateDetails.xml","images" and "css". I installed it correctly but the images are not displayed when i am selecting the template. Anyone knows how to resolve this problem? I triple checked the paths and different settings of Joomla but i did not work ...

How do I collect the keys of all true values in an array?

This is slightly modified version of the code in the PHP docs: http://php.net/manual/en/function.next.php <?php $array = array( -1 => true, 0 => false, 1 => true ); while ($bet = current($array)) { if ($bet == true) { echo key($array) . '<br />'; } next($array); } ?> This is as close as I could get t...

Can PHP5 SOAP generate multiple namespaces?

I'm trying to send a PHP SOAP request that requires the following format: <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:S...

POST to password protected URL?

I am working on a project that requires me to POST some data to a url that requires a username and password for access. How do I build the URL so that it automatically logs into the system? $.ajax({ url: "https://xxxxxxx", type: "POST", data: "___PUT_BODY___="+file+"&file="+time, }) ...

Executing javascript within PHP

I believe it is possible to execute a java script function within PHP, but will it then remain server side as opposed to client side? Can I, within PHP, call a .js function, passing it some args, and have it return to the PHP that called it? A script I want to use returns XML, and I want to get the user inputs using PHP, pass them to t...

Best way to manage Cron job for enrollment site

I manage an enrollment website which needs some new features for our agents. What we are trying to accomplish is the following: For every 3 members and agent enrolls, he receives a gift card (email sent to administrator to mail out) For 10 enrollments in a month, the agent receives his/her marketing materials free of charge for a year ...

php - problem with displaying text around a search term

I found this bit of code on stackoverflow at http://stackoverflow.com/questions/1195947/best-practices-on-displaying-search-results-with-associated-text-snippets-from-ac However it doesn't quite do what i want. It displays the text around a given search term, but there are two problems 1) I want whole words only; 2) It doesn't limit th...

Processing incoming e-mail with PHP Script

So I'm trying to figure out how to send an email to an address for example, [email protected] and instead of the e-mail going to there it would be instead sent or forwarded to a script that I create to read the contents of the email and store the contents into a database. Any suggestions on how to do it in PHP? Thanks! ...

In Drupal, need code for siblings of current node

I'm looking for a snipppet of PHP I can drop into a .tpl (Drupal 6.1.9) that will list the sibling nodes of the current node. Hopefully that's enough information, but here's the nuts and bolts: By "nodes" I mean that I've got everything in the "Primary Links" menu. I'm only interested in the hierarchy defined there. By "node" I als...

How to convert string like "\u0131" , "\u011f"

Hi, I get string in php script. like "A\u011fr\u0131" how to conver it to normal string with umlauts ? ...

Help with images and arrays

I have an assignment for school call Poker game. I have to deal a random card of five using HTML. I also need to have an array to deal the cards. My main question is can you have images in an array and if so how can it be done? I tried this method: $my_array = array(img src="2Spade.gif", img src="2Club.gif") but this is incorrect! Ca...

PHP: How do I add a parameter to an object reference?

I have an object called $object formed as follows: stdClass Object ( [PLAYER_ID] => 141 [STATUS_ID] => 16 [LOGIN_NAME] => mikemo21 [EMAIL] => [email protected] [PT_BALANCE] => 13775 ) I'd like to add a parameter to this, perhaps so it appears as follows: stdClass Object ( [PLAYER_ID] => 141 [STATUS_ID] => 16 [LOGIN_NAME] => mikem...