php

Wordpress two conditions (and if)

I'm writing a sidebar for my site and I'm trying to check if: The page is a post, via: is_post() The author can edit the post via: current_user_can('edit_post') I'm trying to combine both of these conditions, but I'm horrid at PHP and I just can't figure out the syntax to do so. I figured it'd be something like below. Could you pleas...

Handling errors with curl_multi_exec

Hello, My question revolves around the use of curl_multi_exec in PHP. I am using code similar to the example shown on this link: http://www.rustyrazorblade.com/2008/02/curl_multi_exec/ With about 10 URLs to execute, I sometimes come across the error message: Fatal error: Maximum execution time of 30 seconds exceeded in... This message ...

$c = mysql_num_rows(mysql_query($q));

Hi there, I was wondering if this $c = mysql_num_rows(mysql_query("select * from action_6_weekly where code='$code'")); is considered valid PHP? Or do I need to do the following? $r = mysql_query("select * from action_6_weekly where code='$code'"); $c = mysql_num_rows($r); this is what i am actually doing: if($entry == '9') ...

Wordpress | Automatically repost entries to the start page by date

Hi, I'm looking for a solution to regularly show a post on the startpage. The way to archieve this is to update the last modification date of a post, which can be easily done using an SQL statement. Alas this skips the regular Wordpress update hooks such as "post new entries to twitter". So I'm looking for a PHP cronjob script to "emu...

Form renderer for PHP

I tried the Drupal form APIs and like it a lot. What stand-alone PHP classes exist that perform similar functions? ...

create new options for magento dropdown field at import

Hello, Here is a question for magento experienced users. My case is the following: In a Simple Product i've created a "serie" attribute that has a dropdown list type in order to let magento use it in "shop by" menu. however, i'm importing data from existing legacy database. i want to automatically create a new dropdown option from ...

Test Suite for PHP

Are there any good open source php test suites? So far I found only http://www.lastcraft.com/simple_test.php but I couldn't found much reviews about this project. Can any one suggest me some good test suites for the php? ...

Hidden features of the Lithium framework?

Since there isn't a lot of documentation out there, some features of the Lithium PHP Framework are not well known by the public. Are there any cool code features which I would miss if I just use the framework as shown in the docs? ...

php latest upload

hi For various dull reasons, I'd like to assay a script that looks at the files in a directory, copies the filename of the latest and inserts it into a mysql table. It shld also check if the insert has been done already. I am a web tinkerer (i work in construction) so my question may seem a bit ingenue but what functions do I need to g...

Specifying record criteria on more than one model in one pagination call.

Hi all, I am stuck on pagination in CakePHP 1.3. I am trying to paginate feePayment records based on certain criteria. feePayments belongs to Students which in turn belongs YearGroups. I want to paginate 'unpaid' feePayments for each year group. The problem I am having is that the SQL query seems to only take into account the conditio...

Basics of a remember-me system

Hello, I am using a PHP / MySQL login system. I would like to add a remember-me to it. What are the basic mechanics of a remember-me? Does it involve adding a new column to the table in MySQL where all of the user information is stored, etc. ? Thanks in advance, John ...

strtotime to convert both date and time

Hi, can anyone advise how i would convert a date like "Tuesday, 22 June, 2010 00:00" to a unix timestamp using strtotime()? I need to also store the hours and minutes and it's not clear if is best done using strtotime. Thanks for any help! ...

How to make a javascript redirect within a php if statement

I am developing a personality test, and php result script now just echoes a personality description based on an if statement: if ($i = 5 AND $alpha[$i] >= 9 ) { echo " Description "; } However, instead of this description, I would want to make a redirect to another url. Can't seem to figure this one out. Cheers, Jelmar ...

Validate the uploaded file size with jQuery form validation remote method

Hello all, I would like to do a filesize validation as follows. Please see whether this proposal method makes sense or not. This part alone should work. 1> After the user selects a file, I check whether the file has suffix as png, gif etc. $("#myform").validate({ rules: { fieldForUpload: { required: true, accept: "png|gif...

MySQL - Searching in a multiple value field

In my database table I have the following fields: Table Supplier: id name vehicles A supplier can have multiple vehicles. The field 'vehicles' will store multiple values. At the moment I am delimiting the values on a 'pipe' symbol, although this can be changed to a comma if need be. On my front-end form I have a checkbox list - a u...

PHP regex, space or no character

Ok Im trying to figure out this regex where I have a word, and on either end of the word it can be a space or no character. Heres an example: preg_match_all("/( ?)(" . $piece . ")( ?)/is", $fk, $sub); Where ( ?) is I want that to be "A single character that can only be a space or no character at all". Im trying to basically make a fun...

Codeigniter and multiple inheritance

I've been using Codeigniter to construct the front end of a moderately sized application, and have run into an issue with--what I think may be--inheritance in PHP. Here is what I am trying to do: In following the MVC architecture, I found that I was duplicating a lot of code across models, and decided to create a common Model from which...

Really basic help w/ a php contact form

I feel like I must be missing something simple here... Nothing sends, nor do I receive the success message. <?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "Feedback Form"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $emai...

PHP secure Session Check ?

Example, i have a session that i gave to users that have maching password = stored password, like all simple login system : if ($pSys->checkPassword($AccountData['password'], $StoredData['password'])) { // Checks Password and Username $_SESSION['login'] = true; } so the question is, is this secure enough? function loginChec...

need advise about my coding

hello I develope one small project(finance online game),I`m student and I have not much work experience, therefor I need your advise. In my home.php file player seeing his estates(money,credit,factories,...). Player can take an credit .For it he must click "take credit" button and after that open new window(credit.php) .In credit.php us...