php

solve apache problem when more clients connect the site

I have a php web application on web server connect with two oracle db server in loadbalance between them... we use in web application smarty template engine ..and ajax jquery the problem in - when more clients connect the web application the site stop or apache not running so we make restart to apache. - some web pages is slow. i want ...

Identifying the browser at server side in php

I have a website. When the user clicks on a particular page (say identify.php) I want to find the type of browser the client is using. The browser might be mozilla, IE, opera, chrome or any other mobiles device such as SonyEricssonK610i, SAMSUNG-SGH-E370, SonyEricssonT700 or NokiaN73-1. Is this possible to detect the user browser? ...

Identifying the country of visitor to my website

I want to identify the country my visitors come from using php. How can I do this? ...

Making php includes work in a sub-directory.

Ok, I am creating an admin interface for my custom blog at the url /admin. Is it possible for me to be able to use the same includes (including autoload), as the root directory. If possible, I would also like to be able to automatically correct the links in the navigation so that they go that index.php in / changes to ../index.php when...

Whats the proper way to check if mysql_query() returned any results?

I tried what seemed like the most intuitive approach $query = "SELECT * FROM members WHERE username = '$_CLEAN[username]' AND password = '$_CLEAN[password]'"; $result = mysql_query($query); if ($result) { ... but that didn't work because mysql_query returns a true value even if 0 rows are returned. ...

How do you maintain a community change log?

Hi everyone, I'm looking for a change log / features request program my client can use to see where I am at with the development. Trac looks sexy (http://trac.edgewall.org/) but too complex for what I need. Very simply, the client needs to be able to order tasks and for us to be able to sort them and keep a record of everything that i...

what is php serialize for

I just learned about serialize() and unserialize() functions today and I think it is really cool but I am wondering what are some good uses for this? I know people serialize things to put into a database. Could you give me some example uses where it is helpful? Also I see serialized code in javascript often, is this the same, like a s...

Get Twitter User Details without Authentication

I have noticed some Twitter Applications manage to get a particular users Location, Name, Profile Image etc using just the twitter username? Hows is this possible? I ask because I have not come across any where in the Twitter docs on how you can do this. I can get a users details myself using oAuth when the user provides my app permiss...

php array and foreach?

Below is my code I am trying to get to work but I really have very little knowledge of array and foreach. So it doesn;t work correctly I need to show a dropdown select form to the browser with the contents of the array I also need to have the item selected if it is == to $mycountry Lastly I would like to show the USA and UK at the top ...

Problem uploading files greater than 10Mb in IE6

Hey. This code works in most browsers, and even partially in IE6. It uploads files less 10Mb (approximately), but not anything larger. The code specifies that those files are permitted. Also, note that it seems like the entire file seems to be transferred to the servers before disregarded. The website is at: www.mgxvideo.com/mgxcopy-...

How to create user profiles with PHP and MySQL

I need some help on creating a user profile system. I want it to be like Facebook or Myspace where it has only the username after the address, no question marks or anything, for example, www.mysite.com/username. I have all the register, logging scripts, etc. all done, but how do I go to profiles using the URL example above, "/username"? ...

simplehtmldom php: How do you search for one thing or another

I want to scrape some html with simplehtmldom in php. I have a bunch of tags containg tags. The tags I want alternate between bgcolor=#ffffff and bgcolor=#cccccc. There are some tags that have other bgcolors. I want to get all the code in each tag that has either bgcolor=#ffffff or bgcolor=#cccccc. I can't just use $html->find(...

How do I use PHP's __get() and __set() for defined fields in my class?

I've had a good read of the PHP specs on overloading, and most of the examples appear to be intended to simply allow defining of custom fields (similar to stdClass). But what about the private fields defined in my class? How should these be retrieved/assigned? I could do a switch on possible values and act on certain values: class A { ...

Question regarding MVC: SubClass for DB activity

I just recently dove into OOP & now MVC and am using this template engine : http://www.milesj.me/resources/script/template-engine I am curious about one question on where to put my DB calls (I'm using a basic database wrapper class). I've seen two ways done. class Cart /** * Counts items in cart * @return int */ public static ...

How safe are PHP session variables?

I have a login script that verifies a username/password against data in a 'user' table. Furthermore, I have a 'roles' table that specifies the access level of a given user. Assuming I am using safe login scripts, are there any security holes in simply performing an additional query, upon successful login, against the 'roles' table to d...

Wrong results using Simple_HTML_Dom

Hi, I am trying to scrape this web page: http://www.acttab.com.au/interbet/venues?day=today Here is my code: function FindRaceRows($html) { foreach ($rows = $html->find( 'tr[bgcolor="#ffffff"], tr[bgcolor="#cccccc"]') as $row); { echo $row->plaintext . "END ROW<br />\n"; foreach ($row->find...

My IP is showing up wrong in PHP home server

Ok simple enough <?PHP echo $_SERVER[REMOTE_ADDR]; ?> Ok maybe not, I my IP is currently 72.184.212.85 however the code above which I am using on an IP blocking system for a script shows my IP as my home server IP of 127.0.0.1 So when I go to my script my IP is shown as 127.0.0.1 but when I go to other websites it is shown as 72.184....

emulating LiveHTTPheader in server side script or javascript?

Hi folks, I ran into this problem when scraping sites with heavy usage of javascript to obfuscate it's data. For example, "a href="javascript:void(0)" onClick="grabData(23)"> VIEW DETAILS This href attribute, reveals no information about the actual URL. You'd have to manually look and examine the grabData() javascript function to ge...

MyspaceID login system

I really would like to integrate the Myspace ID platform on my site using PHP, instead of allowing users to sign in to my site anytime with there myspace ID I am planning on just using it 1 time on signup process to allow them to import profile data from there myspace to my network. I have note been able to find any good example code fo...

php in array error

<?PHP $bannedIPs = array('127.0.0.1','72.189.218.85'); function ipban() { if (in_array($_SERVER['REMOTE_ADDR'], $bannedIPs)) { echo 'test'; } } ipban(); ?> The output of this script is: Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\webserver\htdocs\test\array.php on line 93 Can so...