php

IE error with .options.length=0; or .setProperty('selected','selected') ?

Internet Explorer 8 and 7 fails with error when i update the select box with new option and choose the selected option. In other browsers this works fine and without errors. I use Mootools 1.2.3. <?php $getdestiny=$_GET['dest']; $getcountry=$_GET['countr']; print "<script type='text/javascript'> window.addEvent('do...

Which CMS with dynamic news and a build in media gallery is fast in install and configure?

I'm looking for an webbased system (likely a CMS?) with the following properties: Allows to create dynamic news items on a news-page based on a simple login authentication Contains a dedicated media gallery (images+videos) where the content has to be supplied through the site (not through admin functions or other backend systems) usin...

php and mysql selecting 5 rows from mysql

i am tryng to select 5 mysql rows from the database and display them like $row[1] ect.... in php i am not sure how to do it an someone lead me down the right way please Ok i hav looked a bit more i wanted it to come out 1 - 5 and i wanted it to display the names $result = mysql_query("SELECT * FROM table ORDER BY id DESC") or die (m...

PHP multilanguage site

Hi, I want make multilanguage site with PHP based on SESSIONS like this site untiny.com I try with this code but not working : <? session_start(); $lang = $_GET['lang']; if (!isset($lang)) { include ('ar/language.php'); $lang = "ar"; } else if ($lang == "en" ) {include ('en/language.php'); $SESSION["lang"] = "en"; header(...

Regular expression pattern help

Trying to find "\[" in my content don't get any results. I use this pattern: preg_replace('/\\\[/', $content, $matches); What's wrong whith my pattern? Thank you. Update. My fault, I meant preg_match_all. ...

Simplify my Jquery xajax like function

Basically I was trying to replicate one of the things that xajax gave me with Jquery -> The ability to define what my response modifies server side without setting anything up client side. Works perfectly as is, but each time I want to call a different Jquery function, I have to add it to my if statements. Each element in the response...

Validating html generated by php

Hi, I'm new at web development, so to make sure I'm writing good code I've been using w3.org validation tools. I'm currently working on a project where I generate a lot of my html with php functions, and I'd like to validate the html, but w3.org doesn't support that. The only way I've found to do it is to render my code, view source and...

move_uploaded_file does not support utf8 file name

I am using uploadify and the file name retrieved from $_FILES["fileData"]["name"] on server side is in utf8. It may contain chinese or japanese characters. After the following codes run, $tempFileWithPath = $_FILES['Filedata']['tmp_name']; $destFile = $_FILES['Filedata']['name']; $destFileWithPath=myUtility::getFileRepositoryPath().'/'...

re-captcha question

I have two pages apply.php (landing page) and mail.php which is the majority of the code for a online application project that ive been working on I have a re-captcha account and I don't seem to understand how to apply the re-captcha code on two page senerio. when i had all my code in one page i simply put the "mail();" code into the c...

Zend_Auth: How to check role in addition to username and password?

I want my 'users' table in my database to contain users of all different levels (members, moderators, admins, etc). So a column in my 'users' table is role. I want to be able to check the role to see if they have permission to log in to special parts of the application. How can I do this? Here is my auth adapter so far: protected functi...

Doctrine and Zend_Form Validation

I am using Zend Framework and Doctrine on a project and was wondering if anyone can suggest a good way to integrate Doctrine's validation with Zend_Form. I'm trying to avoid code duplication. ...

Email: SMTP and php

Hi Trying to send an e-mail via SMTP, its not working, any help? //SMTP info $host = "smtp.gmail.com"; $username = "[email protected]"; $password = "password"; $from = "Taylor";//From email address $to = "[email protected]";//Change this to your inbox $headers = array ('From' => $from, 'To' => $to, 'Subjec...

PHP asynchronous processing with beanstalkd. Do you recommend it?

Hello, would you recommend using beanstalkd [ http://kr.github.com/beanstalkd/ ] for asynchronous processing in PHP ? I need some feedback/comments pros-cons, from anyone that has used this lib. Thanks, ...

This is OOP or like OOP

Hi, For long time reading and testing, but i want know. This is correct PHP OOP code, or not Class User { function Add($Name, $Password){ $sql_str = "INSERT INTO User SET Name = '$Name', Password = '$Password'"; $sql->do_sql($sql_str); } function Del($UserID) { $sql_str = "DELETE FROM User WHERE UserID = '$UserID'";...

How to create SQL query for "Likes in common"

Currently I'm building a system (php and mysql), that on the user profile allows you to add "favorite music artists" to a list. 've been trying to figure out a way to compare the user likes to other users and return a "recommended friends". For example: User A Likes - 1 - 2 - 3 - 4 User B Likes - 1 <- A likes - 5 - 6 - 7 User C Likes...

After Facebook Connect logout, Facebook PHP class still thinks user is logged in

When a user first hits my site's login screen, I have Facebook Connect determine if the user is logged into Facebook and reload the page if true: <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"&gt;&lt;/script&gt; <script type="text/javascript"> FB.init('MY_API_KEY', '/xd...

How to switch layout files in Zend Framework?

I'm sure it's a simple one-liner, but I can't seem to find it. How can I use a different layout file for a particular action? Update: This worked for me, thanks! // Within controller $this->_helper->_layout->setLayout('other-layout') //other-layout.phtml //Within view script <?php $this->layout()->setLayout('other-layout'); ?> ...

PHP command-line: How do I read in a typed-in password without displaying the typed chars on the console?

I want to read in a password as part of a command-line script, but do not what the typed password to appear on the screen. This seems to be a fairly common feature in command-line apps, but my Google-fu has failed in identifying how this works. Is it a feature of the OS? Do you have to intercept the input stream somehow so it doesn't wri...

php combining url with variable

Hello, I want to do define the following variable $url $url = www.example.com/$link; where $link is another predefined variable text string e.g. testpage.php But the above doesn't work, how do I correct the syntax? Thanks ...

PHP Tree building function breaks when depth = 4 but works when depth <4, why?

Hi all. Frankly this is part of my uni assignment, BUT I have already done quite a bit... so please feel comfortable and keep reading since I am not asking for a cheat sheet or so :) The project is now deployed on my website Okay, I might have found the reason just minutes ago: array_push() fails after pushing many items in an ar...