php

php SetCookie works in Firefox, but not IE

Hi All, I have two php scripts test.php <?php header("location: test2.php"); setcookie("test", "8kFL4IZfjkBmV7AC", time()+60*60, '/'); exit; ?> test2.php <?php var_dump($_COOKIE); ?> I then point my browser to test.php which redirects to test2.php. I then get the following results. In firefox, i get the following: array ...

Can two or more queries be executed at the very same time?

Ok, let's say we have bank_account table. There is a row called money. It has 2,000 value. And we have two persons trying to withdraw that money, let's suppose they can do it. So, is it possible that they would do it at the same time? For example. there is a made-up code: $all_money = get_value('money', 'bank_account); //lets suppose t...

PHP strtotime() function wrong by 1 hour?

I am converting dates and times into timestamps using PHP before they are inserted into my MySQL database. My problem is that when i use PHP's strtotime function the output timestamp is -1 hour behind my actual time. For example, considering todays date: 07/21/2010. When i use php code like: <?php $my_timestamp = strtotime("07/21/201...

Interpolation in PHP

I'm looking for a function in PHP for interpolating a set of irregular placed data (x,y,z) to a gridded data set for using it in ContourPlot function in JPGraph. I've developed a function based on simple Inverse distance weighting, but it is too slow. I need to use another method like "Modified Shepard's Method" or any other possible met...

Codeigniter - How to create sidebar widgets/modules i.e. embedding the contents of another controller in a view

Hi, I have been tearing my hair out over this for about 3 hours, please can someone help? Here is what I want to achieve... On my home page I wish to have a sidebar widget/module which displays the latest 10 events from the events controller. I started off trying to use the widget plugin, but could not get my head around it -[url=htt...

Redirecting to 404 page

I have the following code in a PHP script: <?php if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) { die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } // Other statements follow here echo 'Hello there ...' instead of echoing the message, I want to redirect the...

Check bans function

I call this function on top of every page. How would I do so it removes expired bans also? If current time() is more than expire field. Would really appricate help. bans id ip expire (if expire is NULL its permanent) function function check_bans() { $user_ip = $_SERVER['REMOTE_ADDR']; // Se if users ip is banned $query = mysql_q...

Pull Remote URL for GD Generated Image in PHP

I'm generating images with PHP/GD Library for people to place on their websites. Similar to the "hit counter" services. I am not able to pull the URL from the page that the button is loaded on. The following only displays my url not theirs: $_SERVER['SERVER_NAME']; Am I going to need to pull the domain in Javascript? ...

PHP Simple HTML Dom Memory Issue

I'm running into memory issues with PHP Simple HTML DOM Parser. I'm parsing a fair sized doc and need to run down the DOM tree... 1)I'm starting with the whole file: $html = file_get_html($file); 2)then parsing out my table: $table = $html->find('table.big'); 3)then parsing out my rows: $rows = $table[0]->find('tr'); What I'm...

Dynamically created stylesheets not (always) updating, causing style flickering

Hey all, I have a php script that loads a CSS stylesheet, changes the color attribute and then creates a new CSS file with the new color and links it to the page. When I hit refresh it sometimes updates to reflect the changes, sometimes it doesn't. At first I thought it was the cache, so I disabled caching in Safari but its still happe...

Can anyone help me explain sourcode color histogram below using php GD

I want to take the color histogram value of sourcode below: description $ WR = array (48 reference colors r) $emin = sqrt(pow(($r - $wr[0]),2) + pow(($g - $wg[0]),2) + pow(($b -$wb[0]),2)); for($k=1;$k<48;$k++) { $e = sqrt(pow(($r - $wr[$k]),2) + pow(($g - $wg[$k]),2) + pow(($b -$wb[$k]),2)); if ($e < $emin) { $n = $k; ...

Price Filter Grouping Algorithm

I am creating an ecommerce site, and I am having trouble developing a good algorithm to sort a products that are pulled from the database into halfway appropriate groups. I have tried simply dividing the highest price into 4, and basing each group off that. I also tried standard deviations based around the mean. Both could result with pr...

How to send an automated email from Win XP Apache

I need to send myself an automated email once a day from my windows XP dev. machine. I've got Apache, PHP, and MySQL running here. I don't mind which email address the email gets sent from since i can add it to my address bar. I'm wondering though, what do i need to enable/install to be able to send emails? ...

MySQL diacritic insensitive search (spanish accents)

Hello, I have a MySQL database with words containing accents in Spanish (áéíóú). I'd like to know if there's any way to do a diacritic insensitive search. For instance, if I search for "lapiz" (without accent), i'd like to get results containing the word "lápiz" from my db. The way I'm currently doing the query is as follows: $result =...

Get future timestamps

Would it be possible to get the unix timestamp 7 days from now? Would be awesome! ...

Php-Django Chimera: is it possible?

I've seen a lot of posts about switching from php to Django but none have covered this. I have a website that is built entirely in php (php 5, mysql, and apache2). This site is used only for collecting data from users. Now I need to make a second half of the site to display the data. This will be step 2 of 5 in the overall plan, and I'd ...

"Family Tree" Data Structure

I'm looking for a way to represent a "family tree" (family tree is an elaborate metaphor) in PHP. This means that children will need to inherit from two (or more) parents. Here are the requirements: 1, 2, or more parents Bonus points if I can attach metadata like a last name or relationship status Here is my non-working attempt (no ...

gdb unable to break on lstat call

Hello all, I'm debugging PHP 5.2.9 and everything works fine, but today during debugging I see that gdb don't stop when I set: (gdb) break lstat the breakpoint is in the list (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x00002aaaaf810ea0 but, as written before, ...

Does PHP wait for filesystem operations (like file_put_contents) to complete before moving on?

Hey all, I have a question about how PHP handles filesystem operations. I'm running this code that depends on a file being created before it gets used, and it feels like when I run the code it becomes a race condition - sometimes the it works, the file is created and php code uses it, sometimes it fails. So I was wondering how php han...

PHP is_file in Win32 allways return false

Hi all, I'm making a small app that must check if a certain file exists in the client computer. $file = "C:\\Windows\\System32\\rpnt.dll"; if (is_file($file)){ echo $file . " exists"; }else{ echo $file . " does not exist"; } Can't make this work. Any solution out there? ...