Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: All JavaScript

  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    All JavaScript

    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.

    OMR
    Attached Files Attached Files

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lisbon, CT
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    BaldEagle

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lisbon, CT
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can have a look at this:

    Secure Login with javascript

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

    BaldEagle

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,462
    Thanks
    0
    Thanked 633 Times in 623 Posts
    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).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    New Coder
    Join Date
    Dec 2005
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Out of the Way

    All,

    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!

    OMR

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Quote Originally Posted by OldManRiver
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    thanks

  • #8
    Regular Coder
    Join Date
    Sep 2005
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    If you want answers, write a smart question.

    Yes, someone probably does know how...

    Oh, and if you want to learn, STFW!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •