PHP Regexp help
I can't seem to get a handle on what this expression intends to extract: preg_match("/^(?:[\s\*]*?@([^\*\/]+?)\s(.+))/",$line,$match); $line is a line from a text file while $match is an array ...
I can't seem to get a handle on what this expression intends to extract: preg_match("/^(?:[\s\*]*?@([^\*\/]+?)\s(.+))/",$line,$match); $line is a line from a text file while $match is an array ...
I'm running a query daily to compile stats - but it seems really inefficient. This is the Query: SELECT a.id, tstamp, label_id, (SELECT author_id FROM b WHERE b.tid = a.id ORDER BY b.tstamp DESC LIMIT 1) AS author_id FROM a, b WHERE (status = '2' OR status = '3') AND category != 6 AND a.id = b.tid AND (b.type = 'C' OR b.type = 'R') AN...
Hi i have this function which generates a seo friendly url from a string : function seo_titleinurl_generate($title) { $title=substr($title,0,160); $title = ereg_replace(" ", "-", $title); // replace spaces by "-" $title = ereg_replace("á", "a", $title); // replace special chars ...
I wrote a script that is using the FilterIterator class that comes from the Standard PHP Library (SPL) and I get different behabours accross PHP 5.x versions :( Here the accept() function: public function accept() { $current = $this->current(); print_r($current); return true; } and heres its output for PHP 5.3.1: Dir...
Hi, How could I isolate just the text from this dropdown box code into a comma separated list (i.e. the first few would be: 375515,Adeks Op console,Ambassador Extensions): <option value="667">375515</option> <option value="606">Adeks Op console</option> <option value="607">Ambassador Exte...
Hello friends... I just started PHP. I created a form in which there are three textboxes (name,email,age). Now suppose I fill deepak in textbox1 and then I press tab to go on next textbox but I keep it empty and then I press again tab and g in last textbox. As I move to third textbox, on the right side of textbox2 a error message should...
I'm trying to redirect mobile users and am attempting the following, but it doesn't actually redirect at all... $ua = strtolower($_SERVER['HTTP_USER_AGENT']); //print $ua; $search = array('windows ce', 'avantgo', 'mazingo', 'mobile', 'iphone', 't68', 'syncalot', 'blazer'); foreach($search as $sk => $sv) { if(preg_match('/\b'.$sv....
I'm a little stumped on this problem and I've been thinking about it for a while now. I have a table in my DB that holds a tasks. Each task can have a parent task by holding it's primary key in the parent_id field. I have no limit on how deep these tasks can be linked. +-----------+-------+-----+ | Field | Type | Key | +-----------...
For some reason if i inlcude() a file deeper in the file structure to where the file calling the include() is, it works file, or if i include a file on the same level. If i try to go include('../backFile.php') it tells me there was no file? Any help :( ...
Kohana's Validation library has a pre_filter() method which lets you apply any PHP function to fields to be validated, as trim(), etc. I tried to use a static method as a filter, but won't work: $validation->pre_filter( 'field_name', 'class::method' ) What that does is create two filters, one with class and antoher one with method. A...
Hello, I'm trying to force a download of a protected zip file (I don't want people to access it without logging in first. I have the function created for the login and such, but I'm running into a problem where the downloaded file is corrupting. Here's the code I have: $file='../downloads/'.$filename; header("Content-type: applicatio...
Hey, I am trying to make an if statement that redirects them to a different page if true, simple right? I am not sure why this is not working but I am using: if ($_POST['accounttype']=='Paid User - £2 p/m'){ $userid = strtolower($_SESSION['X2X2']); $getuser = mysql_query("SELECT * FROM XXXXXX WHERE X2X2 = '$userid'"); $info...
Wordpress has a nice api system. I'm struggling in creating an equal flexible one using a more traditional MVC interpretation. A typical view class could be like this: class View { public function set($name, $value) { $this->data[$name] = $value } public function __get($name) ... you know how it works } A use...
Hello, I have just moved my working codeigniter site to a new xampp installation on new computer and now when the view loads the php inside the view doesn’t work!! e.g. the addresses in my links have the code in them instead of the base address of the site!!! Can anyone explain this strange behavior??? (using windows 7) Thanks! jk ...
Note: In the MySql database, "dob" is varchar and in this format: mm/dd/yyyy Date of birth, Cvrg Effective Date, & Cvrg Expiration Date need to be changed from mm/dd/yyyy to yyyymmdd when it arrives in excel. Any help is greatly appreciated. Please see the code below: <?php if($qry == "ok"){ // get db connection inc...
Hello friends $.post("include/email_validate.inc.php", { email: $('#email').val() }, function(response){ if(response=="email_exits") { alert("E-mail Address Already Registered"); return false; } else if(response=="invalid_email") { alert("Invalid E-mail Addres...
I'm using Zend_Reflection to generate an extended format set of ctags for use with my text editor. The problem is that you have to include any files that you wish to process. The constructor for Zend_Reflection_File checks to see if the file you wish to reflect has been included, and if not it throws an exception: // From Zend/Refecti...
Working on a wordpress administration form. I need it to go to options.php to update the database options there, but I also need to populate Resource objects within other functions as well. How would I go about doing both actions on the same submit button? <form name=adminForm method="post" action="options.php" onsubmit="UpdateResources...
Alright so I have this drop down populated by a Mysql DB. On change of the drop down the whole page populates information from a the DB. Well what I want when I submit this form (there are two forms on this page) I want it to return to the same client that I just had selected in the drop down. Right now I'm using a session to bring it b...
Hello, Is it possible to install and use ZF (+ its console tool) without access to include_path direcotory? I've tried adding the ...Zend/library direcotry into include_path but without success. I did it this way: php -r 'set_include_path(get_include_path() . PATH_SEPARATOR . "/var/www/.../Zend/library")'; After var_dumping result o...