php

Need code critique for time interval test script PHP

Hey again! I'm trying to write a set of scripts that will run on a page only if it has been more than 15 minutes since they last ran. Basically, an automated script updates a database of mine every half hour--and a page which displays that information and updates session variables must obviously query the database whenever it is opened...

Using Gmail's SMTP server to send 1000+ emails a day

I have a web app that is currently sending roughly 1000 emails a day. I'm wondering if it's possible to switch to Gmail's SMTP server for this to hopefully iron out any issues with deliverability. Do they allow for this amount of usage a day? ...

Saving session data with Javascript, or similar solution

Basically what I'm trying to achieve is a basic back capability. User goes into Girls listing, which shows him a location screen. Selects a location, and the locations are replaced by images of girls from that location using AJAX. User clicks on a particular girl to view her profile. Now the user wants to go back and have a look at a dif...

Displaying POST Data with jQuery?

I'm using a flash webcam to take a picture. It works great and spits back a URL via POST. I'm coding in PHP and would like to display this POST data once it is recieved, the problem is that I dont re-load the page. I've looked around and I'm not sure to dynamically load this array of data. Where should I be looking? jQuery? Ah, Figur...

PHP, Actionscript Object Oriented Programming Design Pattern....

Hi guys... I was wondering how to do the PHP OOP design pattern for real life application. I wish someone can share their learning experience with me. I am particular interested in PHP and actionscript. Most of the books I could find in the book store are only basic PHP (or AS3) programming. I appreciate any help. Thanks! Please do no...

Year and week to date in php

I have two pieces of information extracted from a MySQL database, the year(2009, 2010, ect) and the week (1-52). And I need to convert it in to a date start and date end.. For example: Year=2010, Week=1 would be (Friday, Jan 1st, 2010) - (Sunday, Jan 3rd, 2010) Year=2010, Week=33 would be (Monday, Aug 16th, 2010) - (Sunday, Aug 22nd,...

Ensuring Unique Rows Using PHP/MySQL

I have the following code that should, when run, update a table of "victims" of Her Royal Majesty Penelope the Queen of Sheep (it's work for someone, honest), however every time the code is executed it adds all new rows all over again. I was pretty sure I had safeguarded against that, but I guess not. What am I doing wrong here? require...

Passing more than one argument to a callback function (using PHP 5.2)

I'm writing a content management system. The page admin enters content for a page and, when he enters a number surrounded by special characters, it's replaced by a database entry on the viewer's screen when parsed. To accomplish this in the parsing, I'm using preg_replace_callback(). However, I can't pass my database connection variab...

How to rewrite URL of an image, using a field from a mysql database as the new url?

I have a table in my database which has information about a bunch of user uploaded images. One of the fields is "slug". Say the user uploads an image with the filename "46156142.jpg" and inputs the slug as "smiley-face", I want to be able to point to the image by navigating to "http://domain.com/smiley-face". The actual location of the f...

HTTPS Post Reuqest via PHP and Cookies

I am kinda new to PHP however I used JSP a lot before (I have quite information) and everything was easier with Java classes. So, now, I want to perform a POST request on a HTTPS page (not HTTP) and need to get returned cookies and past it to another GET request and return the final result. Aim is to make a heavy page for mobile phones ...

someone decrypt double bracket (php) notation for me?

<?php [[add_menu_page|add_menu_page]]( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); ?> how does this [[add_menu_page|add_menu_page]] work? and what is the underlying logic? ref. http://codex.wordpress.org/Adding_Administration_Menus ...

PHP array question.

Is it alright if I put the cat[] array value in the for, name and id attributes. code. <label for="cat[]">' . $cat['category'] . '</label> <input type="checkbox" name="cat[]" id="cat[]" value="' . $cat['id'] . '" /> ...

Organizing member join dates/member growth data into graphable chunks

I'm dabbling with pChart and would like to start with a simple line graph showing the growth in membership over time. Y-axis would be # of membersX-axis would be time For each time datapoint, I need a corresponding total members datapoint. My user table is structured as: [user_id] [join_date] The approach I came up with on the bu...

phpvideotoolkit offset error

This is the error i'm receiving. Notice: Undefined offset: 1 in /Library/WebServer/site/phpvideotoolkit.php5.php on line 813 Notice: Undefined offset: 0 in /Library/WebServer/site/phpvideotoolkit.php5.php on line 814 This is the line code see commented line ERROR HERE $data & $fps_value line // match the video stream info pre...

Does anybody know which file to add CSS <link> and JS <style> tags to in Jetbox v2.1?

I am updating a client site that uses Jetbox CMS v2.1. I need to add <script> and <link> tags in the <head> section, but cannot for the life of me find which file to edit. There are numerous tpl files and the CMS seems rather confusing. I tried editing index.php with the following: //I am pretty sure that this replaces {var_name} in ...

Efficiency of Preg_replace

Executive Summary: preg_replace() ran faster than string comparisons. Why? Shouldn't regular expressions be slower? In a recent question about detecting any of an array of disallowed substrings within a given input, I suggested comparing the result of a preg_replace() call to the original input, since preg_replace() can take an array...

Please please PLEASE someone have Tidy2.0 extension

So I'm trying to get Tidy2.0 installed on my Karmic, following this guide: http://www.howtoforge.com/forums/archive/index.php/t-7395.html I figured everything would work, but it seems the source for Tidy2.0 is no longer live: http://support.office-shadow.com/installer/tidy2.0.tar.gz That site is still live though (office-shadow.com, na...

Does my PHP security algorithm effectively store user credentials?

This question is about a specific programming problem I am having - I want to make sure that my code (and software algorithm) are sufficient enough to store user credentials in a database. // Get a 32 character salt like '69Mt6nexL1rsjWnu011S53MpB/WmT4Vl' $passwordSalt = Security::generateBase64Salt(); $user = new User(); $user->setUse...

PHP: cast to (array) and return-type: array is not the same?!

Hi! I have following problem in PHP: print_r says its the same, gettype says same type.. but the last output works not for both cases... although they should be the same!! this looks very strange for me... code and output: $docdatau = get_object_vars(json_decode($docdata)); $docdatau2 = (array)json_decode($docdata); echo "1\n"; echo...

Mockup tools for developers: balsamiq sketchflow

I got my first real project, but unfortunately it's with a client who doesn't quite know what he wants, which makes it a bit difficult to interact with him. I think to help and myself, I need to introduce some prototyping or sketching tool into our conversations. I did a quick search now and found balsamiq and MS sketchflow, but I keep...