Javascript Login [duplicate] - javascript

This question already has an answer here:
JS Simple but Safe Login? [closed]
(1 answer)
Closed 6 years ago.
I am trying to create a login page using JavaScript. It's really just a redirect page with a couple of usernames and passwords. I know how insecure it is, but its simple; plus no confidential information will be on the target pages.
I got my script from this source: http://www.javascriptkit.com/script/script2/loginpass2.shtml
Im trying to have certain usernames redirect to a particular page and I want to do that with the code given..I just don't know how.
Sorry for not being clear.
For example, when someone logs in as user 1 I want them to be redirected to a different page as user 2.
Thanks in advance. :)

Why not just do
window.location.replace(url);
Where you get url from matching a username with a url. An associated array would fit the bill

Related

Search query in url [duplicate]

This question already has answers here:
Reference: mod_rewrite, URL rewriting and "pretty links" explained
(5 answers)
How can I get parameters from a URL string?
(12 answers)
Closed 4 years ago.
I'm currently working on a project almost like steamrep.com but for another game and more features.
I know basic php js etc but there is 1 thing i can't seem to understand.
And that is when you for ex search for
yourdomain.com/profiles/ (any id / username)
I can't seem to figure out how to make it so it takes the givin id / username puts it as a variable and display it on a page.
If anyone could give me a lead that would be verry much appreciated!
EDIT: To clear up the question. I want to take the id or username from the url and display it the page as a variable.

Disable print/copy from a react application [duplicate]

This question already has answers here:
How to stop user from printing webpages? using javascript or jquery
(11 answers)
Closed 4 years ago.
Is there a way to disable functions like copy, printing full page from a react application rendering in browser.
My usecase: I am building a question bank management tool and do not want user to have ability to copy or print complete questions for later reference.
Also is it possible to programatically decide on what will be printed when user tries to print. (Its ok to print title of the questions)
No you cannot render a page and also prevent a user from seeing it.

Greasemonkey automatically load forum redirects [duplicate]

This question already has answers here:
Modifying all links w/ Greasemonkey
(2 answers)
Closed 5 years ago.
I have very little knowledge in javascript and greasemonkey, so I hope someone here would be kind to answer this easy (I think) question!
Several forums have a redirect page when you click a link that links outside the forum, and you have to click "Continue" to load the page.
The URL of the redirect page can for example be constructed like this:
https://www.forumurl.com/out/?http://outsideurl.com
How should this Greasemonkey script to automatically load http://outsideurl.com when I visit the above forum url look like?
We could to plug ajax and write this code
$("buttonID").click(function(){$("body"/* or your favorite content*/).load( "your url")});

Identify a user with js/php, without login [duplicate]

This question already has answers here:
Create unique Poll/vote/survey in php
(3 answers)
how to identify remote machine uniquely in php?
(7 answers)
Closed 6 years ago.
We have a small web-poll system we use in a math class before semester begin on voluntary base. On one hand we dont want the students have to register or download something, because of possible lost of poll participants. On the orher hand there are some students who manipulate the poll by sending lot's of junk answers.
Is there a way to identify a user machine over http? Ideas how to create an simple identification?
Simple: it is not possible to get the users computer name with Javascript. You can get all details about the browser and network. But not more than that.
If you are looking for a simple solution just use a cookie with a far future expire marking the device as already voted. However, this is just a simple solution and does not protect you against users with minimal IT skills. You could consolidate the separation by saving a hashed value of their Browser version/os/ip with each vote and you can filter results when counting

How to check if string contain the "url or link" and retrieve it [duplicate]

This question already has an answer here:
Match all URLs in string and return in array in JavaScript
(1 answer)
Closed 8 years ago.
I have comment section of page where user can post the comments on uploaded content, I want to check if user has shared any url links in his comment.
for Example -
var comment = "To search more on this question you can look to http://stackoverflow.com/ "
Now How do I find out that it is URL link and retrieve that link?I would be great if I can find a way to do this in Jquery and Java Script but PHP is also acceptable.
Thanks in advance.
Try to use this REGEX
((http:\/\/|https:\/\/)?(www.)?(([a-zA-Z0-9-]){2,}\.){1,4}([a-zA-Z]){2,6}(\/([a-zA-Z-_\/\.0-9#:?=&;,]*)?)?)

Categories

Resources