php

php user authentication libraries / frameworks ... what are the options?

I am using PHP and the codeigniter framework for a project I am working on, and require a user login/authentication system. For now I'd rather not use SSL (might be overkill and the fact that I am using shared hosting discourages this). I have considered using openID but decided that since my target audience is generally not technical,...

How come posting to PHP causes error in IE, but not in other browsers?

I have some PHP code that calls MySQL that works in Firefox and other browsers, but IE doesn't seem to handle it. <?php include "casti/mysql_connect.php"; $result = mysql_query("SELECT * FROM ".$_POST['table']." WHERE id='".$_POST['id']."'"); $row = mysql_fetch_array( $result ); // Line 60 ! echo $row['title']; ?> And here is what ...

PHP MySQL Alphabetical Linking

I have a huge table full of records and with PHP I'm making a seperate page for each one. On the page I want to interlink them alphatbetically, for example the page 'Dunn' would have links like this in the sidebar: Darren Dave Doom Dunn Dupp Duss Dutt Always with 3 links either side going up and down the alphabet. All the data is goi...

Replace SQL statements in XML with query results

Hey everyone, I have functions in place that will convert the results of sql queries into XML. However, I now want to be able to, using PHP, read in an XML document (that has nested SQL statements), execute those statements, and essentially replace the sql statement with the results. (Just a note, using PostgreSQL) For example: <cus...

refresh a part of webpage in php

Hi friends i develop a page in that i need to refresh a part of a webpage,not a whole one in php using Ajax. Please help me to do this , thanks in advance ...

File Write permission in php and xml

ob_start(); echo '<'.'?xml version="1.0"?'.'>'; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;'; echo '<root>'; $hierarchy=$tree->getArray(); recursiveBuild($hierarchy[0]); echo '</root>'; file_put_contents('file.xml', ob_get_contents()); ob_end_clean(); ...

PHP - Delete XML Element

I need to delete elements of an XML file using PHP. It will be done via ajax and I need to find the XML element via an attribute. This is my XML file <?xml version="1.0" encoding="utf-8"?> <messages> <message time="1248083538"> <name>Ben</name> <email>Ben's Email</email> <msg>Bens message</msg> </message> <me...

How can I disable PHP magic quotes at runtime?

I'm writing a set of PHP scripts that'll be run in some different setups, some of them shared hosting with magic quotes on (the horror). Without the ability to control PHP or Apache configuration, can I do anything in my scripts to disable PHP quotes at runtime? It'd be better if the code didn't assume magic quotes are on, so that I ca...

php access network path under windows

Hey there! within PHP (XAMPP) installed on a Windows XP Computer Im trying to read a dir which exists on a local network server. Im using is_dir() to check whether it is a dir that I can read. In Windows Explorer I type \\\server\dir and that dir is being shown. When I map a network drive a can access it with z:\dir as well. In PHP I...

require_once problem with templating

Im new to MVC and I'm re-doing a lot of my code. I have master.php (index) which has: <?php require_once("header.php"); ?> Both master.php and header.php are in the same folder yet I get the following error: Warning: require_once(1) [function.require-once]: failed to open stream: No such file or directory in /Users/MyName/Sites/M...

PHP - Source (hostname) of a GET request

I have a Javascript widget that people can embed on their site. I want to use a simple cross domain get request to pull in a hash. However I need my PHP script to only allow this cross domain request from a series of domains I have stored in an array. What can I do in my PHP script (not in .htaccess or iptables) to find out the sou...

MySQL - Need help counting id's that correspond to certain in other tables

Hi, I have on table named players, then other tables named tries, conversions, penalties, dropgoals. I need to get the player_id from players, then count the following: number of tries for player_id in tries number of conversions for player_id in conversions number of penalties for player_id in penalties number of dropgoals for player...

How to send HTTPS posts using php

Hi, I'm setting up a custom e-commerce solution, and the payment system I'm using requires me to send HTTPS POSTS. How can I do this using php (and CURL?), is it any different from sending http posts? UPDATE: Thanks for your replies, they've been very useful. I assume I will need to purchase an SSL certificate for this to work, and I ...

Using php to return GROUP_CONCAT('column x') values

I am trying to use PHP to return SQL values into an HTML table. I am able to get every column to populate without a problem except for the last column, "GROUP _ CONCAT (provision_id)." Relevant code: <?php global $wpdb; $wpdb->show_errors(); $contents = $wpdb->get_results( $wpdb->prepare("SELECT salaries.id, name, remaining, contract...

how to detect search engine visites on my site? like phpBB

Is there any way to detect search engines or crawlers on my site. i have seen in phpBB at the admin we can see and allow search engines and also we can see the last visit of the bot(like Google Bot). any script in PHP? Not Google Analytic or same kind of application. i need to implement that for my blog site, i think there is some way...

PHP logic if statments

I have this code: $distance= -1 ;//default //distance calc if($dgalaxy = $galaxy){ if(($dx = $x) && ($dy = $y)) { //inter planitary currently unknown formula }else{ $distance = round(Sqrt(pow(($dx-$x),2)+pow(($dy-$y),2)));//interstllar } }else{//intergalatic if ($galaxy < $dgalaxy){ ...

use object created in class constructor in class methods

Hi. Is it possible to use an object that was created during a class' construction within the member methods of that class? Ex <?php include ('AClass.php'); class Auto_Cart { function Auto_Cart() { $aclass = new AClass(); } function DoSomething() { $aclass->amemberfunction(); } } ?> When I call DoSo...

How to force XPath to use UTF8?

I have an XHTML document being passed to a PHP app via Greasemonkey AJAX. The PHP app uses UTF8. If I output the POST content straight back to a textarea in the AJAX receiving div, everything is still properly encoded in UTF8. When I try to parse using XPath $dom = new DOMDocument(); $dom->loadHTML($raw2); $xpath = new DOMXPath($dom); ...

PHP VLookup (conditional match) Alternative?

How do I return the results for the provision_id column so that they are conditional on contracts.id for each row? Right now, I get the same result on every row. The desired effect is sort of like VLookup in Excel. Not sure how to use if else/sql values to achieve it in PHP though. Relevant code: <?php global $wpdb; $contents = $wpdb-...

Finding the higest voted Question in last week. (sql query)

Hello I have a 3 sql tables: qotwQuestion1a(QuestionId [primarykey], Question, MemberId, PostDate); qotwVote1a (QuestionId [primarykey], MemberId [primarykey], Vote1a); qotwMember (MemberId [primarykey], Name, Password, emailId); I want to write a sql query to find the QuetionId and MemberId of the Question that has the highest vote...