php

Is php the right language to program for a large json api such as mochi?

So I am currently using django and the site goes down very often... However, because of that i was thinking if a simpler solution of php is introduced in slurping in the games over to my db and s3 using the following api then i would not have to keep up with the django issues: url: http://www.mochimedia.com/feeds/games/xxxxxx/all?format=...

Regex of non breaking space in php

input: $string = "a b c d e"; i have a string in php and I need to replace the string with the non-break space code output: "a \xc2\xa0b c \xc2\xa0d \xc2\xa0\xc2\xa0e" single space and the first space is not allowed to replace with \xc2\xa0 when two space appear " ", the output is " \xc2\xa0", first space is kept and the se...

Running a PHP script inside a Python WSGI enviroment

Hi all, I have a simple PHP script that outputs a dir listing in XML format. I use it to let a flash slideshow know what files are available to show. I've just added the flash to a website that's powered by Django and the PHP file is now served up as it is, not parsed. It's in the directory with the images under my media directory. Th...

Declarative access to structured PHP variable without foreach loops

Background Assume I have the following nested variable in PHP. $data = Array( Array('lname' => 'Simpson','fname' => 'Homer','age' => '35','motto' => '_blank_'), Array('lname' => 'Simpson','fname' => 'Marge','age' => '34','motto' => '_blank_'), Array('lname' => 'Flintstone','fname' => 'Fred','age' => '33','mo...

jQuery AJAX POST New Line Problem

So on our site we currently have a textarea for commenting on certain items. The site uses AJAX so the user can press the button and see their message fade in (Imagine a Facebook style commenting.) The jQuery/AJAX: $(function() { $("input#comment_submit").click(function() { var comment = $("#comment_box").val(); var dataString = 'comme...

Would this redirect script open me up for code injection or remote file inclusion?

Recently I ran across a blog article about using PHP scripts to redirect affiliate links. It got me thinking whether this script was safe or not. I've heard that using the $_GET variable can lead to a vulnerability. Any suggestions would be appreciated. Would checking the input for alphanumerics and the hyphen ('-') be enough to guar...

Can't read cookie in php

Hi, I am unable to read the cookie using $_COOKIE['mycookie']. I am using PHP-Apache on Linux box. Is there any seeting in php.ini or httpd.conf to activate cookie. Thanks ...

How to play all video files in browser using php?

Dear all, i want to play most of all video files in browser, is it possible? can any buddy help me out. thanks in advance. ...

How can I avoid reloading an XML document multiple times?

tl;dr: I want to load an XML file once and reuse it over and over again. I have a bit of javascript that makes an ajax request to a PHP page that collects and parses some XML and returns it for display (like, say there are 4,000 nodes and the PHP paginates the results into chunks of 100 you would have 40 "pages" of data). If someone cli...

Static message above the page in html

Hi, I have a web page with lengthy contents. I just want to put some message at the bottom of the browser window and this message should always be visible even if you scroll down the page. can you guys tell me how to go that with simple css, html, jquery or in PHP thanks ...

What's the best way to access a URI variable after a hashtag from php?

I have javascript updating my URI as below: /index.php?page=list#page=news But I would like to make page=news accessible somehow from my server so that when the URI is copied and pasted, it would go to the news page. What is the best way to do this ? I tried $_SERVER['REQUEST_URI'] but everything stored in $_SERVER is before the hash...

Help with Kohana ORM?

Using the ORM, I want to be able to load all articles that posted, in which a user has made a comment. comments table comment_id user_id article_id etc.... Using ORM, I can access all articles posted by a user, but how would I be able to access all articles in which the user has commented on? Thanks Edit: Another problem is, if a...

compare portion of the string using php

Hi, I want to check whether the search keyword 'cli' or 'ent' or 'cl' word exists in the string 'client' and case insensitive. I used the preg_match function with the pattern '\bclient\b'. but it is not showing the correct result. Match not found error getting. Please anyone help Thanks ...

jQuery/AJAX: each, if, post, .html: Runs but randomly deletes data

I've got a PHP page, with FedEx & UPS tracking numbers in a MySQL database echoing into ID's of DIVs with the class "trackingnumber". My JS each's through those divs and grabs the ID to then post to a PHP page that polls Fedex/UPS and echos the result from them. That works great, except for one thing. It randomly deletes the data after i...

Content Restriction Ideas

Hello, I was trying to do subscription system which is only for registered user. Till registration stage, I am okie. But I don't want user to share their username and password with others because of the paid content. How can i prevent ? Check with IP, but what if they are on dynamic IP ? Using proxy ? Store cookies can change ? Can ...

(PHP) Help debug tracking script to show only unique items.

Hello everyone, i have this script that i am trying to implement to work on my website and the script is suppose to track what games are being played at the moment but the only problem is that when i call the script to display the entries it would show duplicates and i want the script to actually explore the string and take only the $gam...

PHP + Ajax Progress Indicator?

I'm coding something in PHP, I'm just using Ajax for the styling. basically I am creating a form of searching for something on a site that isn't mine. I'm not sure if the steps I'm using is going to take long or if it will be instant, but in any case I would love a step/progress indicator. Is there a tutorial or link someone can give me ...

how to check credit card is valid or not for paypal

Hi I have to take user credit card detail for payment through paypal. For first time user enter detail at that time payment is done through paypal pro. So for first time if card in not valid then payment will not done and payment done if card is valid. Now my problem is that for first time user enter a valid card detail and payment don...

Replacing a string with certain elements in an array (PHP)

I have a paragraph of text like: $paragraph = "Hello there {Customer.name}, You are {Customer.age} years old. You were born in the year {Customer.birthdate}"; I want to replace this with contents of an array such as array('Customer' => array('name'=>'Tom', 'age'=>8, 'birthdate'=>'1980-01-01')) My question is what is the best way to...

Undefined index: Error in php script

In a php page I have following code: if($_REQUEST['c']!="") // I get error on this line itself. Why? { $pidis=(int)($_REQUEST['c']); } I keep getting Undefined index error. On Googling I manage to understand that if a page is access without parameters (in URL) which we are trying to access we can get this error/warning. I believe t...