View Full Version : All JavaScript

12-17-2005, 06:46 PM
I'm looking for a login script to both MySQL and FTP that is 100% javascript.

I find examples of all kinds of combos with a little .asp, .php, javascript, even c++ and vb, but have not been able to find one that is 100% javascript.

The javascripts I do find come with no MySQL connection strings, which is critical in logging into MySQL, especially remotely hosted MySQL. Some do not come with authentication, some with/with out cookies, etc. In other words I can not find a 100% all inclusive, this is how you do it, javascript example.

I'm trying to use the UID and PWD from the screen and authenticate it in the MySQL, as I am predefining the users there. Right now I'm doing this manually through an online MySQL admin page, but want to replace that with an admin page specifically design for my admin of new users.

The FTP part I'm referring to are settings in the MySQL database which can/are retreived once the user has a succeful login and then allows the user to FTP to a secure area.

Hope someone has such an example or can help me walk through what I need here so I can finish writing my script. I am uploading my .js and .html files, though they are not finished, so you can see where I'm at. I know java, from the code/syntax but still have trouble with the calls, relationship, classes, etc., so need some coaching.

Thanks for all your help, it is appreciated.


12-17-2005, 08:09 PM
The only way I know of to do what you want is to use jsp. A js script on the client side will not do all that you want to do which is why you find so many examples that are a combination of two or more. Javascript in and of itself was designed to be secure by not allowing the client direct access to server side data. As my first statement implied this is my understanding and I may be completely wrong. Try searching on jsp and see if you get any hits that will provide you with a solution.


12-17-2005, 08:30 PM
You can have a look at this:


Not exactly what you are asking for but maybe good for you anyway.


12-17-2005, 09:58 PM
Javascript has no access to the server and no ability to access files or databases. You cannot therefore set up an all Javascript process involving mySQL or FTP. You must use a server side language to provide that access.

JSP has nothing to do with Javascript - it is server side Java (a completely different language).

06-27-2006, 05:07 AM

Well now that we have the philosophical discussion out of the way, can we address the problem?

Since I'm not the sharp one here, not knowing these inner details, all I care about is a solution that works!


06-27-2006, 08:57 PM
Well now that we have the philosophical discussion out of the way, can we address the problem?There is no way to solve the problem using 100% JavaScript (if this is browser JavaScript you're talking about). It simply cannot be done. JavaScript is client side only. The MySQL server is - obviously - server side. The server and the client talks through all-textual requests and responses. JavaScript (or plain HTML) can send requests that are translated into commands on the server, but you need a server side language to talk with the MySQL server on the server side.
Since I'm not the sharp one here, not knowing these inner details, all I care about is a solution that works!It's simply not possible. You need a server side language to sit in between the request and the MySQL server.

07-27-2006, 11:25 PM
Here's a question then.

If I have to use a server side script can I call to a php script that pulls information and return it to the javascript as a variable.

If so how :confused:


07-28-2006, 02:47 PM
Yes... Ajax (or more generally, Remote Scripting) is the interaction between js and some server-side language like php. Basically in the client-side js script, a call is made back to a server-side script. The php server-side script then makes a connection to the MySQL DB, runs a query, and "displays" the result as text.

Meanwhile, the js has a function connected to the onreadystatechange event which listens to how the server-script is proceeding along. Eventually the server will signal to the client essentially stating that the server-side script has finished running wihout any errors. At this point, the client-side js can read the text that the server script returned using the responseText property.

As to OldManRiver's question, there may be a JScript solution (which is MS's version of JavaScript) that uses MS-proprietary ActiveX controls to interact with an Access DB when the server and client are in the same intranet space. However, this would only be feasable in an in-house intranet web-application type of system; if you were wanting a public web-site, then you will need to use a combo of js and some server-side language.