php

AJAX chat, auto scroll window

Duplicate Scrolling Overflowed DIVs with JavaScript I have an AJAX chat that outputs the messages to a div with overflow: auto so if it gets too long, the scroll bar comes up. Is there is a way to have it auto scroll to the bottom whenever a new message is added? Preferably using jQuery? ...

Only fetch output when element is not being dragged

How could I change the code below so that when an element is being being dragged the script will stop fetching the output file until that element was released? $(document).ready(function() { //$(".draggable").draggable(); $(".draggable").draggable({ containment: '#container', scroll: false }); $(".draggable").draggable({ sta...

Experience using Yii framework for actual PHP project

I've been using Code Igniter for my PHP projects, when I start them from the beginning. It is very nice framework, saves me a lot of work and let me have low level access if I need to do something special. Code Igniter is also faster then similar frameworks by order of magnitude. I came across Yii framework which claims to be even fast...

Complete sifr confusion sifr3 vs sifr2 config

I'm having two major issues on my site: 1) A series of links is cutting off the left edges of the menu items and also seemingly transposing characters from other items in the list 2) I'm having a massive font-size jump: anything between 2em and 3.95em are identical in size, but the moment it steps above that the size jumps hugely. I r...

How do I implement Direct Identity based OpenID authentication with Zend OpenID

Hi Guys, I'm using the Zend framework and the openid selector from http://code.google.com/p/openid-selector/ - however I find I can't login using sites like Google and Yahoo as they use direct identity based login system whereby one is just redirected to a url as opposed to entering a unique url of their own for authentication. I've che...

Whats a better way to write this function. Its gets a remote file and copys it localy, in php.

So yea, im working on a windows system and while this works locally, know it will break on other peoples servers. Whats a cross platform way to do the same as this function fetch($get,$put){ file_put_contents($put,file_get_contents($get)); } ...

How do I get out of PHP development and into .Net development?

I have a B.S. in computer science and have been working as a PHP developer for about three years. I don't want to be a PHP developer and would like to move into .Net development. I don't expect it to be easy, but I am prepared to do whatever it takes to make it happen. I'm confident in my ability to learn the tools, languages, and des...

Using ereg_replace in PHP?

How do I replace using the following code? ereg_replace("%Data_Index\[.\]%", $this->resultGData[$key ][\\1], $var) I want to replace the number in [] %Data_Index to $this->resultGData[$key ][\\1] same %Data_Index and how ex %Data_Index[1] = $this->resultGData[$key][1], $var); replace number in %Data_Index[...........] in [] to $this-...

can we access a javascript function value from outside the function ?

can we access the value of a javascript function from outside the function like if i had a function <script> function test_tree(opt) { val=opt; }</script> can i access the val value from outside the test_tree function or is there a way to access it from php code? i need to be able to access a value from the javascript code to php co...

regex to match any UTF character excluding punctuation

Hello, I'm preparing a function in PHP to automatically convert a string to be used as a filename in a URL (*.html). Although ASCII should be use to be on the safe side, for SEO needs I need to allow the filename to be in any language but I don't want it to include punctuation other than a dash (-) and underscore (_), chars like *%$#@"'...

regex/php: how can I convert 2+ dashes to singles and remove all dashes at the beginning and end of a string?

example: -this--is---a-test-- what I want: this-is-a-test thanks for any answers! :) ...

Unit Testing HTTP-actions

I'm writing Yet Another PHP Framework, and now that I've coded a good deal of stuff, I'm starting to think about unit tests (yes, I know, bad form). Some actions make the framework to modify HTTP behavior, such as create cookies, redirect the browser. Another major feature is that the the visited URI can affect the way the framework sho...

Need help converting VB.NET 08 code to PHP - Getting direct link from MediaFire.com

Hello! I was looking for a way to get a direct link from mediafire's file hosting service. By default, when a user visits a download link, he will be presented with a download page where he has to wait for the download to be processed and then a link will appear. This link will appear in the div id 'download_link'. I googled and found ...

Why am I getting "Undefined index" from my PHP?

When I run this code: <?php if (preg_match('/^[a-z0-9]+$/', $_GET['p'])) { $page = realpath("includes/$_GET[p].php"); if ($page) { include $page; } } ?> I get this error: Notice: Undefined index: p in index.php on line 3 What am I doing wrong? ...

Echoing an integer from a mySQL database

Hi I'm trying to make a website in which a user inputs details on one screen, and they are posted onto the following script. This script is meant to store these details in a database along with a unique integer ID (which it does), and then generate two links containing the unique ID of the record just created. Since the database creates...

How can i convert a php page into .doc file with php

Recently i worked in a project. On this project I need convert page into a Microsoft word document (.doc file) and offer the document for download, all using PHP. But I can't solve this problem. Please help me. Thank You very much, Arif ...

Best way to design a scaleable hits/analytics system?

The company I work for creates applications for the Blackberry platform. We've been working on a proprietary "analytics system" that allows us to embed code within our applications and have the applications report back some stats to our central servers every time they're run. Currently, the system works ok; however it's only in beta wit...

$this->a->b->c->d calling methods from a superclass in php

Hello i want to make something on classes i want to do a super class which one is my all class is extended on it ____ database class / chesterx _/______ member class \ \_____ another class i want to call the method that is in the database class like this $this->database->smtelse(); ...

Associative arrays and binding parameters

I've gotten a little confused with the PDO::prepare functions. I have something like this array('user_email'=>'[email protected]','user_pass'=>'password') and i'd like to translate it into something like this INSERT INTO user_info (user_email, user_pass) VALUES ([email protected], password) using parameterized queries with PDO (or mysqli,...

Do you consider it bad form in PHP to access super globals within class methods?

Take an example login() function within a class Account. class Account { /* Class variables */ public function login() { if(isset($_POST['username']) else if(isset($_SESSION['accountId'])) return $this->_sessionLogin(); else if(isset($_COOKIE['username']) else return false; } ...