Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Fix My AJAX Drag And Drop Code


I've been working on a drag drop system and something happened when I
tried to switch the code from a working model to one with another
database. The drag drop still works, but the informatin in the
database is still not updating. I kind of got aggravated and could not
figure out the problem with my 4 months of PHP experience.

If anyone would like to look over the code, then go tot his URL and get
in touch with me if interested!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
File Upload By Drag & Drop
Can anybody tell me how to upload a file by dragging it onto a web
page? Using the <input = "file" .....> it is possible to upload files,
but files cannot be dragged onto web pages for uploading.. Any
suggestions? I found a few Java based stuff but none of them were free.

Drag And Drop Insertion In MySql
I'm developing a site in PHP/MySql that requires Ajax for this feature
: The user read an article and if ever he likes it he can drag it and
drop it into his "basket". Then when he'll consult its account he'll
found that article.

Scriptaculous Drag Drop And Database Integeration!
I'm working on a drag and drop feature with the scriptaculous
javascript library. And I was wondering if someone could help me! :(

Here is some test code. Basically, when someone takes something from
the left side and puts it in the right side, I just want to run a
database query.

I have NO IDEA how to do this because of my limited javascript
experience.

<script
src="http://www.mytuneslive.com/_NEW/MORPH/javascripts/prototype.js"
type="text/javascript"></script>
<script
src="http://www.mytuneslive.com/_NEW/MORPH/javascripts/effects.js?1.7.0b1"
type="text/javascript"></script>
<script
src="http://www.mytuneslive.com/_NEW/MORPH/javascripts/scriptaculous.js"
type="text/javascript"></script>
<link rel="stylesheet"
href="http://www.wiki.script.aculo.us/stylesheets/application.css"
type="text/css" media="screen" />
<div style="height:200px;">
<div style="float:left;">
<h3>This is the first list</h3>
<ul class="sortabledemo" id="firstlist"
style="height:150px;width:200px;">
<li class="green" id="firstlist_firstlist1">Item 1 from first
list.</li>
<li class="green" id="firstlist_firstlist2">Item 2 from first
list.</li>
<li class="green" id="firstlist_firstlist3">Item 3 from first
list.</li>
</ul>
</div>
<div style="float:left;">
<h3>And now the second list</h3>
<ul class="sortabledemo" id="secondlist"
style="height:150px;width:200px;">
<li class="orange" id="secondlist_secondlist1">
<span class="handle">DRAG HERE</spanItem 1 from second list.
</li>
<li class="orange" id="secondlist_secondlist2">
<span class="handle">DRAG HERE</spanItem 2 from second list.
</li>
<li class="orange" id="secondlist_secondlist3">
<span class="handle">DRAG HERE</spanItem 3 from second list.
</li>
</ul>
</div>

AJAX:: Using AJAX To Improve The Bandwidth Performance Of Web Applications
This is an amazing example of increasing bw performance using ajax. a
must see for all

visit:
http://webperformanceinc.com/library/reports/AjaxBandwidth/index.html

Drop Down Lists Changing Depending On Other Drop Downs
I want to have a drop down system like this one.  But without the radio buttons.

I want to have 3 drop downs but have no idea how to go about it.  I assume I will need to activate some sort of Javascript on the onChange event of the option drop downs.

Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

PHP And AJAX
Can anyone point me to some good online literature about communicating
between PHP and AJAX. Are there any libraries that would allow PHP to
send back request information to the calling HTML page?

PHP And An AJAX Like DOM
I was wondering if you would like to help me with a problem that is
more about concept than coding.

I am putting together a web site that works in a way similar to AJAX but it
is not using XML so that it is compatible with older browsers. I want to put
all the Javascript into PHP functions so that the whole code doesn't become
a mess of PHP, Javascript and HTML.

I then want to put these functions in classes.

The problem is what model do I use to structure the cases.

I was thinking that I might structure the classes in the same way as the
document object module but there are differences in the DOM from browser to
browser and I want one structure that adapts depending on the Javascript
version running on the client machine.

For example, I want to be able to code in PHP like this ...

Ajax
i want to have a bunch of radio buttons

i.e.

O = radio button

O cpu 1
O cpu 2 + 150
O cpu 3 + 500

when they click either or i want it to submit the form to be processed
using php and AJAX, so that their total refreshes with out the page
refreshing.

PHP & AJAX
I have a feeling this is a dumb question, but I am exploring AJAX and
PHP. I would like to write my PHP in an Object Oriented approach.
What is the limitation on what I can return in AJAX? Every example I
find seems to be text, which make sense because it is client side.
So, if I want to try to separate the presentation from the...

PHP-GTK & AJAX
Does anybody have an idea how to use AJAX in PHP-GTK ?

Ajax Vs FF2
I have a script that I need to be compliant with all browsers. Problem is, my script when done one way, only works with Modzilla 5.0 compatible browsers (Firefox 2 and Safari) and fails to work with IE6, FF1, and Opera. I have not tested the script in IE7 because I refuse to place garbage on my machine.

Anyway here is the code:

AJAX Framework For Php
I want to use a framework for AJAX.  What will be the best? I want to use AJAX with PHP. Is there any established framework for PHP which gives support for AJAX? Give me some tutorial addresses about AJAX if any one of you has any collection.

Selection Of Ajax Lib ?
I m working on an PHP based site where in UI I need to use ajax
funtionalities ... I just want some opinion from experts that which LIB
is best for usage.

I was wondering that using XMLHTTP is sometimes a bottleneck for cross
browsers application.

Different libraries are here but not sure which one to select.

PHP And Ajax - Very Very Slow
PHP and Ajax - very very slow

How do you people use PHP with Ajax?

I have been using this code, but there must be something wrong because
it takes too long to get the answer from the server. I really need,
somehow, to check if the IE version is 5.

The main point is: where there more than 500 people connected to the DB
it becomes really slow.

Ajax code:
var agt = navigator.userAgent.toLowerCase();
var isIe = (agt.indexOf('msie') != -1);
var isIe5 = (agt.indexOf('msie 5') != -1);
var uniqueCounter = (new Date).getTime();

function createXmlHttpReq(handler) {
if (isIe) {
var control = (isIe5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
try {
xmlhttp = new ActiveXObject(control);
xmlhttp.onreadystatechange = handler;
} catch (e) {}
} else {
xmlhttp = new XMLHttpRequest();
xmlhttp.onload = handler;
xmlhttp.onerror = handler;
}
return xmlhttp;
}

function xmlHttpGET(xmlhttp, url) {
xmlhttp.open('GET', url, true);
xmlhttp.send(null);
}

function xmlHttpPOST(xmlhttp, url, arg) {
xmlhttp.open('POST', url, true);
xmlhttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-Length", arg.length);
xmlhttp.setRequestHeader('Connection','close');
xmlhttp.send(arg);
}

function sendRequestGET(url) {
xmlhttp = createXmlHttpReq(function() {});
xmlHttpGET(xmlhttp, url);
}

function sendRequestPOST(url, arg) {
xmlhttp = createXmlHttpReq(function() {});
xmlHttpPOST(xmlhttp, url, arg);
}
========================================================================
My JavaScript in .php file (example):
...
function GetPerfilIndividual(id){
var arg = 'SOMETHING=1&SOME_ID=4343";
var xmlhttp = createXmlHttpReq(function() {
if(xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
document.getElementById("DIV_DEST").innerHTML =
xmlhttp.responseText;
} else {
document.getElementById("DIV_DEST").innerHTML = "<font
color='red'>"+xmlhttp.status+" - "+xmlhttp.statusText+"</font>";
}
}
});
xmlHttpPOST(xmlhttp, 'my_php_file.php', arg);
}
...

my_php_file.php
- Access the database
- make about 8 SELECTs
- create some TABLEs
- closes database
- return

Resources On Ajax Im
Can anyone help me by suggesting resources to learn about ajax instant
messaging solutions?

Simple AJAX Example
Several times some members even me post for simple AJAX example with PHP.
Some of experts will give URL of  tutorial. Now with this attachment I send my simple test of AJAX +PHP with the help of w3schools. There is no alternative to study  good tutorial but this simple example may give the fell of AJAX ...

Can PHP With AJAX Make Changes To The Url?
I am currently doing a forum script project (using PHP/MySQL, and hopefully, some AJAX).

One concern is that if AJAX can handle $_GET and output its content to the url?

Say if my forum index page is called index.php, then if I click on a thread, it displays the thread AND changes the url to index.php?postid=1

Is this possible?

FYI, I plan to use Xajax library.

Ajax Not Executing Php
When a user clicks a link I have it open up a file in a div using ajax.

my code is

<a href="#Find" onclick="javascript:jah('Find.html','content');">Find</a><br
/>

Where Find.html is an html file on the server. Now when I do this everything
works fine except php code is not being executed.

The jah code is

function jah(url,target) {
// native XMLHttpRequest object
document.getElementById(target).innerHTML = 'sending...'
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {jahDone(target);};
req.open("GET", url, true);
req.send(null);
// IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = function() {jahDone(target);};
req.open("GET", url, true);
req.send();
}
}
}
function jahDone(target) {
// only if req is "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML="jah error:
" +
req.statusText;
}
}
}

