Jump to content


Login Script Help.


10 replies to this topic

#1 pistonsfreak

    Young Padawan

  • Members
  • Pip
  • 174 posts

Posted 09 February 2008 - 12:42 PM

Well Adam said to post this and he and few people could help me so I am. I need a login script for my site that lets users login to their forum username/pass on my site and then display they PM's, settings link, and logout link like P2L has. I dwnloaded a script from IPBSDK and I just need help modifying it, since I am not a PHP guru. So here it is, please help.

<?php
	/*
	* Created on 14.04.2007
	*
	* Code © Matthias Reuter (http://pc-intern.com)
	*
	* @package straightCMS (http://straightvisions.com)
	* @author Matthias Reuter (http://pc-intern.com)
	* @support: [url="http://projects.pc-intern.com"]http://projects.pc-intern.com[/url] - Support-Forum
	*
	* It would be nice to get a backlink to [url="http://ipbwi.com"]http://ipbwi.com[/url] to honor the work of the authors
	*
	* Released under the GNU Lesser General Public License
	* [url="http://www.gnu.org/licenses/lgpl.html"]http://www.gnu.org/licenses/lgpl.html[/url]
	*
	*/

	require_once('ipbsdk_class.inc.php');
	$SDK =& new IPBSDK();

	$page_title = 'Member Login';
	require_once('lib/php/includes.inc.php');

	if(isset($_POST) && $_POST['action'] == 'login') {
		if(empty($_POST['username'])) $system_info .= '<p>You have to type an username.</p>';
		elseif(empty($_POST['password']))	$system_info .= '<p>You have to type a password.</p>';
		else {
			if($SDK->login($_POST['username'],$_POST['password'],$_POST['setcookie'],$_POST['anonlogin'])) header('location: member_login.php').die();
			else $system_info .= $SDK->sdk_error();
		}
	}

	echo $header;

	// Error Output
	if(isset($system_info) && $system_info != '') { echo '<div class="info"><div class="i_system">'.$system_info.'</div></div>'; }

?>
		<h2>Login-Form</h2>
		<p><?php echo $systemstatus; ?></p>
<?php if($SDK->is_loggedin()) { ?>
		<p>Your are already logged in</p>
<?php } else { ?>
		<form action="member_login.php" method="post">
			<table>
				<tr>
					<td>
						<table>
							<tr><td>username</td><td><input style="width:200px;" type="text" name="username" /></td></tr>
							<tr><td>password</td><td><input style="width:200px;" type="password" name="password" /></td></tr>
						</table>
					</td><td>
						<table>
							<tr><td>remember login</td><td><input type="checkbox" name="setcookie" value="1" checked="checked" /></td></tr>
							<tr><td>anonymous login</td><td><input type="checkbox" name="anonlogin" value="1" /></td></tr>
						</table>
					</td>
				</tr>
				<tr><td colspan="2"><input type="submit" name="login" value="Login" /></td></tr>
			</table>
			<input type="hidden" name="action" value="login" />
		</form>
<?php } ?>
		<h2>Function References</h2>
		<p>The following important functions were used for this example:</p>
		<ul>
			<li><a href="http://projects.pc-intern.com/index.php?showtopic=5714">login</a></li>
		</ul>
<?php echo $footer; ?>

Edited by pistonsfreak, 09 February 2008 - 01:31 PM.


#2 pistonsfreak

    Young Padawan

  • Members
  • Pip
  • 174 posts

Posted 09 February 2008 - 01:31 PM

Just edited the code with a newer version of the script.

#3 Lastcrime

    Impatient Jedi that likes to eat cereal

  • Members
  • PipPipPip
  • 649 posts
  • Gender:Male
  • Location:Toronto, Ontario, Canada
  • Interests:Soccer, Snowboarding, Hockey, B-ball, Skateboarding, Computers!

Posted 09 February 2008 - 01:33 PM

that code looks perfectly fine all you have to do is setup a database i think..

#4 pistonsfreak

    Young Padawan

  • Members
  • Pip
  • 174 posts

Posted 09 February 2008 - 01:37 PM

The login script needs to get the database info from the IPB database. Plus, whenever I tried using the script, I would click login and it would go to this script but stay on a blank page.

#5 communiti.ch

    Young Padawan

  • Members
  • Pip
  • 52 posts

Posted 09 February 2008 - 05:15 PM

It's all correct :S
Just set the db!
Anyways I suggest you to make your own code :S
Downloding login script are usally more "fat weighted(KB)".

#6 pistonsfreak

    Young Padawan

  • Members
  • Pip
  • 174 posts

Posted 09 February 2008 - 05:19 PM

I am pretty sure the database is set in one of the files that are included in this script. So then basically if its correct, what code do I have to add to show the members username, PM's, settings, and logout link? And can someone post the header refresh php code, I lost it.

Thanks

#7 Lastcrime

    Impatient Jedi that likes to eat cereal

  • Members
  • PipPipPip
  • 649 posts
  • Gender:Male
  • Location:Toronto, Ontario, Canada
  • Interests:Soccer, Snowboarding, Hockey, B-ball, Skateboarding, Computers!

Posted 09 February 2008 - 07:26 PM

thats complicated man, you can't just get that out of nowhere, your better off using something like IPB or PHPBB

#8 pistonsfreak

    Young Padawan

  • Members
  • Pip
  • 174 posts

Posted 10 February 2008 - 11:09 AM

The forum is IPB.... I just need something like P2L has.

#9 communiti.ch

    Young Padawan

  • Members
  • Pip
  • 52 posts

Posted 11 February 2008 - 01:23 AM

View Postpistonsfreak, on Feb 9 2008, 06:19 PM, said:

I am pretty sure the database is set in one of the files that are included in this script. So then basically if its correct, what code do I have to add to show the members username, PM's, settings, and logout link? And can someone post the header refresh php code, I lost it.

Thanks
If you don't know PHP you are going nowhere!
Do you know what is a session?
If you known a little tiny bit of PHP you shouldn't have problems making your own login script :S

#10 pistonsfreak

    Young Padawan

  • Members
  • Pip
  • 174 posts

Posted 11 February 2008 - 05:50 PM

I dont know a lot of PHP, I rely on pre made scripts and Dreamweaver :/ I could probably pay someone for making a script like P2L's.

#11 joe

    Young Padawan

  • Members
  • Pip
  • 115 posts
  • Location:stuck in the middle of cyber space

Posted 24 February 2008 - 08:26 PM

hello everyone,
if may i to give an opinion and some of a suggest :
- for login script : when you click the login button, you should check the file member_login.php, coz that file (in your script) will process the user input in that form... :P
- for logout script : try to destroy your session and cookies, session and cookies created when you login (based on your script) and then redirect user into, maybe, main page or logout page.
- for setting script : honestly, i don't know what do you want from this script... :) but if may i to guess, this page all about your profile and web setting ??? this whole script totally complicated... :) maybe you ask the other senior member...

maybe it can help you... :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users