php

PHP Extract2 - How to assign vars in current symbol table?

I have a function, which is a safer way to extract variables than extract(). Basically you just specify which variable names are to be pulled out of an array. The problem is, how do you insert those variables into the "current symbol table" like extract() does? (ie. the local variable scope within a function). I can only do this by m...

php doctrine behavior help

Hi, I'm going through tutorials for doctrine and have come across a problem. Does the autoload function not apply on behaviours? This is the tutorial I've been following. It should automatically create relations between the tables mentioned upon generation, however I just get an error message saying that the respective foreign id colu...

PHP interpreting jQuery serialized data

I have a form that is capturing data sent from a google LocalSearch API. The user has the ability to select a specific result, some or all results via a checkbox i'm injecting into the form with jQuery. The checkbox value looks something like this: title=Emijean+Web+Design+and+Management&streetAddress=63+James+St.&city=Parry+Sound&reg...

Business Logic in PHP or MySQL ?

On a site with a reasonable amount of traffic , would it matter if the application/business logic is written as stored procedures ,triggers and views , instead of inside the PHP code itself? What would be the best way to go keeping scalability in mind. ...

Loading executable code through <img> or <a> tags?

I'm working on an app that would allow people to enter arbitrary URL's that would be included in <a href="ARBITRARY URL"> and <img src="ARBITRARY URL" /> tags. What type of security risks am I looking at? The app is coded in PHP, and the only security countermeasure I currently perform is using PHP's htmlentities() function against the...

Merging data from two different data sets (Facebook & MySQL)

I'm wondering if this is the best way to tackle this issue. I am merging a Facebook users friends data, (from facebook - returns a multi array) with the votes from the users in that list that voted (from MySQL). This is how I accomplished this. I'm a junior developer and looking for help on making my code as optimized as possible. ...

Sending Email in PHP with special characters

I have a small web form which will cause a PHP script to send a receipt upon clicking the submit button, by an HTML mail. This mail contains special characters, namely 'å', 'ä' and 'ö'. Whatever I try, I can't get these characters to display properly everywhere. In some email clients, these characters show up just fine, whereas in others...

What is this error? "Database query failed: Data truncated for column 'column_name' at row 1

I'm building a PHP/MySQL application and I'm running into a problem with my create and update query. I have 5 columns that are set to type FLOAT that are also set as NULL columns. I don't plan to fill them in until much later in the workflow. However, I need to create new records for this database, and I need to edit existing records, ...

PHP Excel Reader : get strikeout / strikethrough value

I am looking for way to parse the strikeout / strikethrough value of cells in an Excel sheet, using if possible a PHP script. The cells that are strikeout or not contain simple text values (no formula or anything). I have try using http://code.google.com/p/php-excel-reader/ and a few others scripts. But I have not found any PHP script t...

Gathering all emails from table for email

Hello, I would like to build a webpage that follows the system in vBulletin of emailing. So, currently, the user table contains the user data: username, userfullname, useremail etc. Basically, what I need is for this script to gather the emails of the users from the database. Additionally, I'd like the email to be sent out invididuall...

Why do fixes of PHP Bugs/Features take so long?

This may not be strictly programming-related. How come PHP Features / Bugs that seem important(*) always take a while to be developped? For example, in PHP most sorting functions support the SORT_LOCALE_STRING, which allows an array of elements to be sorted depending on the system's locale. Most of them, except for the super-useful arr...

Display highlighted HTML source code in Firefox?

Is there some clever content-type setting that makes Firefox display highlighted HTML source code instead of rendering it? I have a CMS that generates HTML pages. I get debug info on each generated page by adding "/debug" to the URL. I would like to see the source by using "/source" so I have the source within my Firefox tabs (and not as...

Selecting the next date in MySQL

I have a list of dates in a table in a MySQL database (the dates when a charity bookstall is to be held), which I want to display on a page. On one page I'm displaying the date of the next stall, and on another the dates of the stall in the next month. (Currently I'm using an unordered HTML list and selecting the dates with PHP, but it's...

Handling multiple single-user logins in PHP

I recently simulated multiple login in PHP using 1 account. Here's what I did opened 2 login screens logged into account 1 using the first login screen login successful logged into account 2 using the second login screen What I want to do is to logout user 1 when user 2 logs in on the same machine and the same browser. How do I do t...

php - multiple connections to database

I have a login page that gets the username and pwd and sanitises them before passing them to DB. this is done through a function: function make_safe($text) { open_db_connection(); //this opens another connection! if(get_magic_quotes_gpc()) { $text = stripslashes($text); } $text = mysql_real_escape_string($text); return $...

Need advice on my PHP development solution

Here is how our current php development solution is set up: Each developer work on their local machine. Each developer commit their change to a common SVN server (intranet). A commit hook upload the change to the staging server and perform validations tasks. When the product is ready, manually deploy it to the production server via SFTP...

Is there a way to sync column widths in an html table?

If I have these two tables: <table> <tr> <td>Small Length Content</td> </tr> </table> <table> <tr> <td>Dynamic Content Goes Here And It's Longer Than The TD Above</td> </tr> </table> How can I make it so that the two columns have the same width? I can't combine the tables so thats not an option. I also can't use fixed widths since i...

store wget link into a database (php)

Hi, I'm trying to find a solution to download automatically .flv link everyday from a website using wget and to store all the links into a database to stream them in my website. (all in php) How to do that? I don't need to store the files only links into the database. Best regards, ...

Connecting to a Source game server in VB.NET

I'm developing an application that detects Source-based games running on the LAN. Following up on the specifications provided by Valve, I have it narrowed down to exactly what I want: making a UDP connection on port 27015, sending an A2S_INFO query (0xFFFFFFFF followed by "TSource Engine Query") and parsing the binary reply. This is the...

PHP & Conditional

I was searching the net for a random password generator and I come across this code <?php function generatePassword($length=9, $strength=0) { $vowels = 'aeuy'; $consonants = 'bdghjmnpqrstvz'; if ($strength & 1) { $consonants .= 'BDGHJLMNPQRSTVWXZ'; } if ($strength & 2) { $vowels .= "AEUY"; } if ($s...