Use Google Ajax API From PHP
I need to use geocoding function in Google Ajax API from PHP.
I want to use this one as a tool to conver an adderss to
gis location. ( google map api doesn't provide japaanese geocoding )

Somehow I want to send request to this html page and get back the
gis location( lat, lng ) from php.

Sajax Or Ajax
somebody do something with this.. i'd like talk about.. it's so perfect
or no?

An AJAX Simple Example For PHP
An AJAX Simple Example for PHP
Article from http://www.joyistar.com
Introduction:
AJAX WebShop 3 Beta2 supports PHP programming by integrating PHP5
development environment. Here we will give an simple example to show
you how to develop web applications by PHP in AJAX WebShop.

1, Notice
We will use Access database in this example. Of course, you can use
others you like. Database name: demo.mdb; Table name: product; Fields:
PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE and PRODUCT_AREA.

2, Example
Start AJAX WebShop 3 to new a project by "File->New Project"


Give a project name in the popup window and select the web server as
PHP.

New a PHP Service by "File->New .PHP Service" and input the
required content. Select the "ServiceType" as "Query Data".
Click "OK", WebShop will generate codes automatically.

Input the codes below(Notice: demo.mdb should be the same directory
with the source code files.):
$connstr = "DRIVER=Microsoft Access Driver
(*.mdb);DBQ=".realpath($_SERVER['PATH_TRANSLATED'])."demo.mdb";
$sql = "select * from product";
$sqlcount = "select count(*) from product";

The source code of testquery.php£º
1.Fill data to $xmlRequest in columns:
//fill metadata fields
for ($i=1; $i<=$fields_count; $i++) {
$fieldname = odbc_field_name($result_id, $i);
$datatype = odbc_field_type($result_id, $i);
$xmlRequest->addField($fieldname, $datatype);
}

2. Fill data to $xmlRequest in rows£º
//fill data rows
for ($i=0; $i<$record_count; $i++) {
odbc_fetch_row($result_id);
if($i>=$recNo && $i<$recNo+$maxRows) {
$xmlRequest->append();
for ($j=1; $j<=$fields_count; $j++) {
$xmlRequest->setValueByIndex($j-1, odbc_result($result_id, $j));
}
}
if($i>=$recNo+$maxRows) break;
}
3£®Get the paged parameters, $xmlRequest->recNo is the first record,
$xmlRequest->maxRows is the total records number in a page and to get
the total records number by executing "select count(*) from
product"£º
$sqlcount = "select count(*) from product";
$result_id = @odbc_do($connid, $sqlcount);
if($result_id==null)
throw new Exception($sqlcount);
odbc_fetch_row($result_id);
$record_count = odbc_result($result_id,1);
$xmlRequest->setRecordCount($record_count);
$recNo = $xmlRequest->recNo;
$maxRows = $xmlRequest->maxRows;
if($maxRows==-1) $maxRows = $record_count;
After the steps above, we need a web page to display the result. Select
"File-New Page" and fill the file name.

Using Ajax, Php, Javascript
I'm having trouble getting the correct values back to my webpage. I'm using PHP and JavaScript along with SAJAX. The value of the text that is getting set in the label on my html page is "undefined". Code:

Zephyr@ Ajax Trouble
Hello , want to know how to make autoloading for elements ( <div
id='elem'></div> )
for example i make

<div id='one'></div>
<div id='second></div>

<script type="text/javascript">
functionFirst("one");
functionSecond("second");
</script>

As you can see i want to update elements "one" and "second" by using
functions "functionFirst" "functionsSecond" which i declare in the
packagename.js file.
I want to use this way for render page interface , but when i execute
this, i get updated only "one" element or "second" not both... what
the problem ? It seems to me that Zephyr cannot to update more then
one element.

Synchronous Call With AJAX?
I have stuck with a situation where I need to make synchronous calls through
AJAX. Sounds great, isn't it? anyways. I need something like

for ($x=1; $x<=10; $x++) {
call to a AJAX function which would call a php file on server
iterate to next when a response is received if there is some error,
connection error or something like that i need to get that error and then go
for next iteration.
}

That is needed because our current framework works on AJAX and we cannot change
the framework so I need to device a way so that we can make synchronous calls to PHP on server.

When PHP will return a response to callback function it will show a popup
screen. popup screen will have a PRINT button that print button will then call a php and that will print a document. after printing of that document the next
call to that AJAX will be made.

Image Upload Using AJAX
I am new in AJAX. I want to upload image using AJAX in php. Anyone has
the script.

Ajax - Dynamic Update
I would like to request some data from a server using ajax (search
type of thing). Whilst the server is searching, I would like to
display the first results on the client side. Ideally as they come in.
What is the best way to go about such a search?...

Design Patterns With Php And Ajax
i am building a new on-line application unsing L.A.M.P. and ajax. I
have a number of static tables which need to be maintained and want to
try to cut down the amount of coding to do on building maintenance
pages.

All forms will recall or create a single record in a table. The table
will always have a unique key of one field which will always be the
first field in the record. The record could have an indeterminate
number of fields and the fields could be of any type. In most cases no
fields will be dependent on other tables (ie no need for referential
integrity)

So as an example:-

one table will be offer:

Offer ID (string)
Offer Description (string)
Active Start Date (date, required)
Active End Date (date, required)
Dicount percentage (short integer, restrict to positive value only)

Another table will be delivery Method
Method ID (string)
Method Description (string)
Price (decimal 3.2, restrict to positive values only)
Vatable (boolean)


I want a programming construct that allows me to write a single group
of functions to produce the relevant forms. I don't need code
(although it would be nice :-] ) but am looking for guidance on how to
auto-build the forms and carry out any additional validation.

