php

In PHP, mirror one dynamic webpage?

I have my blog at location /blog, and the content is dynamic. I would like /index.php on my site to mirror /blog How do I write index.php to mirror a dynamic webpage? ...

How to prevent browser from refilling form data when navigating back

I have a php form that submits data to a database. When the form has been successfully filled out and the data submitted, the form clears because of the page refresh. When the user hits the back button on the browser, the data comes back. Is there a php function that will prevent the caching of this data? ...

retrieving Google search results

hi sir..i read your post on http://stackoverflow.com/questions/1784114/simple-php-script-to-retrieve-google-keyword-search-completion and i was wondering how would you go 'echo' the next page? here's my script.. $search = 'query'; $x = json_decode( file_get_contents( 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0...

Twig Template Engine Installation-PHP

I am running Mamp as my local server & I Have installed Twig here: /Applications/MAMP/svn/twig/twig/lib. I have included this path in my php.ini file (include_path = ".:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/svn/zendframework/trunk/library:/Applications/MAMP/svn/twig/twig/lib" ;) What needs to go in my htdocs folder in...

CakePHP returning double array from find('list) query

I'm using cakephp and am getting back a "double array" where it is giving me 2 arrays where it should be 1, I have looked into the issue as far as cakephp and can't figure it out and just want to move past this for now so I am wondering if anyone knows how to unset a second array if a variable has 2 arrays.. below is the print_r of the a...

MySQL count problem.

I've been trying to count how many times a tag has been entered into the database and display the number of times it has been entered along with the tag into the database just like here on StackOverflow but I can't seem to be able to do it can someone help me? So far I can get the tag but not the count. Thanks in advance for the help!...

php preg_match grab out

<script type="text/javascript"><!-- Vertical1_437 = "false-2010"; ShowAdHereBanner1437 =" true"; RepeatAll1437 = "true"; NoFollowAll1437 ="true"; //--> </script> I'm trying to get the 2010 part out of the false-2010. i want it to echo 2010 only.. Thanks for the help. this was what i started with and got stuck <?php $get2010 = pr...

Mac 10.6.4, I installed libmcrypt and phpmyadmin how do I get them working

I installed libmcrypt and phpmyadmin how do I get them working ...

Nginx+spawn-fcgi doesn't work with second IP

I can see html file,but when trying to visit a php file,I'll get a 404 error. but everything is OK,with first IP address, Why? ...

How to generate OAuth signature with php for Twitter API?

Hi, Actually it is not a php question it's more about OAuth. I'm trying to understand how to generate the OAuth sign key. I read the Twitter Docs and tried the example, but I couldn't understand how to use the SHA1. Should I use SHA1 on the base string with or without the secret_key? I tried many variations but the sign key was differ...

Help with using JSON object inside PHP?

I am (trying) to build a web app, first one :) I need to call a JSON object though, and I am using a simple search form to get a word that I will append to the call, but I need PHP to handle the object when it is returned. How can I do this? Basically I had the form submit calling a function that, ideally, would go get the object and do ...

Basic principles for securing a web-app?

Possible Duplicate: PHP Session Security I've just finished coding the basics of a web-app (the main code) and I've integrated a basic user system. This is my first web-app so I'm wondering what are the things that I should use to secure it? I already know about thing like mysql_real_escape_string() and strip_tags() but what e...

Is there a way to discern an iPhone 3G/S visitor to an iPhone 4 visitor?

I want to load higher resolution pictures for iPhone 4 users, but the only way I know of detecting users is by a user-agent. But I'm under the impression that the user-agent of MobileSafari on any iOS4 phone is the same across the board. What could I do to detect an iPhone 4? ...

Help with preg_replace and special chars

Hello, I'm using the PDO class but I'm triying to remove all chars except...: function cleaner($str){ return preg_replace('/[^a-zA-Z0-9éàêïòé\,\.\']/',' ',trim($str)); } As you can see, it's a simple function, but it removes all chars éàêïòé example: cleaner('$#$<<>-//La souris a été mangée par le chat ') //returns La souris a...

print each item of array in order - one per page refresh

Like a random image generator (ex: http://www.dustindiaz.com/a-simple-php-image-rotator/), only in a sequential order. Im running banner ads, and the client would like them run 1,2,3,4,5 in order per page load. So they just go round robin. 5 page loads, then the cycle start again. Any ideas? I've googled for a while, and i'm not finding...

Fatal error: Cannot redeclare mss() (previously declared in *

I don't understand, the function doesn't exist, and even if I change it to some absurd names, it still doesn't work. Can anyone find the problem? function mss($value){ $data = mysql_real_escape_string(trim(strip_tags($value))); return $data; } EDIT: I forgot to mention, its XAMPP ...

What should go in CodeIgniter models?

I've always used the model as something to more or less store and execute database queries. I have heard about the fat model, thin controller concept. The way I setup my models right now causes a lot of junk in controllers for things like validating forms, formatting data. Does form validation, file uploading and data formatting belong ...

Packaging a PHP-MySQL app to allow easy install

I've developed an open source application in php and mysql. I'd like to give it to the end user to install on their computer and use from their browser without me having to host it for them. But the end users are non-developers so they're unlikely to have what it takes to run the application (php-apache local environment like a developer...

How to keep Node.js from splitting socket messages into smaller chunks

I've got a chat program which pushes JSON data from Apache/PHP to Node.js, via a TCP socket: // Node.js (Javascript) phpListener = net.createServer(function(stream) { stream.setEncoding("utf8"); stream.on("data", function(txt) { var json = JSON.parse(txt); // do stuff with json } } phpListener.listen("88...

Accessing session data with a session ID

I've been told that it is insecure to store things such as passwords, usernames, and user ID's in cookies, and that instead you should store a sessionID in a cookie. Here's where I get lost. My objective is to have a basic 'remember me' feature. Normally I would store user login information in a cookie, but as this is unsafe, I'm wonder...