php

FPDF issue while generating pdf with images due to PHP 'allow_url_fopen' setting

Hi, I am facing a problem with FPDF while generating the PDF file with images as explained here. Finally I found the reason for this issue but I am not sure how to fix that one, can anybody suggest some good solution to handle that issue. This problem is due to the allow_url_fopen setting of my server, if I enable that setting then the...

[PHP PDO] Database abstraction class design question

Hi SO, I am in the process of designing a web app (really it's a hobby, I'm trying to teach myself design, and what better way is there than doing it :). Anyways, I was thinking about how I would deal with my database. I am comfortable with PDO and I was thinking of leveraging PDO in my abstraction class. I am thinking of making a si...

Having troubles configuring PHP to work with mySQL

I'm venturing out of the world of .NET and into the world of open-source. However, I've hit a few roadblocks while trying to get my development environment set up. And I'm kind of stuck on the most recent one. I have installed: Apache 2.2, php 5.3.2, and mySQL 5.1.48 everything is working pretty much; apache is serving up PHP pages, ...

How to convert torrent info hash for scrape?

I have a torrent hash from the magnet link. For example: fda164e7af470f83ea699a529845a9353cc26576 When I try to get information about leechers and peers I should request: http://tracker.publicbt.com/scrape?info_hash=??? How should I convert info hash for this request? Is it url encoding or becoding? how? In PHP. ...

instant message using php

is there a way to send instant message from your php code to formal messenger like yahoo messenger, skype or MSN messenger?? ...

Subtract time on specific lines using php

Using php I'd like to subtract/minus two times; each time within a separate document and thereafter have php write the result (Result after subtracting the two times) within another single text document or within a html document with no HTML tags, just text. The two times subtracted will determine how long a certain player has played the...

How easily create forms with php?

Ok, I am programming a website and I need to do a lot of html forms everywhere. How can I reduce amount of my time doing that? Any ideas? I guess it should be done with functions. I don't use neither any frameworks nor OOP yet. Thank you very much. ...

Zend_Http_Client failes to decode reply?

Hi, I am trying to use Zend_Http_Client to fetch a specific page (www . nu . nl) I am using this code $client = new Zend_Http_Client($url, array( 'maxredirects' => 5, 'timeout' => 30, 'useragent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801 ' ) ); $code = $client->request("GET");...

Problem cropping an image to a perfect square with GD library

Hi, I use a class that automatically crops an image as a square based on some options. The problem is that when the image is of a certain width and height, the image is cropped but a 1px column of black pixels is added to the right of the image. I think that the problem is in the mathematics used to generate the new image size... Maybe ...

bbcode unparser regex help

Hi, I have this function to parse bbcode -> html: $this->text = preg_replace(array( '/\[b\](.*?)\[\/b\]/ms', '/\[i\](.*?)\[\/i\]/ms', '/\[u\](.*?)\[\/u\]/ms', '/\[img\](.*?)\[\/img\]/ms', '/\[email\](.*?)\[\/email\]/ms', '/\[url\="?(.*?)"?\](.*?)\[\/url\]/ms', '/\[size\="?(.*?)"?\](.*?)\[\/size\]/ms', ...

Does CodeIgniter call a controller's constructor when calling one of its methods via AJAX?

I need to know whether I should re-call my helper redirectIfNotLoggedIn() inside ajaxFunction, since it's already in the constructor: class Group extends Controller { function Group() { parent::Controller(); redirectIfNotLoggedIn(); } function ajaxFunction() { //I am called via AJAX //Do I n...

What is the best way to decalre a global variable in cakePHP

Hi all, I am learning cakePHP 1.26. I got a Controller which got two functions. I was thinking to make $myVariable a global variable so that both functions in the controllers can share it, but I am not sure if this is the best way to declare a global variable in cakePHP: class TestingController extends AppController { var $myVar...

How to store $_POST value permanently in PHP?

Note sure how to explain this clearly but here is the problem: I have a multi-page form process which takes the customer from a shopping cart page to a shipping page. On the cart page there is a hidden field called totalPrice which has as it's value an integer. I am calling this total on the shipping page like so: $total = $_POST['tota...

Help Regular Expression

please see code : $result = "<b>Associated Names</b>&nbsp;&nbsp;[<a href='http://www.examples.com/authors.html?act=change&amp;id=6141&amp;item=associated'&gt;&lt;u&gt;Edit&lt;/u&gt;&lt;/a&gt;]&lt;/td&gt; </tr> <tr> <td class='text' align='left'>G&#12539;R<br />G-R<br /> </td>" preg_match_all("/<b>As...

PHP for loop counting issue

Hi There I am hoping that someone can help me with this php issue. i would like to get the number into the form from this Loop function for($i = 1; $i <= 100; $i++) { echo '<textarea name="textarea" id="textarea" cols="100" rows="10">'.spin($string, false).'</textarea>'; echo '<textarea name="textarea" id="textarea" cols="100" ...

Social Engine Password Encryption Help

Hi, I want to make an other sign up page which is linked to the social engine database, but when i MD5 the password and store it in the se_users table, the user can't login, i believe that social engine have another encryption method, Can someone please give me a function to encrypt passwords the social engine way? This is their functi...

In What conditions are closing a HTTP connection necessary?

In What conditions are closing a HTTP connection necessary? ...

What's the best design pattern for PHP when Class_a only occasionally needs Class_b information?

This project is in PHP, but is fairly language agnostic. I'm building a project that has the following MVC format Main_Class Main_Class_Common --> Class_A --> Class_B --> Class_C --> Class_... --> Class_K Original requests go to the Main_Class which then includes the appropriate main sub class. The majority of a request will...

HTML Forms - Prevent some users checking a checkbox

Hi I have a form that users fill in . Acording to the level of access they have, I want to prevent some of my form being filled in. If I have a text box I use this onfocus='blur() with a bit of php to check the users privileges .But this does not work for a checkbox. Can anybody suggest how I can prevent a user from checking a checkbo...

share php code across servers

Can I share PHP code between two servers? For e.g. say I have a file A.php on server1 and B.php on server2; is there a way to use B.php in A.php? The purpose behind this is to make sure that some code which I don't want to release publicly sits on my servers and other servers just use it as an when needed. Let me know if the requirement...