Ideas for managing this include:-

using describe table to get the field names, types and not null status
and traverse the results to build the form. Hold details of any
additional validation that needs to be done in a separate table for
validations:-

Table to validate
Field to validate
can be null
mininum length
max length
positiveallowed
negativeallowed
zeroallowed
undefinedbooleanallowed
validateagainsttable
validateagainstfield

Using an XML data file to define tables, fields, restrictions and
relationships

or is there an easier way.

I want to be able to do most of the validation client side using
javascript functions but will build in the event handlers when I create
the innerHTML using Ajax and php.

Submitting Forms With Ajax
I would like to submit forms with ajax, using jquery and then load the next
page. I had successfully do it with jquery and form plugin. however, it does
not work whenever the server response consist of both HTMLs and javascript
together. Is it possible to make it works? I am new in all this. Can anyone...

Synchronous Call With AJAX?
I have stuck with a situation where I need to make synchronous calls through
AJAX. Sounds great, isn't it? anyways. I need something like

for ($x=1; $x<=10; $x++) {
call to a AJAX function which would call a php file on server
iterate to next when a response is received if there is some error,
connection error or something like that i need to get that error and then go
for next iteration.
}

That is needed because our current framework works on AJAX and we cannot change
the framework so I need to device a way so that we can make synchronous calls to PHP on server.

