php

Using Regex in MySQL WHERE clauses under specific conditions

Essentially, I'm working on a PHP-Based CMS and I'm looking to add an additional layer of security for the plugin infrastructure. Currently authors must secure their SQL clauses using traditional means, which is no problem. The CMS accepts queries in seperate parts, and the WHERE clause is one part. As an added layer of security, what I...

paging xml data

how do i implement paging on xml data which is being called through php. i've been trying various jquery pagination on the xml file with no luck. html/php code reading the xml data: <div id="display"> <?php error_reporting(E_ALL); ini_set("display_errors", 1); $xmldoc = new DOMDocument(); ...

Combining values from 2 XML objects in PHP

Hi! ...well, actually I have an object which looks like this: object(AleParserXMLElement)#39 (4) { ["name:private"]=> string(6) "rowset" ["data:private"]=> object(SimpleXMLElement)#42 (2) { ["@attributes"]=> array(3) { ["name"]=> string(6) "skills" ["key"]=> string(6) "typeID" ["columns"]=> ...

PHP Alternative Control Structures, any drawbacks?

I've been working with PHP code that generates HTML without any templating, and it's quite spaghetti and difficult to read with the way they've structured it. One way to drastically improve following the flow I've noticed is to use : endif instead of { } blocks in some cases to increase readability. (See http://php.net/manual/en/control-...

How can realise in PHP PDO WHERE IN statment

Params: $params = 2826558; # Necessary Object $params = array(2826558,2677805,2636005); # NULL Execution code: $data = $this->DQL_selectAllByCampaign_id() ->execute( array($params) ) ->fetchAll(); var_dump( $data ); SQL Query: $this->DQL_selectAllByCampaign_id = $th...

How to link a large number of items at one time in mysql and php?

For example: There are 10,000 items in a list and the user needs to be able to select a portion of these based on whatever criteria, and then put them into a group. So as the user, I filter the list of these 10,000 items based on whatever, hit select all and then click "Group". I'm trying to come up with the most efficient method of l...

when to use MVC on PHP ?

ok i think i am pushing my self to far here, im createing a project in my own mvc even i dont know what mvc its self, <?php class init { function __construct() { $this->enviroment(); $this->start(); } function enviroment() { /* Required Classes */ ...

My $_SESSION variable will not hold its value. Any Ideas on why?

I want it to increment and decrement the value in $_SESSION['selection']. Mousedown on next form results in: "The session is 1". Mousedown on previous form results in "The session is -1". Here is the code: <?php if (isset($_POST['next'])) { displaynext(); } else if (isset($_POST['previous'])) { displayprevi...

How to Explode and combine values in a wordpress query

I have a multiple pages in wordpress all with a single custom field called portfolio-section. some examples of the data are page 1 : portfolio-section = red page 2 : portfolio-section = blue page 3 : portfolio-section = red page 4 : portfolio-section = red,blue now im executing a wp query: $querystr = " SELECT wposts.* FROM ...

What does ACM stand for?

I see that phpBB uses the term often to describe things like XCache, ACP, eAccelerator: http://wiki.phpbb.com/display/DEV/Cache, but what does ACM actually stand for? I understand that all of these are PHP caching mechanisms and I use XCache myself, but I could not find what "ACM" actually translates to. ...

How to eliminate "duplicate" URL MySQL rows which may or may not start with www?

I've been using a Drupal module called FeedAPI De-Dupe to remove duplicate records from my site's (MySQL) database. The module does a great job, but I'm still left with some "duplicates" when the URLs sometimes contain "www" and sometimes don't. The code handling the duplicate detection is: case 0: //url-based $sql = "SELECT n.nid ...

mailto: replacement due to size

I have a web page that generates several email addresses. I need to be able to click on a link, which will open an email client such as outlook and populate the bcc field with those email addresses. In the past, we have used html's mailto, which achieves this goal perfectly. My problem now is that I need to send emails to over 200 p...

How to make a permanent tripcode?

I mean, crypt()'s return is always different. So how do websites like 4chan do to give a permanent tripcode to a password? Are they stored in a database? ...

Best practice for Web-Interface modifying config-file

Hello altogether For a new project, I have to write a webinterface, which has the capability of modifying a configuration file. The system this will run on is a standard debian installation with apache and php5. The only idea I came up with so far, is to write small c programms, setting the setuid bit to root and supplying the string t...

Search form to submit query to external site

I would like to be able to type a search phrase into an input box, click send, and have a tab open to a new site where the address is something like http://externalsite.com/?q=SEARCH_PHRASE. Is there a way to provide this functionality using PHP? I'm trying to avoid using javascript. ...

Amazing Micro Applications and Open Source Projects

As time goes on people are finding smaller, more efficient ways to do things. I'm really impressed at some of the amazing things people have made that are so incredibly simple. Our quest for "a better wheel" has lead to things like a 3Kb javascript framework, a 1kB ORM, a tweet sized framework & DI container, an entire forum in 1kb, a 9...

Error in phpmyadmin though runs fine in php script

Ok so this one is strange and I'm thinking there must be a problem in my sql query but I don't see anything wrong with it. What is happening is that I have a script that I am running in a php script that retrieves all categories that a user has signed up for as well as how many other people have signed up for the same category. When I ru...

POST is not getting correctly parsed into $_POST

I have a form, and it outputs this into POST: <?php print file_get_contents('php://input'); ?> %2Ffaults%2Ffault%5B1%5D%2F%40signal=gnc.gnc_in.ttag_sec&%2Ffaults%2Ffault%5B1%5D=increment&%2Ffaults%2Ffault%5B1%5D%2Fboolean%2F%40value=false&%2Ffaults%2Ffault%5B1%5D%2Fincrement%2F%40value=6677&%2Ffaults%2Ffault%5B1%5D%2Fthreshold%2F%40co...

[Fri Jul 30 20:53:33 2010] [error] [client {IP}] Premature end of script headers: /home/siteroot/public_html/power/fckeditor/test.php

Hi Guys, A problem has been reported to me that uploading through fckEditor will not work. After messing about with some settings it turns out that running php files in the fckEditor folder will not work and an Error 500 is returned. When I checked the log files the message in the subject was returned. The script is simple: <?php echo ...

Using PHP to hide video URL

I'm trying to play videos on my site, but I want to hide the location of the video. I found a php script somewhere that has me do this: $iFile = '/path/to/file.m4v'; header('Content-Type: video/x-m4v'); header('Content-Disposition: inline; filename="'.basename($iFile).'"'); header('Content-Length: '.filesize($iFile)); header(...