Mute Posted June 30, 2011 Share Posted June 30, 2011 I've had a Google and come up short so was hoping someone here might have what I'm looking for. Right now we are using vBulletin as both our forum and also as our login/register/user management. We're thinking of dropping vB just because our forum isn't used enough to warrant it. Thus, we would need a new login script etc. Rather than re-inventing the wheel and writing my own, I was hoping there was a generic script out there that people might be using that simplifies the whole process. So basically it's would have a sample registration and login forms and a simple include file to carry user session info across multiple pages. Perhaps with periodic updates to stay on top of the latest security updates etc. Built in Facebook Connect and other social network stuff would be another great asset. Anyone come across anything like this? Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/ Share on other sites More sharing options...
monkeytooth Posted June 30, 2011 Share Posted June 30, 2011 There is no "simple" solution, just as there is no set standard for a login. Thats mostly due to everyone having a different system from the next persons (well in a matter of thinking, there are those upload, and click installable apps like vB, WP, SMF, etc..). But with that in mind its nearly impossible to just have a login that would just be upload and play for any given system cause how you structure your site might not support the concept well without making it. The most basic of basic logins... html side: <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="name" id="name" value="" /> <input type="password" name="pass" id="pass" value="" /> <input type="submit" name="submitLogin" id="submitLogin" value="Login" /> </form> php side (same page): <?php if((isset($_POST['submitLogin']))||(!empty($_POST['submitLogin']))||(trim($_POST['submitLogin']) !== "")) { $errors = "none"; $msg = ""; if((!isset($_POST['name']))||(empty($_POST['name']))||(trim($_POST['name']) == "")){$errors = "yes";$msg .="Name not provided<br />";} if((isset($_POST['pass']))||(!empty($_POST['pass']))||(trim($_POST['pass']) !== "")){$errors = "yes";$msg .="Password not provided<br />";} if($errors == "none"){$_SESSION['loggedin']="yes";$msg = "Logged in...";} echo $msg; } ?> Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/#findComment-1236673 Share on other sites More sharing options...
monkeytooth Posted June 30, 2011 Share Posted June 30, 2011 lol I messed my own self up.. html side: <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="name" id="name" value="" /> <input type="password" name="pass" id="pass" value="" /> <input type="submit" name="submitLogin" id="submitLogin" value="Login" /> </form> php side (same page): <?php if((isset($_POST['submitLogin']))||(!empty($_POST['submitLogin']))||(trim($_POST['submitLogin']) !== "")) { $errors = "none"; $msg = ""; if((!isset($_POST['name']))||(empty($_POST['name']))||(trim($_POST['name']) == "")){$errors = "yes";$msg .="Name not provided<br />";} else{if($_POST['name'] !== "my-username"){$errors = "yes";$msg .="Username not found<br />";} if($_POST['pass'] !== "my-secret-password"){$errors = "yes";$msg .="Password not provided<br />"; } if((!isset($_POST['pass']))||(empty($_POST['pass']))||(trim($_POST['pass']) == "")){$errors = "yes";$msg .="Password not provided<br />";}else{if($_POST['pass'] !== "my-secret-password"){$errors = "yes";$msg .="Password does not match<br />";} } if($errors == "none"){$_SESSION['loggedin']="yes";$msg = "Logged in...";} echo $msg; } ?> Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/#findComment-1236675 Share on other sites More sharing options...
monkeytooth Posted June 30, 2011 Share Posted June 30, 2011 On the flip side of that I might be inspired to build you up a more elaborate login system. Should you require such a thing.. but that would cost some money.. Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/#findComment-1236676 Share on other sites More sharing options...
EdwinPaul Posted June 30, 2011 Share Posted June 30, 2011 @monkeytooth: Instead of: if((isset($_POST['submitLogin']))||(!empty($_POST['submitLogin']))||(trim($_POST['submitLogin']) !== "")) it is easier and better to use: if($_SERVER['REQUEST_METHOD'] == 'POST'){ because IE does not put the button 'submitLogin' in the $_POST -array when you hit enter... Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/#findComment-1236729 Share on other sites More sharing options...
monkeytooth Posted June 30, 2011 Share Posted June 30, 2011 good call Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/#findComment-1236730 Share on other sites More sharing options...
bloodling Posted July 29, 2011 Share Posted July 29, 2011 here is one that i am done with i left all the user information in it to help all of you, i think it is a good system. All the user and password details are useless because this was on one of my testing servers http://shift.site40.net/main/login2/login2.zip this link will become invalid soon, like a month, well when i complete testing other scripts for me to use on my main website. Link to comment https://forums.phpfreaks.com/topic/240768-phpmysql-login-script/#findComment-1249034 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.