When PHP will return a response to callback function it will show a popup
screen. popup screen will have a PRINT button that print button will then call a php and that will print a document. after printing of that document the next
call to that AJAX will be made.=

Ajax - PHP Framework Books?
Any one have AJAX or SMARTY tutorial? e-book or PDF books?

What Is The Difference Between Ajax POST And GET
As all knows the difference between GET and POST is in the way how
the data is transfered,

But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.

AJAX: Is Your Application Secure Enough?
We see it all around us, recently. Web applications get niftier by the day by utilising the various new techniques recently introduced in a few web-browsers, like I.E. and Firefox. One of those new techniques involves using Javascript. More specifically, the XmlHttpRequest-class, or object.
Webmail applications use it to quickly update the list of messages in your Inbox, while other applications use the technology to suggest various search-queries in real-time. All this without reloading the main, sometimes image- and banner- ridden, page. (That said, it will most probably be used by some of those ads as well.) Before we go into possible weaknesses and things to keep in mind when implementing an AJAX enabled application, first a brief description of how this technology works.
 
The Basics
Asynchronous Javascript and XML, dubbed AJAX is basically doing this. Let me illustrate with an example, an email application. You are looking at your Inbox and want to delete a message. Normally, in plain HTML applications, the POST or GET request would perform the action, and re-locate to the Inbox, effectively reloading it. With the XmlHttpRequest-object, however, this request can be done while the main page is still being shown.
In the background a call is made which performs the actual action on the server, and optionally responds with new data. (Note that this request can only be made to the web-site that the script is hosted on: it would leave massive DoS possibilities if I can create an HTML page that, using Javascript, can request thousands of concurrent web-pages from a web-site. You can guess what happens if a lot of people would visit that page.)
 
