php

Why does this PHP program not work?

I'm new to PHP and was learning about PHP functions from w3schools. It said "PHP allows a function call to be made when the function name is in a variable" This program worked <?php $v = "var_dump"; $v('foo'); ?> But this program did not work: <?php $v = "echo"; $v('foo'); ?> But if I do echo('foo'); it works. What am I doing wr...

php strpos special characters

I'm using PHP Version 5.1.6 I have a string (session file) and need to extract a value from it, so i'm searching for a needle in the string but it returns false, I reduced the code to this: $string = ';SERVER_NAME|s:17:"stackoverflow.com";REMOTE_ADDR|s:13:"69.59.196.211";'; $start = strpos($string, ';SERVER_NAME|s:"'); echo $start; // ...

From FQL we want to get users current location in php

I want to get my friends which belongs to my city from facebook and for this i use current_location.city. But its not working... please help me. Thanks ...

Reference problem when returning an object from array in PHP

I've a reference problem; the example should be more descriptive than me :P I have a class that has an array of objects and retrieve them through a key (string), like an associative array: class Collection { public $elements; function __construct() { $this->elements = array(); } public function get_element($...

mod_rewrite - Don't get a second rule work

I want to have a url like this: domain.com/css/site.css?test=234 Rule: RewriteEngine On RewriteRule ^([a-z]+)/$ $1.php RewriteRule ^css/([a-zA-Z0-9]+).css?count=(.*)$ css.php?f=$1&test=$2 But I get every time a 404: Not found (site.css) If I have a rule like that it works, just without getting the $_GET-Variable: RewriteEngine On R...

Directly adding username to URL PHP

Hi, I would to know how one is able to append a username directly to a site url without having to put it within a query? Eg www.myspace.com/micheal instead of www.myspace.com?name=micheal Without having to create a new folder for the user so that when the url is typed including the name, the surfer is taken directly to the user's p...

How does Cell Minute Tracker work?

It's been a mystery how does Cell Minute Tracker manage to fetch AT&T users data. Maybe someone here has the long waited answer. I'm really curious rather they got a confirmation to scrape user’s cellular report And how they can fire up multiple requests to AT&T site without being banned? I'm waiting for someone who could shed some lig...

how to use facebooks old client library

i installed the old library from here:http://pearhub.org/get/facebook-0.1.0.tgz and then extracted the facebook.php file and wrote an index.php file in the same folder with the index .php file just displaying hello "username" but the problem is the index.php when run in browser does not show anythink its blank i have xamp installed on m...

Call from a singleton class to a function which in turn calls that class's method

Hello, I am still looking for a way to phrase it properly (I'm not a native speaker...). So I have this class SQL which implements the singleton pattern (for obvious reasons) and I also have this function, checkUsr(), which queries the database using one of SQL's methods. Everything works fine as long as I don't call checkUsr() from w...

Can someone explain/annotate this Ruby snippet with comments?

Could someone please add comments to this code? Or, alternatively, what would be the pseudocode equivalent of this Ruby code? It seems simple enough but I just don't know enough Ruby to convert this to PHP. data = Hash.new({}) mysql_results.each { |r| data[r['year']][r['week']] = r['count'] } (year_low..year_high).each do |year| (1....

How do I identify where the POST data sent to a PHP script came from?

I have a ton of data collection forms on my website, and I wrote a PHP script to handle all the data. All the forms have that one script as their action, and POST as the method. The handler emails a copy of the data to me, and I'd like for the emails I get to contain the URL of the form where they originated. Is there any way in PHP t...

Off the shelf Php User Forum

I have a pre-existing user database on my site. Now, I want to install a PHP-Based Forum on my site which works with already existing user table. Also, I would like it to be as lightweight as possible -- in terms of features as well as bandwidth consumption Please suggest some.. Thanks. ...

Using Cron Manager from within PHP.

Hello, i am wanting to add a section in my php application to add / remove scheduled task. Something similar to what they use in vBulletin Forum. Does anyone have any ideas what they use? are they using Cron Jobs or do they have something custom done. Can anyone guide me on how i can accomplish something similar to that, basically i ...

Image generated with PHP dosn't show

Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $imag...

[Drupal] SQL error reporting by mail

I was wondering if its possible to have some kind of SQL error reporting that sends me an email that includes the error and the website that it's been found on. I'd like to take this precaution because of hosting multiple drupal systems. There is a PHP error variant: http://drupal.org/project/php_errors Hope you guys know a way to be...

PHP/ MySQL: What is the best way to get filtered data from a database that has been inputted by a logged in user?

I am trying to create a page that displays a preview of all the data that each individual user has put into the database. Each user must only be able to see their own data. I have been using $SESSION's to post which logged in user is inputting what, and have tried to get my brain to think about the reverse action. I first wondered whe...

sendmail working but PHP mail() is failing

I cant seem to send an email using PHP's mail(). I have also tried PHPMailer and Swiftmail with no success. However, the following command on the server delivers mail successfully. cat test.txt | mail -s "test mail" [email protected] Is there a way to trace where the problem is coming from? mail() just seems to return true or false. ...

paypal ipn simple question

I want to ask just a thing. I am using paypal for the first time. not by buttons. the data i sends through html page , is it returned by the ipn? i am using a paypal class and this is my custom data: $this->paypal_class->add_field('cemail', $this->session->userdata('check_email')); $this->paypal_class->add_field('fname', $this->sess...

php problem in the encoding way

I am going to encrypt that with ioncube when giving to a client side and i will simply include to call the licensing system But the problem is when i simply include the code include "lic.php" the user can directly remove the line to get the script worked So can some one help me in coding a script inside the lic.php which will make t...

How can i forbid php to access other folders ?

I am using godaddy shared linux hosting and i hosted multiple domains in same package. Last week one of my wordpress sites was infected from an malware. Then this worm code seperated to my all domains instantly. The quesiton is how can i forbid to access other domains (folders) from a domain (folder) with php.ini or any other solution ...