php

PHP Render/Redirect AJAX Call

Hello all, I am working on a PHP application and missing some of the functionality that Rails has. I currently have an AJAX form that when submitted accesses my_page_save_ajax.php. After I process the form and save it, I would like to redirect the AJAX call to either my_page_show_ajax.php if successful or back to my_page_edit_ajax.php i...

printing meaningless lines of text prevents page download, but too many lines prevent from getting all entries in a mysql table. Why?

Can anyone of you help me understand the behavior I get when visiting this page? <html> <body> <?php $liendb = mysql_connect("localhost","",""); mysql_select_db ("test"); for($i = 0; $i < 418; ++$i) { echo("Any old text<br />"); } $resultatSQL = mysql_query("SELECT...

php sqlsrv_fetch_object performance

Greetings! I am attempting to solve a few performance issues which are cropping up on our site. As part of this effort I have begun profiling our most trafficed pages according to GA. Essentially I have determined, as I originally suspected, the majority of time spent is in database related traffic... makes sense. Unfortunately, when...

Blog model or Create_Blog model for MVC framework

I am building a blog based on a self-rolled MVC structure. I want to build my own, not used a 3rd party. What is the best way to handle the creation of a new blog? Heres two options i can see...which is better, or is there something i haven't thought of? Instantiate a blank (doesn't go fetch blog info from db) Blog model, set all the ...

how to count all rows belonging to userid ?

$userid = $_SESSION[userid] $sqll = mysql_query("SELECT count(id) FROM entries WHERE userid='$userid'"); Is using count(id) efficient? Or is there a better way? ...

Wordpress subfolder needs .htaccess redirects and whitelist

Background: I have a site that displays songs with the Post structure of .com/song/foo.html I am adding every song to an additional child category called "private" that uses a different template (inserts premium content in custom fields), so the structure of the private versions of the Posts will be .com/song/private/foo.html. Question...

How do you create a different theme for each server in phpMyAdmin?

Is there any way w/o majorly rewriting the phpMyAdmin source code to have a different theme chosen based on server? I see it's easy to change themes, but it applies to all servers. Reason I'd like to do this is so that when I perform a query on production it shows a different color right there and I won't confuse it with a query on de...

Stacking Static Classes in PHP

Is there a way to make a static class where it has another static class as a member? E.G. Parent_Class::Child_Class::Member_function(); ...

Setting value in Nested Php Array.

Hi I'm trying to loop through a array and set a keys value. Very basic question. The Code I tried is below. http://pastebin.com/d3ddab156 <?php $testArray = array("bob1" => array( 'name' => "bob1", 'setTest' => '2')); foreach($testArray as $item) { $item['setTest'] = 'bob'; } print_r($testArray); I imagine I'm missing somet...

MVC Model get() and set() vs. straight-up $model->var = val

When is the right time to use functions to set variables inside of my models, verse simply directly assigning them? AKA... When do I use: $model->set('status','active'); ...instead of: $model->status = 'active'; ...

What programs are used to build standalone desktop widgets that interact with online php and mysql?

I have seen mention of Java and Python. I need something that can be installed on a users desktop without them having to also install Java or anything else. User simplicity is a must. This widget will log into an online php based calendar that accesses mySQL. Any pointers on what I should be reading up on? Python? Thanks! Joel Up...

PHP, Dwoo - Variables

Hi I'm trying to convert this to dwoo: foreach($duplicates as $duplicate) { echo "<tr>"; foreach($column_list as $column) { if(@$duplicate{$column . "_diff"} == 1) { $id_is_different = ''; echo "<td style=\"background: #333333\" >". $duplicate{$column} ."</td>\n"; } el...

PHP Foreach Loop and DOMNodeList

I am trying to determine the end of a foreach loop that is seeded with a collection of DOMNodeList. Currently, I am using a for loop would like to avoid having a 'magic' number there. I do know there are only going to be 8 columns, but I would like the code me generic for other applications. Is it possible to convert this to a Foreach...

Send activation email to user

How would I do to check if a email actially exists? Cant understand how sites do to send mails with a unique link that the users clicks to validate that he is the owner of email =/ Make a 2 new columns called activationkey and activated and store some random string, send an email with the activationkey, and update the users activated =...

Pages loads twice on Firefox?

Hello all, I thought I had answered this question before thanks to StackOverFlow, but I hastily took an answer and it turns out not to be the real cause to my problem. I have checked my Apache Access Log: This is me browsing my web app on Google Chrome Browser. 127.0.0.1 - - [06/Jan/2010:22:17:35 +0000] "GET /webs/end/new.php HTTP/1...

PHP json_encode results and jQuery

Hi stackers, I'm trying to take a jSON encoded string out of my database and loop through the items but I'm having some difficulty. Here's the string in the database: ["volunteers","seat_dedication_program","memberships"] And here is the code: //Looks for _checkbox when looping through my database fields (object dbVals) and turns i...

Is there an api of stopbadwares to check if a url is dangerous?

Hello. i want to use the functionality of www.stopbadwares.com and implement it in my web app using php. so i can pass a url and check if it's contains badwares or it's dangerous for use. is there an api, or class, or something to do that ? or even if there isn't, is there a similar service, to protect my users from sharing bad links ...

How to handle REQUEST in PHP

is there a class to handle $_REQUEST that makes the life of a php developer easier? I want to handle the client requests easier. I dont want to test with if(is_set($_REQUEST['blabla'])) {makesomthing();} I wish there could be a solution like this. class rpclike { public function getMember() { $memberid = $this->inputhandler['member...

MVC ajax calls - where to handle them?

I have a self-rolled MVC framework that I am building, and up to this point have managed to avoid the need for any AJAX calls. Now, however, I'd like to create a real-time updating feed. My question is, where are the handlers for the ajax calls usually stored in an MVC? Should I store them in the same controller that is involved in maki...

Alone, a part of a regex works. With a part added before it and an other after it, it stops working.

UPDATE: I'm making progress, but this is hard! The test text will be valid[REGEX_EMAIL|REGEX_PASSWORD|REGEX_TEST]. (The real life text is required|valid[REGEX_EMAIL]|confirmed[emailconfirmation]|correct[not in|emailconfirmation|email confirmation].) ([^|]+) saves REGEX_EMAIL, REGEX_PASSWORD and REGEX_TEST in an array. ^[^[]+\[ matche...