The Question
Some web-enabled applications, such as for email, do have pretty destructive functionality that could possibly be abused. The question is — will the average AJAX-enabled web-application be able to tell the difference between a real and a faked XmlHttpRequest? Do you know if your recently developed AJAX-enabled or enhanced application is able to do this? And if so — does it do this adequately? Do you even check referrers or some trivial token such as the user-agent? Chances are you do not even know. Chances are that other people, by now, do. To be sure that the system you have implemented — or one you are interested in using — is properly secured, thus trustworthy, one has to ’sniff around’. Incidentally, the first time I discovered such a thing was in a lame preview function for a lame ringtone-site. Basically, the XmlHttpRequest URI’s ‘len’ parameter specified the length of the preview to generate and it seemed like it was loading the original file. Entering this URI in a browser (well, actually, ‘curl‘), specifying a very large value, one could easily grab all the files. This is a fatal mistake: implement an AJAX interface accepting GET requests. GET requests are the easiest to fake. More on this later.
The question is — can we perform an action while somebody is logged in somewhere else. It is basically XSS/CSS (Cross Site Scripting) but then again, it isn’t.
 
My Prediction
Some popular applications I checked are hardened in such a way that they use some form of random sequence numbering: the server tells it, encoded, what the application should use as a sequence number when sending the next command. This is mostly obscured by Javascript and a pain in the ass to dissect — but not impossible. And as you may have already noted: if there is improper authentication on the location called by the XmlHttpRequest-object, this would leave a possibility for malicious purpose. This is exactly where we can expect weaknesses and holes to arise.There should be proper authentication in place. At all times. As all these systems are built by men, chances are this isn’t done properly. HTTP traffic analysisAnalysing HTTP traffic analysis with tools like ethereal (yeh I like GUIs so sue me) surely comes in handy to figure out whether applications you use are actually safe from exploitation. This application allows one to easily filter and follow TCP streams so one can properly analyse what is happening there. If you want to investigate your own application, the use of a sniffer isn’t even necessary but I would suggest you let a colleague that hasn’t implemented it, play around with your app and a sniffer in an attempt to ‘break’ through it. CookiesCookies are our friend when it comes to exploiting, I mean researching any vulnerabilities in AJAX implementations. If the XmlHttp-interface is merely protected by cookies, exploiting this is all the easier: the moment you get the browser to make a request to that website, your browser is happily sending any cookies along with it. Back to my earlier remark about a GET-requests being a pretty lame implementation: from a developers point of view, I can imagine one temporary accepts GET requests to be able to easily debug stuff without having to constantly enter irritating HTTP data using telnet. But when you are done with it you really should disable it immediately!

I could shove a GET request hidden in an image link. Sure the browser doesn’t understand the returned data which might not even be an image. But my browser does happily send any authenticating cookies, and the web-application on the other end will have performed some operation. Using GET is a major mistake-a-to-make. POST is a lot better, as it harder to fake. The XmlHttpRequest can easily do a POST. But I cannot get a script, for instance I could have embedded one in this article, to do a POST request to another website because of the earlier noted restriction: you can only request to the same web-site the web-application is on. One can modify its own browser, to make request to other websites, but it would be hard to get the browser on somebody elses machine to do this.
 
Or would it?
If proper authentication, or rather credential verification, still sucks, I can still set up a web-site that does the exact POST method that the AJAX interface expects. That will be accepted and the operation will be performed. Incidentally I have found a popular site that, so far, does not seem to have proper checks in place. More on that one in another article. Merely using cookies is again a bad idea. One should also check the User-Agent and possibly a Referrer (the XmlHttpRequest nicely allows one to send any additional headers so you could just put some other token in the Referrer-field). Sure these can still be faked — but it may fend off some investigating skiddiots.
 
