php

Unable to validate a form using Javascript; PHP redirect issues?

Hello, I've coded a simple form for a friend's hobby; basically, we are trying to guess the starting lineup for a couple of teams in the 2010 FIFAWorld Cup (just for the kicks). Anyway, I need to validate the following form. All the Javascript functions appear to function well because if i just call them outside of the tag, everything...

Mail not delivered to custom email addresses (e.g. [email protected]) with Joomla

I am running Joomla 1.5.15. After working on my site, I decided to test it with different email addresses to make sure that everyone would be able to register. There was no problem with hotmail, yahoo, gmail, etc but I noticed that when I registered with my company email address, I did not receive any mail asking me to activate my accoun...

PHP real time chat with ajax polling

I need to create a chat similar to facebook chat. I am thinking to use ajax polling ( to send request every 2-3 seconds ). Is this a good approach ? Or I need to use other server side languages like erlang and server-comet ? ...

is stripslashes() necessary for all text from db that were mysql_real_escape()'d on the way in?

When i add something to my mysql db, i use mysql_real_escape_string(), then put it in the database. do i need to stripslashes() when i later get it from the db with mysql_query() and mysql_fetch_array(), or does one of these functions do it for me, or is it just not necesseary? ...

Ideal way of dealing with Solr results in PHP?

Firslty, I'm aware of some similar questions along the lines of this one, but I think this situation is different enough to warrant its own question. I'm running a Solr index, through a jetty install on a LAMP server. I currently use the simplexml_load_file function to bring in the search results and then parse them trough a couple of f...

PHP switch case problem

hey folks, I have a session variable called loggedon. I set it to 1 when the user is logged on and 0 when they are logged off. I do a swtich statement as seen below. but it isn't working as it should. $state = $_SESSION['loggedon']; switch ($state) { case 0: include("../includes/login.php"); b...

PHP macro / inline functions (to avoid variables to go out of scope)

Hello! I have the following dilemma. I have a complex CMS, and this CMS is to be themed by a graphic designer. The templates are plain HTML, with several nested inclusions. I'd like to make it easier for the designer to locate the file to be modified, by looking at the HTML of the page. What I thought in the first place was to build som...

Time based resource availability for events in mysql/php

For an event system I need to check if there are enough resources available for an event. Events have a a start and end timestamp, and needs a number of resources (for the sake of simplicity we'll assume that there is only 1 type of resource). When a new event is booked, there should be a check if it's possible. All events are doctrine-b...

my jquery ajax doesnt seems to work in ie6

Hi I am using jquery ajax in my project thats working good in my firefox But it doesnt seem to work in IE6 How to make the jquery Ajax work in Ie6 This is my code function Load_State(inp) { $.ajax({ type: "GET", url: "<?=base_url()?>/system/application/views/ssitAjax.php", data: "selCurCountry="+inp, success: function...

MySql syntax error; Deleting from two tables in one query possible?

Is it not possible to perform two deletes in one query by separating them with a semicolon? Here is my query: $query="DELETE FROM $sql_table WHERE EXISTS ( SELECT 1 FROM classified WHERE classified.poster_password = '$pass' AND classified.ad_id = '$id' AND classified.classified_id = $sql_table.classified_id ...

while ($row = mysql_fetch_array($result)) - how many loops are being performed?

if... $query = "SELECT col1,col2,col3 FROM table WHERE id > 100" $result = mysql_query($query); for this action: while ($row = mysql_fetch_array($result)){ .... } is this doing 1 loop (iterated x times)? and for this one: $row = mysql_fetch_array($result) foreach($row as $r){ ... } is this doing 2 loops (iterated x times)...

Check by id if an session exists, without renewing the session's lifetime

Hello, I'm working in a RIA. We use Memcached to store sessions, and I've installed http://pecl.php.net/package/memcache and my PHP session handler looks like this: $session_save_path = "tcp://$host:$port?persistent=1&weight=2&timeout=2&retry_interval=10, ,tcp://$host:$port "; ini_set('session.save_handler', 'memcache'); ini_set('ses...

Access value through parent attribute

I am looking to get the value A-1 through xpath based on a passed attribue. I have passed the index attribute of the unit through php from a previous page and am accessing it by global GET: $value = intval($_GET['index']); the xml: <UNIT index='1'> <ID>A-1</ID> <MANUFACTURER>testing inc.</MANUFACTURER> </UNIT> <UNIT inde...

How to dynamicly apply variable modifiers in Smarty 2.x

Hi, I can't find the solution of applying modifiers dynamicly in Smarty. Template - I would like to work this way (example) {$myVariable|$modifiers} Php script $smarty->assign('myVariable', "brumla brumla na drum drum drum"); $smarty->assign('modifiers', "truncate:30|trim"); Or I would like to apply modifiers in php - is there any...

Suppress PHP Headers running cgi PHP from Ruby

Admittedly, this is a strange problem for me to have, but here is what I'm doing: I've got a Ruby script that is executing a string of PHP code and capturing the output. This is somewhat related to another problem that I had with running cgi PHP from the command line. Here is the Ruby script's source: #!/usr/bin/ruby puts "Content-...

Extract text value from aspx via php

Hi there, Trying to get a text value either "yes" or "no" from an aspx page via my php product page. from here.. after code= i need to insert the product model number $products_model example.. http://www.madisonb2b.co.uk/stockenquiry.aspx?id=B8FxKDnJ%2bIdaPT1Nw5wo4r87qHuHcCQIPZzeUE%2fI36LIFOM%2bayBi2RSXHzIJS5Hj97JNSyYL80Q%3d&amp;code...

Test php mail function on your localhost

I am not able to test mail() function on my localhost. I tried to find the same on web but did not succeed. The main problem is with configuration of ArgoSoft Mail Server. Is there an alternative to that software? ...

Using Objects throughout application

Hi I have one page where I set up an object of class User. $id = $_SESSION['user_id']; $current_user = new User(); $current_user->getFromID($id); I've tried accessing this object from another page but it comes up blank. Is there any special way to do this? ...

real escape string whitelist

Whether text of paragraph is input and <br> tag will be remove after real_escape_string, how do I whitelist the break tag? ...

MySQL: Getting results present in one time frame but not in another time frame.

I have generated a dataset that contains data spanning thirty days. Im trying to issolate new data elements that have appeared in the last 2 days but not in the previous 28 days before that. I run a PHP script that generates the test data. (PHP and MYSQL return the same time when tested) I run the following query against it. Results a...