authentication form using Electron (Atom shell) and PHP+mysql server only - javascript

I want to authenticate users of my app, I know how to do it using php on client but Electron can't use PHP at client side
Is there a way to authenticate users from mysql in Electron's app?
I need something like $_SESSION (PHP)
Thanks for the help :D

First never authenticate on the client side. Always on server side. Use OAuth´s PHP Implementation or write you own implementation. Then simply use node´s native https request and return json from your server, PHP script. Please do a lot more research on application design and security.

Related

How to send data from android app to my local site?

I have a local site like no server no nothing just the html, css, javascript files and i need to send data from an app in my phone created with android studio and display it on the site.I read that you can have a webserver and send data with the android/java tcp client to it but i cant find how to do it.So how can i approach this?
This is possible using server-side programming languages.
You can receive data using Api and display it on your web pages after saving it in the database.
To start, I suggest learning Php - Mysql , it's easier to understand and easier to implement
you can send data from your android mobile to the server by using API such as REST and SOAP but you have to any of the server-side scripting languages like node PHP etc.. Please refer the tutorial point to get better ideas
https://www.tutorialspoint.com/android/android_php_mysql.htm

Can I send sms using Sinch with Squarespace, which does not give access to server side code

I need to send SMS using Sinch from a Squarespace app, which does not provide access to server side code. I am wondering if their JavaScript SDK can do it, but I can't seem to figure out any help of this. Has anyone does this before.
You can but you should not do that because you secret will be exposed so any one could use your account. The code that sends sms should be on server side (in any language you want)

send an email from a HTML/CSS/JS app

I am developping a mobile HTML/CSS/JS app with a contact form.
For now I use a "mailto" to send the message, but it is not efficient because the user is sent to his email app before sending.
How can I send the message directly from the app ?
thanks
Write an application that runs on the server of you website.
If you don't want any server side code then you either need to use any third party Javascript application. (API)
or you can try this also :
Email
1) For third party API you can try this also (Never tried it but looks good enough)
www.mycontactform.com
2) Mail Chimp (as Robert suggested)
You will not be able to do this purely from javascript. You will need a server side component to connect to an SMTP server in order to be able to send your email.
Even if you were able to somehow develop an SMTP client for javascript, the security risks involved would much outweigh the advantages. All your users will need to do to send email as you, is to go through your javascript code and get your SMTP credentials.
You can't do it by client side language. Use server side language like php to do that.
<?php
mail(to,subject,message,headers,parameters);
?>
Copied from w3school

Connectin to MongoDB using Javascript

I am working on a little fun project(webcalender) and I want to use mongoDB. MongoDB is running and I figured out how to deal with it. I also got the connection to PHP.
I was wondering is there any chance to connect to the MongoDB using simple javascript?
I have searched a lot and I always passed by Node.js? Do I need Node.js to connect to mongoDB over Javascript?
Does anyone have a great link? Tutorial? or arguments why I should not do that?
Thanks for help
there are client side ways of doing this but its not safe at all.
there are a few reasons for the lack of security.
1. connection info is in the source for anyone to see.
2. if you use a service like mongoHQ where its a restful API to connect to Mongo your secret is exposed on the client side.
Both of these reasons scared me enough to not use a JS library that allowed me to connect to mongo on client side.
is your application being built in node? or PHP?
if PHP I know theres a PEAR library for MongoDB, then you can use javascript on the client side to interact with php to do what you need on the DB.
if the application is being built in node.js then sure why not? I've had success using Mongoose with express in node.
hope that helps.
Yes, you need Node.js to access MongoDB via JavaScript, because simple plain JavaScript runs on the user browser, not on the server, and Node.js is meant to run on the server.
Accessing a database directly from the browser would be a huge security issue, since JS files are always available to those viewing the page.

Node server and WS server running side by side?

I'm really new to Node.js and have been wondering something. I'm trying to build a simple chat room application as a way of teaching myself how this all works.
The way I see it working is that I have a Node http server which serves the pages of my site (homepage, login, chat screen etc) and then I have a WS server which accepts short messages to relay to all connected users.
The thing is I can't work out if this is the correct way to approach this. Is it possible to authenticate users on the Node server and know that they have been authenticated on the WS server? Can they share some kind of session?
Any help is appeciated!
You don't mention what you're using to implement a WebSocket server, so I'll assume you're using socket.io. (If you're not, you should.)
You can use the socket.io handshake process to access the HTTP session state.
If you're using Express (once again, highly recommended), it's easy to tie the two together.

Categories

Resources