Sequence Numbering, kinda…
A possible way of securing one’s application is using some form of ’sequence-numbering’-like scheme. Roughly, this boils down to this.
One should let the page, or some include javascript, generated on the server side, include some token that the performs some operation on which gives a result which is used in any consecutive request to the webserver. The webserver should not allow any request with another ’sequence number’, so to speak. The servers’ ‘challenge-string‘ should be as random as possible in order to make it non-predictable: if one could guess what the next sequence number will be, it is again wide open for abuse. There are properly other ways of hardening interfaces like this, but they all basically come down to getting some fixed information from the webserver as far away from the end-users reach as possible. You can implement this as complex as you want but can be implemented very basic as well. For instance when I, as a logged-in user of a web-enabled email-application get assigned a Session-ID and stuff, the page that my browser receives includes a variable iSeq which contains an non-predictable number. When I click “Delete This Message”, this number is transmitted with the rest of the parameters. The server can then respond with new data and, hidden in the cookies or other HTTP Requests field, pass the next sequence number that the web-server will accept as a valid request, only.
As far as I know, these seems the only way of securing it. This can still be abused if spyware sniffs HTTP communications — which they recently started doing.
 
Javascript Insertion
On a side note I wanted to throw in a remark on Javascript Insertion. This is an old security violation and not really restricted to AJAX, and not an attack on AJAX. Rather, it is an attack utilising the XmlHttpRequest object for malice. If I would be able to insert Javascript in the web-application I am currently looking at in my other browser window, I would be able to easily delete any post the site allows me to delete. Now that doesn’t seem all that destructive as it only affects that user? Wrong, any user visiting will have its own posts deleted. Ouch. Javascript insertion has been a nasty one for years and it still is when people throw their home-brew stuff into production.
On a weak implemented forum or web-journal, one could even post new messages — including the Javascript so that any visitor — with the proper permission — would re-post the message keeping the flood of spam coming. As these technologies keep developing — and lazy website developers do not update their websites to keep up with these changes. The recent ‘AJAX enhancements’ that some sites got recently might have been improperly implemented. This year might be a good time to check all those old web-applications for any possible Javascript insertion tricks. If you didn’t mind the cookies getting caught — the sudden deletion of random items and/or public embarrassment might be something to entice you to verify your the code.

Using AJAX With A PHP Front Controller
I have a framework that uses the front controller design pattern for a
single point of entry to the application and the autoload function for
includes. I am trying to incorporate AJAX into the framework, but the
javascript calls to php ignore my front controller code when
instantiating classes.

AJAX Test With PHP [Simple One]
I have two files the first one contains an AJAX script that sends parameter "1" to the php page. If 1 is received then it sends mail else it won send. Here's the code:

Opensource LIVECHAT | PHP/AJAX
Does anyone know of a good live chat solution that is open source? When I say "Live Chat" I mean a chat console designed to be used by website customer service representatives...not a chatroom platform.

The best thing I've been able to find on Sourceforge is something called Crafty Syntax. This open source program offers great functionality but is difficult to customize and fails to quickly determine when a chat client has logged off.

Have any of you guys used/designed a PHP/AJAX chat client that might be better?

Autocomplete Textfield With AJAX And Php?
I saw a neat demo example of this using script.aculo.us and ruby on rails framework to do autocomplete textfield.
http://demo.script.aculo.us

but was wondering if there is anything to run similar on php platform (with AJAX/scriptalicious also doing same effects)?

My current regular old html dropdown list has thousands of clients currently and it is taking >10 seconds filling the <option> list, hence why i am looking to use a short autocomplete list to let user fill in clientname.
Since this page can be edited, i hope there is a framework that knows that fills the text in the textfield appropriately like all the demos i see online,
but it should also set a hidden form field with the ID of the client chosen.

so if they click Update, then i can use that clientID value to update the database. Also if the user erases the text (or maybe fills in half of the text but doesnt choose a client from drop down), the hidden form field clientID should be removed so i know the user is unsetting the optional field/ or hasnt chosen a client.... and i can accordingly update the clientID field to NULL in database.


Variable Passing Between PHP And AJAX
I have some PHP code that builds an array of data then displays the data in a table. I am trying to write code that instantly sorts the columns in the table by clicking on the column header, without reloading the page.

To do this I found some code that allows me to run a PHP file by calling a javascript function. So I basically have PHP that echos a string of html that calls a javascript function which instantly runs another PHP file, and inserts any output of that new PHP file it into the html string at a named <span>

Anyway my problem is I need access to my array in the original php file while running the 2nd. I don't know how to pass a PHP variable into javascript then pass that variable into the new PHP file that it runs with the http.open function.

