php

Tunneling two or more objects

Hey, I have two separate objects, a main and a "child". Its physically not a real child object, because I add the whole parent through the constructor to the child. Like this: class core { public function __get($class) { $this->load($class); } public function load($class, $file = null, $lib = true) { ...

Uploading images through PHP into SVN and storing meta data in multiple databases

We're currently designing a rewrite of our PHP website. The new version will be under SVN version control and have a separate database for development and live sites. Currently we have about 200,000 images on the site and we add around 5-10 a month. We'd like to have these images under SVN as well. The current plan is to store and ser...

Variable value as part of array key

$pname = "postback_".$data; $_SESSION["$pname"] = $data; It is not working. How to use it? ...

Reduce chances of PHP plugins being malicious

Hey all, I was wondering what steps you use to keep downloaded plugins from being malicious? For example, what does wordpress do to ensure that the plugins you download do not simply execute unlink('/') I'm assuming it partly depends partly on downloader to install plugins to use his or her own discretion, but do plugin systems take m...

Disallowing characters in a password?

Is there something special about characters that should be allowed/not allowed in a password? I store the password in the db hashed/salted and use PDO to prevent against injection. Is what I'm doing enough? Recently I came across a system that disallowed a number of characters, don't remember all of them, but one was the ampersand &. W...

add a class to particular row in codeigniter using table class

Is it possible?? ...

PHP/MySQL Changing data in a database by clicking a div on the website?

Hi Guys, I have a website that displays a table of a list of people and a value of 1 or 0. If the value is 0 the cell background is green, it ifs 1 its red. How would i make it so clicking the cell will change the value (and therefore colour) and write it to the database? Below is my code. Many thanks, Stephen <? include("dbinfo.inc...

trying to post password via curl but getting a blank page instead of content

i want to post my password to a page via curl and grab the result, result should be a page with a content. here is my script function f($password){ $url="http://upload5.fileflyer.com/view/7MSG4GUCYVN7E"; $useragent="Opera 9.7 (Windows NT 6.0; U; en)"; $ref="http://fileflyer.com/view/7MSG4GUCYVN7E"; $data = array()...

How can I read from and write to a local directory from any self-hosted Wordpress blog page using PHP?

I want to read and write text files to /data/filename.txt using php. This functionality works fine on the main page, but if I click the Previous Entries button (which switches to page 2), the php script does not seem to be present (as the Flash files are unable to access it). ...

Why is my session variable not set here?

Hi I am setting a session variable inside a function studNameDetails1() while I am trying to retrieve it in a function ViewMark(). These are my two functions but there is no result: function studNameDetails1() { $_SESSION['ATTsub']=$sub_id = $ID[5]; } function ViewMark() { echo $_SESSION['ATTsub']; } When I echo the va...

Why do I receive different HTTP response codes when accessing Facebook XML feeds from different servers?

Hi all I'm using the Zend Framework, specifically the Zend_Feed class, to grab the Facebook XML feed at http://www.facebook.com/feeds/page.php?format=rss20&amp;id=120635284755 and merge it with a similar Twitter feed for display on a website. The problem is that while I can grab the feed absolutely fine from both my local and remote te...

PHP/codeigniter: Link not working when clicked, but fine if opened in new tab

On one particular page I have a button that toggles a certain field in the db. The function is function source_toggle_paid($event_id = null, $attendee_id = null) { $this->authentication->checkLogin(); // Check if the user is logged in // Check the parameters provided are null if ($attendee_id == null || $event_id == null)...

Least memory intensive way to read a file in PHP

I am reading a file containing around 50k lines using the file() function in Php. However, its giving a out of memory error since the contents of the file are stored in the memory as an array. Is there any other way? Also, the lengths of the lines stored are variable. @gordon : Here's the code. Also the file is 700kB not mB. private...

Text in front of variables inside a foreach loop

I have set up a small script to handle a page where I have three checkboxes. The HTML for the checkboxes looks like this: <input type="checkbox" value="Ex1" name="Check[]" />Ex1 <input type="checkbox" value="Ex2" name="Check[]" />Ex2 <input type="checkbox" value="Ex3" name="Check[]" />Ex3 And the PHP script for these: if($_POST['Che...

How to treat a php file as directory

Hello, I wanted to know if it is possible to treat a php file as a directory so that index.php/abc/def really calls index.php. The index.php should then know the subdirectory path (ie /abc/def). I'm searching a plain php solution. I know that I could use mod_rewrite to map the directory to GET-parameters. ...

Regex fails to match for no obvious reason.

Consider the two following regular expression snippets and dummy HTML that it should be matching: Apparently, I can only post one link until I get more reputation, so the link below contains the three links I referenced above: http://pastebin.com/Qj1uxfdk The difference between the two snippets, if anyone is wondering, is a removed ((...

Search mySQL with PHP, using a WHERE wildcard or an IF statement?

I'm letting users search my database for data by city. My query looks like: $results = mysql_query("SELECT * FROM mydb WHERE City='".$city."' LIMIT 10"); I want a user to be able to search 'all cities', so I'd like to either remove the WHERE statement if $city=='all cities'; or use a wildcard for the WHERE statement that matches all ci...

How to make a page stop responding while loading? (PHP)

Is it possible to end an PHP process from within PHP, to make it seem on the client side that it stopped responding, from a users perspective not from a technical point of view. This is not a solution: <?php die(); ?> The idea is there is a file that's being downloaded and I don't want it ever to complete. Possible solution: <?php s...

Move column into new table in mysql

I'm changing my database structure and I want to do the following thing: I have one table for registered users that holds almost all the information about my site users. There is also one other table that holds information about the amount of points each user have. It has only two columns: user id and points. I want to move the points co...

Search for column format

This is a bit of a difficult problem for me to word, and I may be going about it in the completely wrong way. I'm storing a set of options in a database, where each option is its own column. The user can change the number of options, however, so I need a way of allowing PHP to always select all the options. Let's say I have these colum...