php

Does legacy salt string support in Moodle 1.9.7 include support for non-salted passwords?

We have an active Moodle installation recently updated to 1.9.7. This site has never used password salts before. I want to enable password salts on the system, as Moodle recommends now for 1.9.7, but I am not sure if the legacy salt support setting includes support for non-salted passwords. Reviewing the password sale documentation on M...

Detect when MySQL tables are in readlock state (from PHP)

Hello, I need to get a PHP app to detect when it's MySQL database is in readlock, and throw an error message. Easy, but is there any MySQL command we can run to check current lock state, rather than just having the system get stuck, as the query is queued for the unlock? Cheers, Johnathon Edit: The database is being put in readlock b...

PHP codesniffer - how to teach it to ignore white space?

I am using PHP CodeSniffer to check if my code complies to Zend standards. 80 chars per line is one of them. But I prefer to indent line with white spaces and sniffer treat short lines with line indentations as long lines. Is there a way to teach it to ignore whitespace identations? Or it makes sense and the farther my line is indented,...

Need to increase PHP memory_limit for specific directory NOT entire server

I'm running wordpress 2.8.6 as fcgi with safe_mode=on, on plesk9/centOS64. wordpress was installed by installatron. php.ini is being read from /etc/etc/php.ini I need to increase php's memory_limit, because I get many mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40961 bytes) in /...

Help understanding what this line of PHP is doing

The variables values are listed below $v['flag'] = 10 kPOSTAGE_HOME = 8 So what the heck does the following line do?! if(($v['flag']&kPOSTAGE_HOME)==kPOSTAGE_HOME) { //do something } ...

PHP UTF-8 charset accentuation

Hi guys, Sorry if this question is already somewhere but I need a more pratical approach: The page is set like this: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> later in php i use the following line $v .= "<a href='" . $videoEntry->getVideoWatchPageUrl() . "' rel='vidbox' title='" . $videoEntry->getVideoTi...

Mysql fulltext short questions

If I want to search a mysql field for whole words only, and not use the LIKE syntax, I would use FULLTEXT. But I don't know how it works really... I have noticed in PHPMyAdmin that I can set the indexes of fields to 'fulltext'... Is this what I am supposed to do? And then use the 'match' syntax to search the words agains the 'search st...

Hiding parts of a web page from non-members using PHP and MySQL?

I'm trying to hide the following code listed below from members that are not logged in how can I do this? And what parts of my code do I need to change or add to it? Here is the code I want only logged in members to see. <div id="r"> <h2>some thing</h2> <form method="post" action="index.php"> <fieldset> <input type="text" siz...

Portfolio for php developer

HI, Not really 100% coding related but I could do with some help. I am going for an interview next week and I have been asked when I attend the interview to provide a portfolio of my work. Everything I have done is all in php how would I show examples of this work in a portfolio? I am not looking a template to copy just some help...

MVC model where to put data specific checks

I'm writing my first application with Zendframework. My question is about the Model–View–Controller (MVC) architectural pattern. I currently have a model with refer to a database table. Here's the classes that I currently have : Model_Person Model_PersonMapper Model_DbTable_Person Now, I see a lot of examples on the net, but all of...

if function inside sql query?

function get_tags_by_criteria($gender_id, $country_id, $region_id, $city_id, $day_of_birth=NULL, $tag_id=NULL, $thread_id=NULL) { $query = "SELECT tags.* FROM tags, thread_tag_map, threads WHERE thread_tag_map.thread_id = threads.id AND thread_tag_map.tag_id = tags.id AND threads.gender_id = $gender_id ...

Mysql Fulltext help

I am using this to search my table: if ($querystring!=''){$query_cont .= " AND MATCH (headline) AGAINST ('$querystring')"; } Thing is, in the 'headline' field I have a value of say 'BMW'. Then when I enter BMW in the search field, that is "$querystring = 'BMW'", no results are found. I have set the index of the 'headline' field to ...

Unable to upload file to ftp server using php

I am trying to upload file to FTP server using php but it is not getting uploaded. Code: $response =<<<RESPONSE <cdm:Response> <cdm:header exportTime="{$export_time}" baseVersion="{$baseline_snapshot_id}" version="{$this->snapshot_id}"> <cdm:countryCode>{$this->domain}</cdm:countryCode> <cdm:descript...

Input PHP Variable into HTML Select Tag

Hello: I have a php variable ($list) that is a list of values separated by commas. I am trying to figure out how to convert or input this variable into a HTML select tag. Here is what I have so far: $dbquery = @$db->query('SELECT * FROM Company'); while ($queryText = $dbquery->fetchArray()){ $array[]=$queryText['Company_Name']; } /...

Passing objects/references as function parameters

EDIT: Language is PHP. So, I'm implementing a listener/observer pattern. One of the objects I implemented was an object for including files. Which works in a way like this: class IncludeEvent extends Event { protected $File = ''; public $Contents; .... public function Begin() { .... // this is the ONLY t...

More efficient way to go through an array in PHP

Hello. I've created this method to change every value in an array. I'm kinda new to PHP, so I think there should be a more efficient way to do this. Here's my code: foreach($my_array as $key => $value) { $my_array[$key] = htmlentities($value); } Is there a better way to do this? Thank you in advance. ...

using static wordpress login form on front page but links to another wp install?

Ok heres the senarrio, i have 4 wordpress installs as follows top level = mysite.com/ *main site; 1st level = mysite.com/site1 *1st site 2st level = mysite.com/site2 *2nd site 3st level = mysite.com/site3 *3rd site The front page on the main site has login forms to each of the three sub sites. each site has different users, settin...

fetching mysql data with multi color with php

how can i fetch data from mysql with php and display it in mutliple color....like [gray]first post [white]second post [gray]third post [white]forth post i know mysql_fetch_array but how can i display data with multi color like above ...

What ways are there to simplify the install of a php app for linux and hopefully windows as well?

I have a php application ( http://github.com/tchalvak/ninjawars ), essentially a php-based webgame that I run at http://ninjawars.net . I frequently configure and install the app for myself for localhost development, and it's a somewhat trial-and-error hacked-up process. Now that I've open sourced the app, I've got some users wishing t...

How to get "long polling" with flex 3 and php?

I am working on a project for a client whereby their cms will be flex 3 and php. There will be multiple clients using it at once and I am trying to make it to where when one person makes a change, the others will see it. My Question Is: If I am using Flex 3 and PHP, how can I implement something that acts like 'server-push'. Is long pol...