I need to do a series of comparisons with an integer in PHP, returning a different string depending on the result and I am wondering if an if..else block is the most elegant method. The code looks like:
if( $total < 10000 ) {
return 'string A';
} elseif( $total < 20000 ) {
return 'string B';
} elseif( $total < 30000 ) {
return 'st...
Im using the Google pagerank checking script found here:
http://www.off-soft.net/en/develop/php/prcheck.html
I've noticed however that after too many requests the server gets a temporary ban.
I'd like to somehow route requests through a list of proxy servers - can anyone get me started?
I'm looking for any code examples of php reques...
I'm working on a simple blog + image gallery website. As the purpose of the image gallery is to display artwork, I'd like to attach a variety of metadata to each image -- e.g. year and type of materials used. That's easy enough to do in itself, but I also want the user to be able to insert those images into his blogposts. I'm not really ...
Okay I'm using strip_tags to get rid of html from when a user tags a post but when a user enters something like in the upcoming example.
I get five empty values entered into the database, which I don't want everything else is fine. How can i stop this?
,,,,,,,, ,, ,,,,a,d, <html> , ruby-on-rails , ad, <html>
I get the following ente...
I've been working on this for a couple of hours and it should work but i'm missing something!
basically, i'm using jquery autocomplete with json source, with 2 values id and description.
Description should show up in suggestions and if item is selected and ID passed to a hidden field ( the field is not hidden currently for testing purpo...
I have a problem with static keyword due to inheritance in PHP 5.3.
abstract class Object
{
protected static $_classDataSource = null;
public static function getDataSource()
{
return static::$_classDataSource;
}
public static function setDataSource( $dataSource)
{
static::$_classDataSource = $d...
Hi ,
I have html table which I am using it as body of email, Problem is that Table font size what I have set in CSS doesn't reflect the same in outlook email.
Any Idea how to do this? Have font size set to table?
Using php
...
Hi there, i want to know how do we convert the following code to work with foreach
$query_select = "SELECT * FROM shouts ORDER BY id DESC LIMIT 8;";
$result_select = mysql_query($query_select) or die(mysql_error());
while($row = mysql_fetch_array($result_select)) {
$ename = stripslashes($row['name']);
$eemail...
I'm trying to use mod_rewrite to achieve the following rewrite:
From - http:// pre.domain.com/public/?project=Awesome
To - http:// pre.domain.com/project/Awesome
Can't seem to figure it out (despite reading through endless sites). Any help?
...
I copied the code from the example in the sdk, and made a few small changes, (and the following error occurs even without the changes) and the script logs me in correctly.
It recognizes that I'm connected, produces the appropriate session information, etc. However, the logout link
facebook.com/logout.php?next=http://www.stockyardmagazin...
Hey guys,
I need to be able to execute either a php or jquery function to update a sql database every certain segment of time, 20 minutes for example, regardless of user activity on the website. Does anyone know the easiest way to do this? Thanks, any help is appreciated.
...
Hi,
I'm trying to extend my CI with a custom library that I plan on using for calculating the time value of money. The issue is whenever I load the class I get an internal server error, and I'm not quite sure why. Also, if there are any other suggestions, please let me know.
Thanks
Here is the controller where I'm trying to load the...
Hi Guys.
I'm creating an application for a friend to handle Deadlines. I have a page set up where each user can see their own 'jobs to do' with a deadline next to it. My question is...
How do I compare a deadline date that comes back from the mysql query as 2010.08.08 with today's date?
For Example...
<?php
while($row = mysql_fet...
I am trying to create a secure login for my site, who's form logs in with AJAX. Unfortunately, as it currently stands, I am sending the username and password using http completely unencrypted. After looking through basic encryption methods in Javascript that I can port to Codeigniter to decrypt, I've read that the best thing to do is j...
Ok, I got used to coding with PHP. I'm currently trying to do a sudoku app. Now I'm coming to a point where I need to show the proper number in the appropriate cell (UITextfield) based on the number pressed. (I have 9 buttons that correspond to 1-9 respectively)
Conceptually when the used clicks on a cell, I want to: 1. put the UITextFi...
What would this code look like in ColdFusion?
protected function httpPut($url, $params = null, $data = null)
{
$fh = fopen('php://memory', 'rw');
fwrite($fh, $data);
rewind($fh);
$ch = curl_init($url);
$this->addOAuthHeaders($ch, $url, $params['oauth']);
curl_setopt($ch, CURLOPT_PUT, 1);
cu...
I don't know why I am having a hard time with this, but it's about time I came up for air and asked the question.
What is the best way to call a php file with jquery ajax, have it process some inputs via $_GET, return those results and again use ajax to replace the content of a div?
So far, I can call the php file, and in the success o...
I have two arrays that are structured like this
$array1 = Array
(
[0] => Array
(
['story_id'] => 47789
)
[1] => Array
(
['story_id'] => 47779
)
[2] => Array
(
['story_id'] => 47776
)
[3] => Array
(
[...
I am currently doing a website in php, we are using a Session variable to store the permission level of each user.
For example, if any one of you would go on the website, you would automatically get a session variable with a value of "member".
What I am asking is: Is it possible for an attacker to go on the website and modify the value...
In PHP I'm using DOMDocument and I need to search for an element that has attribute class="something"
I'm new with DOMDocument (been using REGEX all my life so help me :P)
Ok, my question is, I've found a DOMElement using getElementById, now i want to look inside the children of this element and retrieve a node that has a particular cl...