can someone help me with setting gated content on landing page with login credentials?
thanks in advance
That may be the worst code I've ever seen (and it offers no actual protection).
EDIT: It appears the post with the code I was referring to has been removed by the poster. That's for the best, thanks.
Zero security isn't really a starting point for anything, and that code encourages about 5 different worst practices.
Create a lead field LastGatedContentPassword. Add it to a form. Add a choice for Follow-Up URL that sends them to the asset on a match, to a failure page on a non-match. This stores the password on the server so it can't be read by the lead. You're adding only basic security, but it's a non-negligible barrier (while putting the password right in the HTML source is no barrier at all).
You don't even need any code for this -- and I'm a coder. (JavaScript can be used to enhance the form by changing the password field to a type=password with asterisks, but it'll work fine without that. And as this is only a casual passcode that's probably not necessary.)
For a secure system, it would require an authentication server to be setup.
Questions like the following would need to be answered.
Doing a project like this would be much more than anyone could likely assist with in the forums, and you would likely need to engage a contractor to build it for you. It would take over 100 hours to build out something and begs the question, where you would use a Marketo Landing Page behind login credentials? It doesn't seem like the main purpose of a landing page and would be much better handled as part of the core functionality of your main website.
Idea is usually that a single passcode is distributed out-of-band (like at a tradeshow). That additional layer is more to establish that someone came in via a known route. If they game the system by guessing the URL, let alone having the asset and/or password sent to them, that isn't a major prob. But if you're going to have a passcode, at least don't put it on the page!