Compatible Ajax Browser.
i intend to design my website using php and ajax which i afraid some user maybe using old browser that not support ajax, is it any solution for that if i mandatory need use ajax?

PHP Security That Allows AJAX To Access
I have two files. index.html and system_check.php. I was using the following code to prevent hackers from accessing system_check.php directly. The problem is that it also prevents index.html from accessing that file.

<?php
//Protects from Unauthorized Access
if(eregi("system_check.php", $_SERVER['PHP_SELF'])) die("Hacking Attempt");
?>

Is there an alternate way of denying direct access to system_check.php but will allow index.html to access it?

How To Get File Size By Ajax
Iam using Xajax. How can i get file size before uploading file.

AJAX & Post Data
Two part question:

#1. I've built a little AJAX app, but the problem is anytime I do an update, I have to delete my temp files before I can see the update. Is there anyway around this?

#2. Is there a way to know all the variables submitted to a form without knowing what the variables are before hand? For example, I have a form, where there are checkboxes. Each checkbox's name is an ID value from the database. When I submit the form, I need to know all the rows that were checked...

Web Based Chatting App (AJAX + PHP)
I am looking for people's opinions on if this is a good model for my chatting application or if they have any suggestions on a better and quicker way to do it.

I am making a web bases chatting application that is using PHP server side scripting. I plan on using AJAX to bring about the live chatting feel. I have already written most of my custom AJAX scripts. Currently I am storing the chat in a log file instead of using MySQL database (my hope is that the file system will perform faster). I have a text file that basically holds a few bits of information in groupings. One grouping may look like this:

user_id:goose
timestamp:178454132
msg:this is a test message

Each log file will have many of these, which is the chat for a given chatroom. My idea is to have PHP read the file in and display any new chats to the user. I want to be sure that this log file doesn't get too large so I was thinking I would only store a certain number of messages in the log file. So one of my questions, is there an easy way to remove some of the log file at the beginning of the file and keep the rest of the file intact?

AJAX To Display New Records In A Table
Instead of refreshing the entire page to show the new fields in a
table, I was wondering if it would be possible to use AJAX to display
the new records in a table.

For example:

Messages are entered into the DB. I use PHP to create a table that
displays the messages.

Instead of refreshing the entire page to show the table with new
messages, how can I use AJAX to show the new messages in the table
without refreshing the entire page?

Multiple Asynchronous Requests (ajax)
After doing some reading, I figured out that I was causing a race condition
because my request was declared globally. I fixed this by making it local.
So, it had nothing to do with the addPoint() function, but I just saw the
affects there....

Ajax Permission Denied Problem
while using ajax script in some servers, permission denied problem is
coming. But for some servers , its working. It became very problem for
me. Due to this problem, one site which i am doing, stopped its
launching.

Is Gmail Homepage Real Ajax?
I saw gmail's storage size on mail.google.com. It was counting size like "Over 2728.845439 megabytes". then increasing... but my dialup connection disconnected I don't understand howto count storage size, when my pc disconnected internet. is it real 2728.845439 MB? or only text?

AJAX, PHP, Mysql Simple Query Example Anyone?
I'm having a heck of a time wrapping mind around AJAX.

Anyone know of a simple, straight-forward example for pulling a simple
query from mysql with PHP using AJAX?

As I understand it I need a PHP script that pulls the query and dumps the
data into XML format, that is called by triggering a javascript event that
reads that file with XMLhttprequest.

Is there a cross-browser way of doing this or do I have to detect whether
I'm using IE or Mozilla?

A good example that doesn't look like rocket science would be nice.

Problem Detecting An Ajax Request
I have the following code in Javascript which is creating and sending
an XMLHttpRequest .

<code>
var xmlHttp;

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
@end @*/
alert(xmlHttp);
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}

// Build the URL to connect to
var url = "getURL.php";

// Open a connection to the server
xmlHttp.open("GET", url, true);

// Setup a function for the server to run when it's done
xmlHttp.onreadystatechange = updatePage;

// Send the request
xmlHttp.send(null);

</code>

The problem I am having is server side where I am trying to detect an
Ajax request.
I have the folowing function isAjax() which is returning false:

<code>
<?php

if(isAjax()){
echo "This is an Ajax request";
}
else{
echo "Not Ajax";
}

function isAjax() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
$_SERVER ['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
}

?>
</code>


Copyright © 2005-08 www.BigResource.com, All rights reserved