php

select similar value from MySQL and order the result

how do I order this result?? $range = 5; // you'll be selecting around this range. $min = $rank - $range; $max = $rank + $range; $limit = 10; // max number of results you want. $result = mysql_query("select * from table where rank between $min and $max limit $limit"); while($row = mysql_fetch_array($result)) { echo $row['name']....

how to restrict a page to only a specified ip range in php

hey guys im looking for a way to restrict my administration page to only my own ip range concider my ip range is 215.67.. so in php i will begin with this : $myip = "215.67.*.*"; $myip = explode(".", $my_ip); $userip = getenv("REMOTE_ADDR") ; $userip = explode(".", $userip); if ($myip[0] == $userip[0] AND $myip[1] == $userip[1]...

how can create follow us login form without going twitter.

I have a site.and i have follow me button. I want to user follow me from my site login into mysite without going twitter.and follow me. Its like auto follower. Please help me. ...

How can I read a binary string in C#?

There is a php script which sends a binary string to the client application: $binary_string = pack('i',count($result_matrix)); foreach ($result_matrix as $row) { foreach ($row as $cell) { $binary_string .= pack('d',$cell); } } echo $binary_string; Silverlight application receives $binary_string via POST protocol...

function to profile / performance test PHP functions?

I'm not experiencing any performance issues, however I'd like to take a look at what takes how long and how much memory cpu it uses etc. I'd like to get a firsthand understanding of which things can be bottle necks etc and improve any code i might reuse or build upon... (perfectionist) I'm looking to create a little function that i can...

Same script, working on a site, not working on the other!

Hello, First of all I apologize in advance for this question, a bit off the rang of stackoverflow, but I've spend a day trying to solve that issue and I'm totally stuck. The issue: The search function of my script (php) works perfectly fine on one host but not on the other. If you search something here : edu-cafe.com, you'll get a resu...

What is correct HTTP status code when redirecting to a login page?

When a user is not logged in and tries to access an page that requires login, what is the correct HTTP status code for a redirect to the login page? I don't feel that any of the 3xx fit that description. 10.3.1 300 Multiple Choices The requested resource corresponds to any one of a set of representations, each with its own ...

Handle order dependence in loops

Hey all, I'm making a templating system where I instantiate each tag using a foreach loop. The issue is that some of the tags rely on each other so, I'm wondering how to get around that ordering from the looping. Here's an example: Class A { public $width; __construct() { $this->width = $B->width; // Undefined! Or atleast not...

What are the most valuable certification available for Programming?

I would like to know what are the certificates available for programming, like Zend for PHP SUN Certification for java what are the others? Javascript ? C++ ? Python ? etc... Please give me some suggestion for other available certifications. ...

php - clean URL

Hai I want to create a web site with pure php. I want to hide the url parameters. I.e. I want to make my web site with clean urls. Is there is any way to do this with out using any framework? Is it curl help full to do this? Does any one give me a solution. ...

Get cookie expiration

Is it possible to read cookie expiration time with php ? When I print_r($_COOKIE) it outputs: Array ( [PHPSESSID] => 0afef6bac83a7db8abd9f87b76838d7f [userId] => 1232 [userEmail] => [email protected] [firstName] => user [lastName] => user ) So I think $_COOKIE don't have the expiration time, is it possible with some o...

Extract http://www.website.com from http://www.website.com/08/2010/super-cool-article

I suck at regex, I only managed to get so far preg_match("/http:\/\//", $url). I need this for a php script ...

file upload with php

Hi every body I am uploading file with php every thing is fine but move_uploded_file is not working every variable displayed record and all permission for file is set function uploadfile($filename) { $filetype=$filename["type"]; $filename=$filename['name']; $filetempname=$filename['tmp_name']; if($filetype=="applicat...

how to pass session_id() throught out the php pages?

when user clicks on login button(index.php) I am calling chechlogin.php where I am checking loginId an password as- if($count==1) { // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); $_SESSION['UserId'] = $myusername; $_session['SessionId'] = ses...

(PHP) how to destroy or unset session when user close the browser without clicking on logout?

I am destroying all session var in logout.php and calling it when user click on logout, what is user does not click on logout.php but directly close the browser. how can i delete session then??? ...

(php)how can I expire the previous page after any database transaction?

I am saving personal information in PHP page.when user click submit it saves but user can go back in submit information page through browser back button.Hoe can I expire my previous page?? ...

PHP: making a copy of a reference variable

If I make a copy of a reference variable. Is the new variable a pointer or does it hold the value of the variable the pointer was referring to? ...

filter by value in object of array

hi i want to know how to filter the value in object of array... i just display the below is one data of my object array Object ( [_fields:private] => Array ( [a] => c7b920f57e553df2bb68272f61570210 [index_date] => 2010/05/11 12:00:58 [b] => i am zahir [c] => google.com [d] => 23c4a1f90fb577a006bdef4c718f5cc2 ) ) Object ( [_fiel...

how to arrange the checkboxes in 3/3 format on a layout of a form

hi there can anyone plz tell me how to arrange the list of checkboxes of cuisines label which is retrived from the data base and when it is displaying it is not in the order coming side by side all together i want it to be displayed in a 3 by 3 format.here is the code for that: <div id="frmform"> <form name="frmrestaurant" id="frmre...

How do I select top ranker by date in MySQL

I do have a user data base with rank.what I am looking is how do I select top rank person based on today's search?? and I need to do this in daily basis. ...