php

User View Profile

Hi All, I am building an application for my client and I am not using any frameworks . Question came up when building viewing user profile My client wants to see the user profile URL like mywebsite.com/Johnd - should give Johnd profile mywebsite.com/KJohns - should give KJohns profile I have implemented URL mapping like http:/...

Magento Error: Headers already sent

I got this error while adding products to the cart in my site: Cannot send headers; headers already sent in /home/website/public_html/app/code/local/Perpetual/MultiAdd/controllers/Checkout/CartController.php, line 153 Trace: #0 /home/website/public_html/lib/Zend/Controller/Response/Abstract.php(147): Zend_Controller_Response_Abstra...

Dojo not fully starting with ZendFW

Hello, I have a very strange problem with dojo not loading properly in one action in one of the controllers in my application (it seems to work just fine in the other actions). I've been trying to sort it out, and it appears that in the action that its not working it fails to generate the following code that's present in all the other a...

PHP mail() errors: Hide attempted email but still show error

I am working on a 'forgot password' form, currently I am working locally so the mail function will not work but the errors come up like this: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in ... on line 508 Error Sending Em...

Merge two (or more) arrays and keep values that are highest?

I've got a permissions/group based setup that I'm trying to merge results on. For example, a user might be associated with four groups: | username | passwd | email | groups | | test_user | 9agb9 | [email protected] | g1, g2, g3, g4 | grouping table: | group | perm1 | perm2 | perm3 | perm4 | perm5 | perm5 | perm7 | | g1 ...

How multiple select to create a new row?

I have this code: <select name="team[]" size="8" multiple="multiple">$team</select> It lists for example players in that team, I want when user clicks on player it creates a new row where I can input basic info about player which I will add to database via php. ...

File Handling using PHP

Can anyone tell the method to modify/delete the contents of a text file using PHP ...

PHP: question about preg_replace()

Hi, i have found this: $text = preg_replace('/\W+/', '-', $text); Anyone can tell me what exactly do that? There is no information about what '/\W+/' means.. Regards Javi ...

Auto Transfer of logs from server to server

Hey, I was wondering how to use php to do an auto transfer of log files weekly from one server to a cloud account. I have all the passwords and what not, I am just confused on how to set this file up. As a site I am running stores log files, we are trying to "push" them weekly to our cloud storage. Any help would be appreciated. ...

How to interface with PKCS#11 compliant HSM device in PHP

How can I use key material from a PKCS#11 compliant HSM (for example a SafeNet iKey 2032 [USB] or a Aladdin eToken PRO [USB]) in PHP application running on a Linux server? ...

Trigger PHP Script on New Email (Google Apps / Gmail)

Is there any way to trigger a php script when a new email arrives on Google Apps (Gmail)? I've figured out a way to poll the inbox to look for new messages, but I'd ideally like a more event-based solution. Basically I need it to be run from a server somewhere which would parse new email messages and process itself according to the con...

Dynamically Create Instance Method in PHP

I'd like to be able to dynamically create an instance method within a class' constructor like so: class Foo{ function __construct() { $code = 'print hi;'; $sayHi = create_function( '', $code); print "$sayHi"; //prints lambda_2 print $sayHi(); // prints 'hi' $this->sayHi = $sayHi; } } $f = new Foo; ...

Does PHP's HTTP class support javascript?

Hello, In regards to Can a PHP Proxy call Javascript functions like a click I'm investigating a solution that involves using PHP's HTTP class to simulate a client's browser. Does anyone know if the PHP HTTP class supports javascript functions? Can you recommend any others that do? Thanks! ...

what else should also learn with PHP

I have started learning php recently, and I am loving it. I have a background in c, c++ and java. I want to know what else should I learn along with it, which can add value to my knowledge. ...

PHP has encountered an Access Violation at 77FCAFF8

I am running a PHP site that uses Ajax and jQuery as well. The site will run fine for quite some time, and suddently my pages (and ajax-retrieved sub-pages) comes back with the message PHP has encountered an Access Violation at 77FCAFF8 It seems that rebooting the server corrects the issue. Running PHP Version 5.1.6 (Windows NT 5....

"Remember me" functionality in Code Igniter

Its been a few months since I've seen any questions regarding this, but I wonder if anyone yet has found a solution / written a helper / model to solve this dilemma inside Code Igniter, rather than stray outside of its built-in sessions. Essentially, a login form is provided for the user, where they will enter their username or e-mail a...

Dynamic functions, variable inputs

Right now, lets say I have code much like this... $some_var=returnsUserInput(); function funcA($a) {...} function funcB($a,$b) {...} function funcC($a,$b,$c) {...} $list[functionA] = "funcA"; $list[functionB] = "funcB"; $list[functionC] = "funcC"; $temp_call = list[$some_var]; //Not sure how to do this below, just an example to show...

Convert utf8 to latin1 in PHP. All characters above 255 convert to char references.

I need to convert text in UTF-8 into text encoded in ISO-8859-1 such that any character that are not part of ISO-8859-1 set would turn into character references. (ex &#946;) Example: I want to turn text like hello é β 水 into hello é &#946; &#27700; I am doing all this in PHP. I tried built-in functions, iconv, and tidy and combina...

Fetching a PDF file using SOAP and PHP

EDIT: THIS QUESTION IS INVALID SINCE THE SERVER I'M USING HAS SUDDENLY EXPIRED. PLEASE IGNORE I'm new to SoapClient in PHP, and I'm trying to fetch a PDF by passing three parameters and grabbing the result. Here's the WSDL file I'm working with (I don't really have much/any control over this part): <!-- this WSDL file was automatically...

How would I encrypt my php files so only a person with a key could access them?

I've done a project for a client and as part of the deal since they couldn't afford much we agreed that I own the code. however the server is in their name and they could go and steal the code. How would I avoid that? I would like only apache and me to be able to read the files! Any alternative solutions will be appreciated! ...