php

Do you know how I can authenticate an app for Facebook in PHP?

I'm trying to to get tokens so something like that so that an app will be able to search a user in Facebook. I've tried http://github.com/facebook/php-sdk but it is either for authenticating a user or it is not working. For example this one is for authenticating a user to the app http://github.com/facebook/php-sdk/blob/master/examples/...

How to get string from HTML with regex?

hello, I'm trying to parse block from html page so i try to preg_match this block with php if( preg_match('<\/div>(.*?)<div class="adsdiv">', $data, $t)) but doesn't work </div> blablabla blablabla blablabla <div class="adsdiv"> i want grep only blablabla blablabla words any help ...

how show the data from array list in php

i want to store retrieved data from database into an array list with limit.And display the data from that array list one by one with next button.have any answer for this? ...

How to hide the referer ?

I need to link a website from my blog. I don't want that the owner of that website know that I have linked his website. How can I do that ? ...

Catch undefined index in array and create it

<h1><?php echo $GLOBALS['translate']['About'] ?></h1> Notice: Undefined index: About in page.html on line 19 Is it possible to "catch" an undefined index so that I can create it (database lookup) & return it from my function and then perform echo ? ...

Save the Errors in Database instead of errors.log in cakePHP

Hello folks, I need to save the Errors in a database table instead of writing in into errors.log?? How can i achieve it??? thanks in advance ...

Zend_Form: Database records in HTML table with checkboxes

Hi, I am trying to add a HTML multi-column table to a Zend_Form. The table would be populated by data from the database and each row should be preceded by a checkbox, as shown in the ASCII below: +-----+-------------------------+-----------------------+--------------+ | | Column_1 | Column_2 | Column_3 ...

How to embed mp3 flash player within site which plays from a URL instead of XML

Hi, I would like to include a mp3 file preview feature which should enable a person, once he/she has uploaded an mp3 file. He should be able to listen/preview it within the site. How can this be accomplished and are there any flash mp3 player which do this. All have seen are all XML based. Thanx ...

php and mysql (for numerical operations)

i have two tables in mysql . i want to add or subtract values from one table from another. i expect clear answer. please help me ...

Is this PDO function safe from sql injection

I have the following insert function. Is it safe from a sql injection. If it isn't then how do I make it safe. public function insert($postValues, $table){ $dbh = $this->connect(); try { $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $fields = implode(array_keys($postValues), ','); $val...

Problem with OOP in PHP

I've got the following code: class the_class { private the_field; function the_class() { the_field = new other_class(); //has other_method() } function method() { $this->the_field->other_method(); //This doesn't seem to work } } Is there anything wrong with the syntax here? The method call always seems to return tr...

Get particular value from a string, assign it to a variable

shopp('product','quantity','input=menu&return=true'); The above function from my CMS returns the value <select name="products[1][quantity]" id="quantity-1"><option selected="selected" value="1">1</option><option value="2">2</option><option value="3">3</option></select>. Any idea how I can get the number in that last option tag and ass...

How you get access tokens for Facebook?

http://github.com/facebook/php-sdk/blob/master/tests/tests.php How you get the access token for my own app? ...

if-problem with dot

Hi all Following code: <?php $str = "19.09.02"; if(substr($str, -3, 2) == ".0") { // Doing something } $str2 = "19.09.2002"; if(substr($str2, -3, 2) == ".0") { // Doing something } ?> Why does the second statement apply (without regexp)? and how can I solve, that it just apply the first expression? Thank you ...

How to get the name of browser?

I have tried $_SERVER['HTTP_USER_AGENT'], but we didn't get the exact name. Then i have tried the following code $browser = get_browser(null, true); print_r($browser); Firstly it shows warning.then i have enable it in the .ini file. After that it dosen't display anything. Is there any other solution to know the name ...

How can I rewrite URL in my case

Hi guys, I have read related Q&A's for this is question, but still I am confused on this, can somebody help me on this? What I am doing: my url is : www.mysite.com/home.php I have two files: home.php and get_data.php, in home.php i am calling get_data.php with the use of jquery. the code for jquery is: $(document).ready(function(){ ...

Using 'or die()' to stop on errors in PHP

Often in PHP, I see: $result = mysql_query($query) or die(); Coming from python, I know why this should work, because or returns the first value if it is true in a boolean context, and the second value otherwise (see this). But when I try the above technique in PHP in another context, for example something like: $name = "John Doe"; ...

How to convert OpenSSH public key file format to PEM

I have RSA public key in OpenSSH format: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9xmJumsHeLEDcJwf3LYONZholP3+pDHJYen4w+gm8o1r7t6oq825Gmjr7pjsQ+ZDxWivkI4vMW9RyFevPg09ljW+V7lZInBpRtB6v1s8PdmV9YVk4R3S0e7sPMPXuM7ocPLh5yKZ9f7JZwQlpp4ww/RE7blbXywjwCxngT7+G+J6HJB0UcR8xR8t6z8qDrDTAJA7pFFFNliw9M+I8tbrFl8HmoyudOFsGsYOd5hjemy4ivW88XcXzfHJdKnmD9FHVZ...

getting all values from h1 tags using php

I want to receive an array that contains all the h1 tag values from a text Example, if this where the given input string: <h1>hello</h1> <p>random text</p> <h1>title number two!</h1> I need to receive an array containing this: titles[0] = 'hello', titles[1] = 'title number two!' I already figured out how to get the first h1 value ...

Controlling PHP's output stream

I want to keep errors out of my PHP output stream. I only want output of things I explicitly echo. Looking at my php.ini, is "display_errors" the only configuration I need to change? ...