php

Login system and sessions (php)

I've created a login page and registration page and now I want to use that to password protect pages and have pages which show information specific to that user. Would storing the user ID of the user logged in in a Session variable be a safe and correct way of doing this? How easy would it be for a user to change the session variable t...

Writing a CSV file for Mac users with PHP

I use a generic algorithm to write CSV files that in theory works for the major OSes. However, the client started to use Mac a few weeks ago, and they keep telling me the CSV file cannot be read in Microsoft Excel 2008 for Mac 12.2.1. They have their OS configured to use "semicolon ;" as list separator, which is exactly what I am writin...

CMS for custom application

We are building a custom application using LAMP with P being PHP. We also need to have CMS to manage various aspects of the site. The two options for the CMS are Build a complete custom CMS from scratch Extend an existing open source CMS to fit our needs. This way we can use some of the features out of the box and others we will build ...

SEO Url Redirect/Rewrite Using Database Managed Links

I have searched left and right. And i am trying to find a script or a method on how I can store links in database and use them for redirection. This is an E-commerce project and I am looking for something to manage Product and system URL from database. Something Similar like magneto dose. Basically anything after the domain say like d...

mysql select query problem

i have a form that has a multiple select drop down. a user can select more than one options in the select. the name of the select is array[]; using php I call implode(",",$array) in mysql db, it stores the field as a text in this format "places"= "new york, toronto, london" when i want to display these fields i explode the commas. I am ...

Wordpress how to retrieve the post id once it's been reset in the page

I'm working with a script in which the postid of the page has been reset via a script include. How can I retrieve the actual true post id and reset its value once it has been changed via script? Here is the script that I'm referring to. Somewhere in there, the postid is being reset so that the page's the_content() call is no longer pull...

Read a text file and transfer contents to mysql database

I need a php script to read a .txt file. The content of the text file are like this: data.txt 145|Joe Blogs|17/03/1954 986|Jim Smith|12/01/1976 234|Paul Jones|19/07/1923 098|James Smith|12/09/1998 234|Carl Jones|01/01/1925 These would then get stored into a database like this *DataID |Name |DOB * 234 |Carl Jones|01/01/192...

open_basedir vs sessions

On a virtual hosting server I have the open_basedir set to .:/path/to/vhost/web:/tmp:/usr/share/pear for each virtual host. I have a client who's running WordPress and he's complaining about open_basedir errors thus: PHP WARNING: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/var/lib/php/session/sess_42k7...

Regex to detect a proper permalink?

These permalinks above are rerouted to my page: page.php?permalink=events/foo page.php?permalink=events/foo/ page.php?permalink=ru/events/foo page.php?permalink=ru/events/foo/ The events is dynamic, it could be specials or packages. My dilemma is basically; I need to detect an empty link in order so I can feed a robots no index meta ...

Using PHP script to fill in XML

Hi - we are all familiar with "embedding" PHP scripts in HTML pages to do tasks like displaying form results, but how can that be done in a way that displays XML? For example, if I wrote: <?xml version='1.0' ?> <Response> <?php $body = $_GET['Body']; $fromPh = $_GET['From']; echo "<Msg>Your number is: $fromPh,...

Is there any difference between SQL running in code vs the MySQL command line?

I have a SQL update statement I am running from inside a PHP program. It is prepared and then executed. When I run it in PHP, it reports a constraint violation. When I run the exact same statement from the command line (which I am getting via dBug()), it works with no errors. This sounds impossible, so I keep looking for differences ...

PHP Get only directory path

Hello, I have: $page_file_temp = $_SERVER["PHP_SELF"]; which will output: /templates/somename/index.php I want to extract from that path only "/templates/somename/" How can I do it? Thanks! ...

How can I load static configuration information

In my code, I use JavaScript for UI and PHP for back end. I also use PHP to store application settings and sometimes my UI code needs to access this information. My configuration file looks something like this (config.php): $resolution_x = 1920; $resolution_y = 1080; etc... When I need to access any of these settings form JavaScript, ...

Zend Framework - POP3 - retrieving message source

Is it possible to retrieve the complete message source (similar tu Unix Mbox format) using Zend_Mail_Storage_Pop3 from the Zend Framework? I'm using the following code to retrieve messages: $mail = new Zend_Mail_Storage_Pop3(array('host' => 'localhost', 'user' => 'test', ...

How do I access variables with hyphenated names in Smarty?

I've got a PHP page that parses an XML file with SimpleXml, then passes that object to a Smarty template. My problem is that the XML file has hyphens in its tag names, e.g. video-player. In PHP, this is no problem, I just use $xml->{'video-player'} and everything's fine. Smarty, on the other hand, throws a fit when I try to use that synt...

How do you make thumbnails of videos? Using flowplayer free.

I'm making a "video sharing site" just for learning and fun. I am using FlowPlayer as my player for videos. Now Im gonna make a page that will list every video, and a want preview picture of the video. Like: http://www.youtube.com/videos How do you do that? With the player or can you do it with php?? Ive looked true Flowplayer forums. B...

Should I have a separate copy of all CakePHP files for every new application?

I'm extremely new to CakePHP. From what I've gathered, it seems like I can have multiple applications that all share the same app and cake directories. So, let's say I have two applications. CakeFacebookApp and GenericCakeBlog. These applications are completely separate from each other and will have completely separate URLs, but they...

What is a Professional way to customize Fan Page on Facebook

What is more professional way to customize the Fan page on facebook, on is staticFBML - seems pretty newbie way ... ? ...

Help with PHP function that will take $bytes and $rate (per GB) and return $total

I was hoping someone might help with a function that given two parameters: @param $bytes : total amount in bytes of data consumed @param $rate : rate per GB, example .22 (for 22 cents) @returns Total amount owed Rounded to nearest cent of course. Thanks in advance for any help. ...

PHP forms from various frameworks - Strengths/Weaknesses?

Looking around, there are plenty of options available for form management in PHP from several frameworks: Zend, CakePHP, CodeIgniter, Symfony, and probably several others offer solutions. All else being equal, which set of form classes do you prefer? What makes any of these better than the others? ...