php5

get file path from svn diff file with PHP and C

hi i have a file having svn diff i wish to extract the filenames form the diff. How to write the parser for that.. Index: libs/constant.php =================================================================== --- libs/constant.php (revision 1243) +++ libs/constant.php (revision 1244) @@ -26,5 +26,5 @@ // changesss - +// test 2 ?> \...

RESTful application validation. Mix of frontend/backend validation. How?

Hi. Using RESTful for all backend persistance and operations. I just pass data from frontend (by frontend I don't mean clientside but the part that is making use of the REST) to rest and data gets back success or no with validation errors if any. Thing is I have stuff that should be validated on frontend too..like csrf tokens, captcha e...

interuption while running php file

this is my code in php bt its not working problerly as required..the output is not according to this.. i m trying to run this in wamp server. plz help <html> <head> <title>Binary Search</title> <style type="text/css"> h1 {color: blue} </style> </head> <body> <h1 align="center">Computer guess number by using binary se...

I don't know where to start with WSDL and SOAP in PHP 5.2+

Hello, I'm a web services newbie and I've tried to learn it looking for tutorials in google... but I didn't found anything really helpfull... Do you know any tutorial / web page / documentation for web services using PHP 5 native SOAP client? I need to implement a SOAP client for fetch/send data from a IIS server (for hotels reservation...

Converting to and from Unicode in PHP

Hey, I'm using php 5 and need to communicate with another server that runs completely in unicode. I need to convert every string to unicode before sending it over. This seems like an easy task, but I haven't been able to find a way to do it yet. Is there a simple function that returns a unicode string? i.e. convert_to_unicode("the string...

How to generate .json file with PHP?

CREATE TABLE Posts { id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(200), url VARCHAR(200) } json.php code <?php $sql=mysql_query("select * from Posts limit 20"); echo '{"posts": ['; while($row=mysql_fetch_array($sql)) { $title=$row['title']; $url=$row['url']; echo ' { "title":"'.$title.'", "url":"'.$url.'" },'; } echo ']}'; ?...

Get country location of an IP with native PHP

Read on before you say this is a duplicate, it's not. (as far as I could see) I want to get the county code in php from the client. Yes I know you can do this using external sites or with the likes of "geoip_record_by_name" but I don't want to be dependent on an external site, and I can't install "pear" for php as im using shard Dreamh...

Executing a file not a project

I use Aptana Studio for my PHP projects. I have not learned it but just used with what I was able to do in it. Many features I still don't know how to use in it. At present, I have a HTML form and I want to write a .php script for the SEND button that it has. It is a submission script for the contact form. I want a simple PHP IDE with ...

Concate String In MYSQL

How can i concate this string in mysql desc=desc+$desct what i want is each time i insert a variable from PHP that the string is added to the string which was already in db and seperated with || the field desc should look like this desc 10||30||90||710 say i want to add the value 20 desc 10||30||90||710||20 then the desc fiel...

How to Create an Array an Look if a value is in Array

How do I create an array in smarty from a given string like 22||33||50 and look if the given number is like the numbers above in smarty ? I have a string say {$test->strings} // contains 33||12||80 I want to look if one of the numbers in {$test->strings} is equal to {$test->myday} how can I do that? ...

Code to send email not working.

When I am trying to execute following code to email the contact form details, it is not executing properly. Instead, when the contact form's Submit button is clicked, it just shows the below source code in the browser. What's wrong? <?php error_notice(E_ALL^E_NOTICE); $firstname = $_POST['fname']; $emailaddress = $_POST['ea...

PHP Server Side Post to Recreate Replace Secure Single Sign On

I host and intranet and manager several Single Sign Ons for outside websites. We have always done this through some sort of hidden form. Example <form method="post" action="example.php"> <input type="hidden" value="user" name="user" /> <input type="hidden" value="password" name="password" /> </form> We can then have a javascript ...

Internal Server Error

I have a HTML file and a PHP file in the same folder on the remote server. From the URL, I call the HTML file and the HTML file calls the PHP file when form is submitted. But it is not going correctly. When I submit the Form, it dislays error: 500 - Internal server error. There is a problem with the resource you are looking for, a...

Uninterrupted mp3 play on a website?

Client is requesting a single track to be heard across the website. Generally I advise against it, but they insist. So, what is the most straightforward way of having a flash player embedded in a site, and when a user goes to another page there isn't a gap/interruption? I am thinking an iframe is required.. I am using a flash player tha...

Getting the day from a Unix timestamp (PHP)

How do I get the day (1-7) from a Unix timestamp in PHP? I also need the day date (1-31) and month (1-12). ...

Exploding a String In PHP

How do i explode this string '||25||34||73||94||116||128' i need to have a array like this array ( 0 => '25', 1 => '34', 2 => '73', 3 => '94', 4 => '116', 5 => '128' ) explode("||", $array); didnt work for me i get this array array ( 0 => '', 1 => '25', 2 => '34', 3 => '73', 4 => '94', 5 => '116', 6 => '128', ) ...

dynamic access magic constants in php

Hello, Is there a way to shortcut this: function a($where){ echo $where; } function b(){ a(basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__); } to something like this: define("__myLocation__", ''.basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__.''); function a($where){ echo $where; } function b()...

Which function should i use for testin if a var isset or not?

I'm sometimes confused to using which one of them, say i have a function called getmember($id) function getmember($id) { // now this is the confusing part // how do i test if a $id was set or not set? //solution 1 if(empty($id)) { return false; } // solution 2 if(isset($id)) { return false; } } Thats sometimes not clear tome s...

php class scope when calling a non-method function not accessing all class members

So I'm using a stand alone function from within a class that that uses the class it's being called from. Here's the function function catalogProductLink($product_id,$product_name,$categories=true) { //This is the class that the function is called from global $STATE; if ($categories) { //The $STATE->category_id is the proper...

Doctrine issue - Different queries, same results but not with Doctrine

Hi, i'm having a little issue with doctrine using symfony 1.4 (I think it's using doctrine 1.2). I have 2 queries, using raw sql in the mysql console, they produce the same resultset. The queries can be generated using this code : $dates = Doctrine::getTable('Picture') ->createQuery('a') ->select('substr...