php

Get full url and split into an array with JSP/ASP

In PHP/Apache I can get the full url and cut it up into parts like this URL: mysite.com/friends/enemies-cats/ Then using PHP explode function I can split the URL by the "/" into an array. Array[0] = 'friends'; Array[1] = 'enemies-cats'; I wonder, is it possible to do the same thing on a Java server. I am hoping the same thing could ...

What's wrong with this PHP4 class to do AES encryption?

When I decrypt something encrypted with this function, the decrypted version doesn't equal the original. class AES256encryption { var $secret = ''; var $cipher_key = ''; function AES256encryption($secret='') { if (empty($secret)) { global $secret; if (empty($secret)) { ...

SOAP Server error in PHP - adding functions from a class

I am writing a SOAP server and have hit a strange problem. Here's the relevant lines from the server.php class MyHandler { public function __construct() { ... } public function __wakeup() { ... } public function getPrice() { ... } } $server = new SoapServer("my.wsdl", array("soap_version" => SOAP_1_2)); $server->setClas...

Converting C to PHP?

Is there any tool available that takes C code as input and outputs valid PHP files? I'd like to use the SAC API but all the implementations currently available are in C, Java, Ruby and Perl. I wonder if the C implementation can be converted to PHP easily. ...

Need help tweaking regex for filenames with dimensions

I have a lot of movies in directories with filenames containing their dimensions. descriptor-800x600.mov cool_animation-720p.mp4 reactor-1080p.mov test-640x480.mov I'm looking to pull out the 800, 600 from #1. 720 from #2, 1080 from #3, etc. Looking for some help to tweak what I've got so far: $re = '/^(.*?)\-(\d{3,4})p+|(\d{2,...

Question about CSSTidy

In opposite to most other CSS parsers, no regular expressions are used and thus CSSTidy has full CSS2 support and a higher reliability. I wonder why CSSTidy built their own parser and not utilized the official SAC API (which also includes support for the new CSS3)? Is there any technical or practical reason for not using SAC a...

How to update localhost mysql data to remote mysql server

i would like to update for every action(insert,update,delete) happens in localhost mysql to remote mysql server. how to i do that? . ...

how to declare all your includes in one file that will be loaded in all project in PHP

Hello i'm working on a project but, i'm sick of loading all the libraries in every single page my project directories are something like this |---x (( PHP PAGES )) |--- x1.php (( PHP FILE )) |--- x2.php (( PHP FILE )) |---y (( PHP PAGES )) |--- y1.php (( PHP FILE )) |--- y2.php (( PHP FILE )) |---includes (( LIBRARIES )) a.ph...

PHP week of year problem?

Hi, i tried this: echo date('W'); It gives me "06" (without quotes), but I only want 6, instead of 06. Is there a way to get the week of year in single character if the week is less than 10. I have couple of ways to deal with this, like: Check if week is less than 10, then use substring. etc.. Is there any more convenient way? ...

football manager facebook application

hey guys i'm about to begin a football manager inspired facebook application in php/mysql and had a couple of questions: 1) where would be the best place to host the database? any services offered within great britain would be excellent! 2) does anyone have any ideas on how i could use player statistics as part of the in-game match eng...

Obtaining PHP Remote Address Info from URL

Hi, I am new to PHP and keen to learn and I was wondering if people could please let me know how to obtain phpinfo information, specifically under the Apache Environment, the variable REMOTE_ADDR? I basically provide a user with a url to a partcular website, which ultimately returns them a csv file where they can either save/delete or ...

Add 'Watermark' to images with php

I have a website where users may upload images... I need to add my logo (watermark) to the images once they are uploaded. How can I do so? And it is important that the watermark is in a corner where it will be visible, for example I have seen websites which generates a watermark on the fly, and puts the mark wherever the background of...

(PHP) SHA1 vs md5 vs SHA256: which to use for a PHP login?

I'm making a php login, and I'm trying to decide whether to use SHA1 or Md5, or SHA256 which I read about in another stackoverflow article. Are any of them more secure than others? For SHA1/256, do I still use a salt? Also, is this a secure way to store the password as a hash in mysql? function createSalt() { $string = md5(uniqid(...

using href links to go to specific section within website

I am trying to link some text with the href tag to a specific section in my website. On the homepage I have a quote and then the person's name of who said it. I want to link his name to the "Upcoming Events" tab on my "About" section. The website is http://www.verticalministries.net. The name "Aaron Ivey" needs to be linked to the "Up...

Lightweight PHP5 based template class/system

Hi there. Looking at using a template system for a new project, it's only a small site and don't want to use the overhead and 'complexity' of smarty. I don't really like template systems that force you to make use of another language just to make it easier for designers (apparently). Something like this http://www.namepros.com/code/...

PHP 5 messing up pass by reference

I am creating this UnitOfWork object and an Db adapter that uses it. When the Adapter fetches a row: it will turn the row into an object of the correct type put the object into the UnitOfWork to be updated return the object Example code $entity = $adapter->findById(1); The internal working dummy: class Adapter { function find...

Load remote favicon and then convert to png with PHP before loading into AS3.

As of now I am using cURL to load a remote favicon, but it outputs it as a .ICO, which AS3 will not load. I tried to convert the .ICO with imagepng, but that caused errors. Is there a way I can load a remote favicon and convert it to a png with PHP before loading it into AS3 without relying on Google's s2? Some of the code: snip $imag...

How do I remove array elements with keys equal to a certain word in PHP?

I have this huge array: array(47) ( "name" => string(0) "" "state" => string(7) "Alabama" "city" => string(0) "" "country" => string(13) "United States" "location" => string(0) "" "rooms" => string(0) "" "price" => string(0) "" "highlights" => array(5) ( 0 => string(0) "" 1 => string(0) "...

Ambigious PHP Web Service error message

Hi all, did anyone ever encounter the following error message Extra content at the end of the document when trying to consume a PHP web service from a client that runs on php 5.3? I guess soembody did. ^^ Anyways, I don't seem to find an error in the server code which works for several clients of mine for quite some time now....

how to decode this JSON string?

this is what i get as a string from a feed finder url (JSON Encoded): {"updated":1265787927,"id":"http://www.google.com/reader/api/0/feed-finder?q\u003dhttp://itcapsule.blogspot.com/\u0026output\u003djson","title":"Feed results for \"http://itcapsule.blogspot.com/\"","self":[{"href":"http://www.google.com/reader/api/0/feed-finder?q\u003...