# User Portal!



## Trip (Aug 3, 2002)

Is it possible to have a portal or something like it?

Easier yet: how (using GoLive/HTML) can I have it so when a user enters some information into a field it checks with some online database and makes sure the information entered is good information, then forwards the page to something else?

Get it? HELP!


----------



## Captain Code (Aug 3, 2002)

Is GoLive a scripting language(I know I should really find out what it is one of these days)?  If it's a dynamic web page scripting language, then it's probably possible.

Or, do you mean can you do it with something like PHP?


----------



## xaqintosh (Aug 3, 2002)

GoLive is a WYSIWYG by Adobe kinda like Dreamweaver, not a language.


----------



## Captain Code (Aug 3, 2002)

Oh, OK(thanks xaqintosh), well then Trip, without some kind of script on the server, you can't do it with just plain HTML.


----------



## uoba (Aug 4, 2002)

you'll need to get into either Javascript in GoLive (non-secure if that's an issue)... Normal route with GoLive is to make a link, then add an action from the Actions palette (GoLive has a fairly healthy set of Javascripts/DHTML Actions). To learn more about these, check out GoLive's in-built Help system for a tutorial (lookup something like Add Action).

If it needs to be secure, you'll need to get into PHP (and MySQL if collecting data from a database server). This can be daunting, and you'll also need to setup your Apache OSX configuration with the PHP Module (see the How To's in this these forums). However, the rewards of getting something working are a fantastic feeling of achievement.

Check out www.hotscripts.com for 1000's of both PHP and Javascript scripts, all categorised. Most have good instructions to get you through the install procedures.

Any more questions let me know...


----------



## Captain Code (Aug 4, 2002)

The problem with using Javascript is that you would have to store the login and password in the script, which is easily aquired by viewing the source of the script.  Also, it wouldn't work very well for multiple users.  You would have to change the script for every new user, instead of having one PHP script that handles an infinite number of users.


----------



## Trip (Aug 4, 2002)

Security issues are not a problem here, the portal wouldn't be anything like pay-per-use, and no personal private information would be stored.

I'd be more than grateful if somebody could now help me to setup the portal, or setup an example one for me (Using GoLive+Javascript) that'd be great! 

Thanks for all of your help guys!


----------



## Captain Code (Aug 4, 2002)

It's been a while, but I'll give it a go:


```
<html>
<head><title>Login Page for Trip</title>
<script language="javascript">
	var username = new String;
	username.value = "bob";
	var password = new String;
	password.value = "bob";

	function verify(uname, pw)
	{
		if(uname.value == username.value && pw.value == password.value)
		{
			return true;
		}
		else
		{
			alert("Your login or password was incorrect");
			return false;
		}
	}
</script>
</head>
<body>
<form name="loginform" onSubmit="return verify(loginform.login, loginform.pw);" action="correct.html" method="get">
enter username:<input type="text" name="login" value=""><br>
enter password:<input type="password" name="pw" value=""><br>
<input type="submit" value="Login">
</form>
</body>
</html>
```


EDIT:
As you can see, someone can view the source code and see the login/password, and also just see where the form is going to take you, so there's not much point in using Javascript, except to keep out the people who know nothing about HTML or Javascript.


----------



## uoba (Aug 4, 2002)

You would really need the user not to know where the View Source button is in the browser  ... but if this really is not sensitive info, go the Javascript route. PHP User Authentification can be a pain.


----------



## Captain Code (Aug 4, 2002)

It's not that hard to do authentication on the server using a script.  I've done it with ASP, but not with PHP because I don't know PHP well enough yet.

Question:
Can you have stored procedures in MySQL?


----------



## Trip (Aug 4, 2002)

> _Originally posted by devonferns _
> *It's been a while, but I'll give it a go: "..."*



Ok, sorry but: how do I add this to my webpage information and make it work? I don't usually do things like this.


----------



## Captain Code (Aug 4, 2002)

You can just add the script part in between the head tags in your script.

Then you can copy the form to your page or make a similar form and have it call the script like I did in my example.


----------



## Trip (Aug 4, 2002)

Slow down there! 
mb you could throw something quickly together for me in GoLive and upload it to my carracho server or an ftp server so I can download it?

I'm really new to this kind of stuff, incase you couldn't tell!


----------



## Captain Code (Aug 4, 2002)

, ok.

I don't have GoLive, but I'll make a page in Dreamweaver and email it to you.


----------



## Trip (Aug 4, 2002)

Sounds great! But there _is_ one problem with that plan: I don't have an e-mail address. :/

Wait, never mind...my .Mac e-mail address should still be working until next month, right? w00t! Send it over!

flip180@mac.com


----------



## uoba (Aug 4, 2002)

But I've decided to make the switch from GoLive 6 to Dreamweaver MX today! Tested MX all weekend and was very impressed, a lot more professional now.


----------



## Trip (Aug 4, 2002)

You like Dreamweaver more than GoLive? You make me sick!
No, just kidding. Congrats and welcome aboard professional airlines.


----------



## Captain Code (Aug 4, 2002)

Ok Trip, I emailed you the html files.

I had to change some of the script to make it work(which I thought I would have to do).

I'll change the code that I posted so that it's the right code.


----------



## Trip (Aug 4, 2002)

Many, many, many thanks to you kind sir!


----------



## Captain Code (Aug 4, 2002)

> _Originally posted by Trip _
> *
> Many, many, many thanks to you kind sir!  *



You're welcome


----------



## Trip (Aug 7, 2002)

Ok, I wasn't planning on coming up with this (and it's not that big of a deal) but before August 18th I need to find a way to add "minimal" security to that code, is it possible? Maybe I could put some fake logins and passwords in the code to confuse the user?

Any help is greatly appriciated!


----------



## Captain Code (Aug 7, 2002)

There isn't any way that I know of to hide the password from someone with a web browser.  Javascript isn't meant to be secure.

You could do it so easily with a PHP script and you wouldn't even need a database if you wanted to have only one user. 

You would basically have the exact same script as you have with the Javascript, but with PHP syntax, and probably a PHP function to transfer you to another page or something.

Actually, now that I think of it, it'd be better to have the one page just display a login box if you aren't logged in, and display other content if you are logged in.  That's pretty easy, as I've done it with ASP. 

Any pages that you would want to be secure would have to be PHP pages as well and would have to check for the username/pw as well, but that's easy.

This is a bit more work than just a little javascript though.


----------



## Trip (Aug 8, 2002)




----------



## Captain Code (Aug 8, 2002)

Yeah man, not too hard at all.  You just have to change all your pages to PHP, but there wouldn't be much PHP code in there.

It's basically like this:

if(user logged in)
     display normal content
else
     re direct to login page

to check if they are logged in, you can just store the username/password in a session variable and check if those variables exist in other pages.  If the user hasn't logged in, then those variables won't exist.


----------



## Trip (Aug 8, 2002)

Does sound easy, looks like I'll have some homework to do tonight.
Once more, thank you very much!


----------



## Captain Code (Aug 8, 2002)

No problem 

It shouldn't be very hard for you to do at all, even if you don't know much about PHP.  The syntax is similar to C/C++


----------

