Earlier today I asked wether it would be a good idea to develop websites using C#. Most of the answers pointed towards .NET and ASP. Currently I develop with PHP. I've dabbled with Python and RoR but I always come back to PHP. This is the first time I've looked at .NET and ASP. A bucket load of Google searches later I'm not really seeing...
function has_thumbnail_image(&$post) {
$content = $post->post_content;
return preg_match('/<img[^>]+src="(.*?)"[^>]*>/', $content, $results);
}
I need a function that goes through a block of dynamically returned text and puts all of the images contained within into an array (or more specifically the image source of each image). The f...
I found a simple function to remove some undesired characters from a string.
function strClean($input){
$input = strtolower($input);
$b = array("á","é","í","ó","ú", "ñ", " "); //etc...
$c = array("a","e","i","o","u","n", "-"); //etc...
$input = str_replace($b, $c, $input);
return $input;
}
When I use it on accents or other characte...
Which PHP RPC (XML or JSON) library have you successfully used?
I have done some research but haven't been able to find one library that stands out from the others.
I've found the following:
XML-RPC for PHP
XML_RPC (PEAR)
JSON-RPC PHP
And a few others that either don't look very active or mature.
...
function all_images(&$post){
$content = $post->post_content;
if(preg_match_all('/<img[^>]+src="(.*?)"[^>]*>/', $content, $results)){
$i = 0;
$count = count($results);
$count = $count - 1;
while($i < $count)
{
foreach($results as $result){
echo $result[$i];
}
$i++;
}
}
}
The above loop manages to get all of the images o...
I'm trying to understand this so I can do something similar. I know:
buf contains an authentication key with a hash appended to it (the last 20 bytes)
The HashData that's being looked up in the MachineKeySection is SHA1
length -= 20;
byte[] buffer2 = MachineKeySection.HashData(buf, null, 0, length);
for (int i = 0; i < 20; i++)
{
...
I have a page that that lists products returned from a mysql query. The query can very greatly depending on many different things.
What I want to do is give the user an option to narrow the current results by series of drop-downs. For example to narrow the product type. But to get the available product types I am currently just checking...
This should (hopefully) be a pretty easy question for some of you to answer.
I have a working Recursive menu from a mySQL database, now my main problem is:
What is the best way to create the URL? I would prefer to bring in the title of each row like /eggs/milk/bacon/. Eggs being level 0 like: eggs-0, milk-1, bacon-2. Any ideas on ho...
How can I count the numbers of rows that a mysql query returned? using PHP..
...
I don't think I was specific enough last time. Here we go:
I have a hex string:
742713478fb3c36e014d004100440041004
e0041004e00000060f347d15798c9010060
6b899c5a98c9014d007900470072006f007
500700000002f0000001f7691944b9a3306
295fb5f1f57ca52090d35b50060606060606
The last 20 bytes should (theoretically) contain a SHA1 Hash o...
What is the best way to keep the user logged in when something like "third-party" cookies are disabled. I currently have a Facebook connect app (in only PHP) that works great when I have that checked in Firefox, but redirects to my login page when it's unchecked. Even Facebook's own sample application (therunaround) has the same problem ...
... or the other way around, is there any way to know if a php script is running inside a web server?
...
I have this class:
.news_item_info
{
font-size: .7em;
color:#000000;
text-indent: 30px;
a:link { color: #000000; }
a:visited { color: #000000; }
}
Here its with code:
<div class="news_item_info">
<?php echo $articles[$index]->getPoints(); ?> puntos por <span class="news_item_user"><a href="/index.php?actio...
After posting this a while back, I decided to create my own Registration / Authentication capability in PHP. I'd love anyone to point out the flaws / opportunities for improvement, particularly around what's stored in the session...
The logical flow is:
1 - User Registers using email as username, a "site name" which then forms part of...
I am looking to write a small application that receives an SMS text message and records the results in an online database. I am most comfortable with php/mysql, but can use any suggestions you might have.
...
I need to set a PHP $_SESSION variable using the jQuery. IF the user clicks on an image I want to save a piece of information associated with that image as a session variable in php.
I think I can do this by calling a php page or function and appending that piece of info to the query string.
Any ideas. I have found little help thro...
Is there a straightforward way to run mysql_query with an insert and get the ID of the new row, for example in the return? Or will I have to do another query with select to check it?
...
At the end of a page, if something occurs, it needs to be cleared, then the entire page needs to be re-parsed before serving to the client. I was going to echo out a javascript to refresh the page, but that will make them load the page and then reload it...I was wondering if there was a way to just tell the php engine to go back to the b...
I have a multi-server environment ( all windows 2003 ).
I manually installed php 5 on the appserver.
I also plan to install mySQL on the appserver.
on the webserver, which is DMZ'd, I added the php5isapi.dll extension under iis6 > web service extensions.
I was able to do that by giving the unc path to the isapi dll on the appserver...
I've got a page that has a category list at the top, and should normally list posts below it. The category list is created using:
<?php $display_categories = array(4,7,8,9,21,1); $i = 1;
foreach ($display_categories as $category) { ?>
<?php single_cat_title(); ?> //etc
</div>
<?php } ?>
However, this seems to make the post loo...