php

PHP - Redis/Memcachedb/Mongodb or other persistent storage to store counter

By counter it could be pageviews, downloads, number of votes etc. Basically, not very 'critical' data. What is the 'best' way to store those information? Mysql is not a good option. What do you guys use? ...

Looking for a php library to generate vector graphics as pdf or svg files

Basically i want a library for PHP that i can use to generate vector based graphic files like svg or pdf. it need to be able to output path and not pixel based results. for example i want it to use like generate_circle($radius) etc ...

Using PHP to group and display MySQL entries by week

Hi - I'm building a site with several 'one-liners'. These are added using a simple PHP5 form, stored in a MySQL 5 database. Each row has an 'id' (auto_increment), 'title', 'description', 'status' (1 or 0) and 'date_added' (MySQL datetime). I want to display them grouped by Month and Year, like so: <dl> <dt>August 2009</dt> <dd>...

php: today to 2010-05-08 21:04:06, how can i divide this time length by 30 days ?

from the time length 2010-01-09 21:04:06 **to** 2010-02-08 21:04:06 how can I get date + time at each 30 day interval ? So I should get 2010-02-09 21:04:06 2010-03-09 21:04:06 2010-04-09 21:04:06 2010-05-08 21:04:06 So everyday, a script will check today's date to see if it matches one of above. If there's a match update all row...

Let users choice modules they want

I'm making a social gaming network, for learning but mostly because php is alot of fun! Anyway I want this future.. I wanna let my users chose which "modules" they want activated, like a message board on their profile, polls, buddy list, contact box. Some modules will have to be purchased with points. Im thinking on something like thi...

Contact page not working properly

Hey everyone. Just joined a couple of minutes ago. I wanted to see if anyone might be able to tell me why my contact page isn't sending me emails. My contact page is here: http://frankjuval.com/contact.php I don't get any errors. If you enter your info, it seems like it sends it. It even gives you the message that your email has been ...

OpenID provider library recommendations for PHP

Our PHP site uses a home-grown forms auth implementation. We're considering making our site into an OpenID provider so that we can authenticate (using our exisitng user accounts) users on a StackExchange site. If we have to add code or UI to our login form or add fields to our database, that's fine-- we just don't want to have to rip ou...

What is the best way to represent configuration options internally?

So, I am looking at a number of ways to store my configuration data. I believe I've narrowed it down to 3 ways: Just a simple variable $config = array( "database" => array( "host" => "localhost", "user" => "root", "pass" => "", "database" => "test" ) ); echo $config['database']['host']; I thin...

mySQL DB: Making simultaneous entries?

Consider the following tables for a LMS: Item ( ID BIGINT NOT NULL UNIQUE AUTO_INCREMENT, ConnectLog BIGINT NOT NULL, ItemClass BIGINT NOT NULL, ItemType BIGINT NOT NULL, AcqDate TIMESTAMP NOT NULL DEFAULT NOW(), Vendor BIGINT NOT NULL, Cost DECIMAL(64,2) NOT NULL DEFAULT '0....

Check if friend relationship already exist

Why wont this code work? I want to check if the users are already friends before I add. function addFriend() { global $userid, $friendid; $check = mysql_query("SELECT * FROM friends WHERE userid = $userid AND friendid = $friendid"); if (mysql_num_rows($check) == 1) { exit("Youre already friend with this user"); } else { $sql = "INS...

php: how to approach auto premium membership renewal ?

scenario: there are 4 items: 30day pass 60day pass 180day pass 365day pass there is a monthly (30 day) credit cap. so if you use the credit up before the end of the month you need to purchase another 30day pass, or wait till the next renewal period. A person purchases a 30day pass today, purchase date is recorded to DB. Expiry date...

PHP/CURL: Trying to do a remote login with no success.

Hello, I am trying to login to a system (which happens to be using the SquirrelMail client) using CURL and I'm having trouble. Here is my relevant PHP code: $handle = curl_init(); curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true); curl_setopt($handle, CURLOPT_URL, $url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($h...

Looping through data from multiple tables PHP/Mysql

HI all, I am trying to figure out how to put this into words even, but I am wanting to know how to format the output from each table separately in a "multiple table" mysql query. The output from the table1 "wall" is formatted within a while loop, but the content from table2 "actions" is already formatted(as 1 line of text with links) be...

Variable Variables Pointing to Arrays or Nested Objects

Hi, Is it possible to create a variable variable pointing to an array or to nested objects? The php docs specifically say you cannot point to SuperGlobals but its unclear (to me at least) if this applies to arrays in general. Here is my try at the array var var. // Array Example $arrayTest = array('value0', 'value1'); ...

get facebook user info on PHP

in this simple php file: (http://gist.github.com/273402) <?php session_start(); include_once 'libraries/facebook/facebook.php'; //$fb_user=$facebook->get_loggedin_user(); ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"&gt; <head> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0...

Predict downloads

Hi, I'm writing a little tool that counts the downloads of an app. I save every download with a timestamp. What algorithm (php and mysql) is normally used for predicting eg todays downloads? Greets, Nick ...

How to add shipping cost by finding the largest size with PHP?

At the moment I add shipping charge 65Kr. There are only four prices in the shop. I need to change the shipping charge to the following way. Product which cost 198Kr and 268Kr needs 25Kr and more than that price (418 and 498Kr) needs 65Kr. If a customer buys 198Kr and 418kr, then she needs to pay 65Kr. This means if there is one item...

wordpress plugin, access $wpdb on non visible page

I'm creating a wordpress plugin to fetch data from another website, It will be a cron file and I need to store some data in a table. how do I access $wpdb from that file? do I need to link to a wordpress core file? I'm asking this because it's not a file that will be visible in the admin area or public area, it's just a file that run's ...

Run php script as daemon process

I need to run a php script as daemon process (wait for instructions and do stuff). cron job will not do it for me because actions need to be taken as soon as instruction arrives. I know PHP is not really the best option for daemon processes due to memory management issues, but due to various reasons I have to use PHP in this case. I came...

Facebook App Login

Hello Community, I downloaded the API from Facebook and tried to login with it. I get an loop which try to authentificate me all the time ( link text ) How can I login with facebook without getting this loop? ( I finally want to get my notifications and messages an i want to post something. ) Greets Dom ...