php

Calling PHP Class

Is there any way to call a php class (eg. $var = new className) and have var store the value returned by the className function? Or, is there a way to call a class and not have it execute the function with the same name? ...

How to test function that produce binary file?

Hi, I was trying to learn unit test with PHP. I know it's a bit too far for someone who just jump into unit test in PHP. Anyway, here's the case: function doresize(&$mp3file) { global $tmpdir, $mp3info, $ffmpeg; if(dirname($mp3file) != $tmpdir ) { copy($mp3file , $tmpdir . '/' . $mp3file); $mp3file = $tmpdir . '/'...

Read in external links in PHP

I know how to do this in Ruby, but I want to do this in PHP. Grab a page and be able to parse stuff out of it. ...

How to enable imagecreatefromgif/imagecreatefromjpeg/imagecreatefrompng in PHP?

It now gives: PHP Fatal error: Call to undefined function imagecreatefromjpeg() But the gd library is enabled. ...

cURL help with PHP

I am playing with cURL, and I am having trouble getting it to work. I want the cURL script to post the data on that form so I can see the posted data in results.txt. Here is my form script and then my cURL script after. I changed the $url before posting here. Edit: The problem is, it's not posting the data. I ran the cURL script, and ch...

Break out shared model in code igniter applications

Hi, I'm fairly new to code igniter and to php (coming from a java background). I want to create a model that's shared by three apps that may or may not run on the same machine. So I want to keep the model classes portable to be shared by all three and easily handled by SCM systems. So my thought was to do the following: If I have alrea...

How to get the first day of a given week number in PHP (multi-platform)?

Hello, What is the simplest way to do it in PHP ? I want the date of the Monday of a given week number of a year (example : week number 3 of 2009) Thanks ! EDIT : If you use Linux only machines, use cletus' solution, however I am looking for something that can work on Windows AND Linux. ...

What is the need for validation of forms in php?

Hi, I am done with validation using javascript for a form in PHP. When is there any need for PHP validation? javascript validation in itself ensures that all the fields are filled up. Is there a possibility to check the valid format of the inputs using javascript? ...

how to remove "%" in URL and PHP ??

Hi when i am trying to open a page using window.open, its not working. The path shown is like "xyz/a%20b%20c%20.pdf" where it is suppose to be "xyz/abc.pdf". if i remove the "%" and "20" manualy, it will work.. how can i remove this using code?? please help me Thanks in advance.. tismon ...

Cascading resource selection using mod_rewrite

I'm looking into setting up an application where there is a core and a project namespace, where core is the default fallback to the project customisation. to this end id like to be able to cascade various resources like css, javascript etc. for the purposes of the excersize, ive simplified this as ./.htaccess ./first/firstonly.txt ./fir...

Diversity of learning technologies.

I am a student and preparing myself for job. Being an ASP.NET(C#) developer, do I actually need to learn JSP(Java) or PHP? Being a web programmer, do I actually need to learn CSS and JavaScript libraries(i.e. jQuery/ExtJS/MooTools, etc.)? And can I only concentrate on programming. I.e. keeping away from business processes. Please, I...

PHP, Eclipse/Zend Studio & Debugging with expressions

Hi, I have a variable in my PHP application that changes often, I'd like to debug so that it keeps executing until the variable changes to a specific value (in this case boolean true). I've heard this could be done with expressions? True? ...

Response any web page in the internet from a PHP file

How can I create a simple PHP file, which will retrieve the HTML and the Headers of any web page in the internet, change images/resources url to their full url (for example: image.gif to http://www.google.com/image.gif), and then response it? ...

MySQL connection in PHP

Hello everyone. MySQL connection in PHP can be established in two ways: $mysql = new mysqli('localhost', 'user_name', 'password', 'database_name'); or $link = mysqli_connect('localhost', 'user_name', 'password'); mysqli_set_charset($link, 'utf8'); mysqli_select_db($link, 'database_name'); Which one is better? ...

Loading secret FLV files from Amazon S3

I'm starting a new project that involves users paying to see educational videos. These videos (FLV) are hosted with Amazon S3 while the site itself is hosted on a regular web host. I've tried to read up on securing the S3 files, and can't find any good solution for this. I don't want my users to download the videos directly. I read som...

Regex for file names, with no url?

How can I write a regex which will replace any file name, with it's folder path, but wouldn't match url? and wouldn't match in url? For example it should match: /images/something.png content/scripts/myscript.js image.gif /1.jpg But should not match: http://www.google.com/images/something.png www.google.com/scripts/myscript.js http://...

PHP - Is this a good method to prevent re-submission?

This is related to preventing webform resubmission, however this time the context is a web-based RPG. After the player defeats a monster, it would drop an item. So I would want to prevent the user from hitting the back button, or keep refreshing, to 'dupe' the item-drop. As item drop is frequent, using a DB to store a unique 'drop-trans...

Ruby password SHA512 hash replication using PHP

Hi there, is there any way I can reproduce this ruby function: def Password.hash(password,salt) Digest::SHA512.hexdigest("#{password}:#{salt}") end In php. Cheers ...

Php Mail Function

I am using php sendmail() function in my projects. When I sent above 3 or more mails processing gets too slow. What is the problem? If I use PHPMailer, will this problem solve? ...

Zend Framework with phpBB: URL problem

I am using zend framework with Apache sever on Ubuntu. When I try my site on localhost, I use following url for example: http://test.dev/authentication/login http://test.dev/student/profile Where 'authentication' refers to AuthenticationController and 'login' refers to loginAction. 'student' refers to StudentController and 'profile'...