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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can I automattically login to a php site through JS?

    Can I login to a php site through JS for automatic upload, so I can create a control panel? and other stuff like that? please answer, thanks!

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Automatic upload? Control Panel? Huh?

    Where are you planning on putting this "logging in" Javascript code?

    You obviously cannot put it on the website you are wanting to login to...

    Funny enough, I wanted to do this (well, the logging in part...) in Javascript not long ago, and found that it is not possible. I created a page with frames, had my Javascript in one frame, and the website in the other.

    You cannot use Javascript from one frame on another (I was hoping to use DOM, etc..) unless both pages share the same domain. This is a security thing to prevent people like use from doing this.

    Well, I didn't give up on it, and I switched to using another method called cURL, and used PHP to assist me in writing a script to go about this.

    cURL is basically a command-line web-browser (at least that's the way I think of it..). Using PHP, you can either call cURL off the command line, or import some cURL libraries into your PHP and write a script that way.

    There are lots of examples online as to how to do this. Snoopy is another module, like cURL that will allow to do similar things. Uploading files are also possible (as is anything to do with POST, and much more).

    But to simply answer your question, NO, Javascript cannot be used to login to a website. You'd have to use something like cURL or Snoopy.

    If anyone on this forum knows differently, please let us know -- I'm still very curious!

    Hope that helps,
    Sadiq.

  • #3
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if loggin in is no, I guess I could use frames, but I still would like to use JS to upload, and I will program the js, my upload site is programmed in js, so would it work?
    Last edited by stophon4; 03-17-2004 at 11:11 PM.

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't understand what you're talking about.

    While you're clearing up your previous post, why don't you also clearly explain what it is you're trying to do. In other words, why do you think you need to automatically login to some site and upload something?

    If you give us some background, we may be able to help you better, even if it means coming up with a different/better solution.

    Sadiq.

  • #5
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I mean that could program JS into my site and program it to upload files onto the site, almost copying the same thing the server does to upload but put it on my site. but it won't be copying....

    I hope that is more clear.


  •  

    Posting Permissions

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