Jump to content

a real self contained login with PHP also....?


NerdConcepts

Recommended Posts

Yes, I have another problem, this one I've worked on quite a while now and can't figure it out. I want a "real" self contained login modular. It's all setup and what not (as in registration, authentication, blah). Except I cannot get javascript to POST the values of the form. I'm pretty sure there is some way you have to get javascript to put the variables into a URL and then use PHP to urldecode (whatever that command is, cannot remember off the top of my head).

 

Enough said...here is my code...

 

<div id="loginsite">
<link href="modules/user/css/mod_user_login.css" rel="stylesheet" type="text/css" />
<?PHP
if (isset($_GET['process'])) {
echo '<div class="formLoginDone">';
echo '<span class="formLogin">Login Checker - ' . $_POST['username'] . '</span>'; // No posted data, so it doesn't so 'username'
echo '</div>';
} else {
?>
<div class="formLogin" />
<form method="post" name="loginForm" id="loginForm" action="javascript:ajaxpage('modules/user/mod_user_login.php?process', 'loginsite');">
	<span class="formLogin">Username:</span>
	<input type="text" class="formLogin" maxlength="30" name="username" id="username" />
	<span class="formLogin">Password:</span>
	<input type="password" class="formLogin" maxlength="30" name="password" id="password" />
	<input type="hidden" name="loginSubmitted" value="TRUE" />
	<button class="formLogin" type="submit">Login</button>
	<div class="formLoginAfter">[ <a href="">Forgot Your Password</a> ][ <a href="" onclick="javascript:ajaxpage('includes/content.php?page=registration', 'content'); return false;">Register</a> ]</div>
</form>
<?PHP
}
?>
</div>

 

the action="javascript:ajaxpage('modules/user/mod_user_login.php?process', 'loginsite');" is used so that when the form is submitted it (in theory) would post the data into the same AJax frame that the form is contained in. What it would do if check the username/password combination and if it was fine it would then show a user menu in place of the login form. I've got the submission part working just fine. When you submit the form it loads the ?process stuff in place of the form, just like I want it, just no POST data...not sure how I use my current ajax command stuff and still get javascript, html to post the data into the login box container. Any clues?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.