darrennickerson Posted July 17, 2008 Share Posted July 17, 2008 HI there im pretty new at php ive been around it for a while but im just getting interested in making my own scripts. Iam trying to customize a members script to fit my needs. All the script does now is log people in and bring to a blank members section and their able to edit their details and such but what i want to do is add a part into that script that will able them to add golf scores, putt, fairways hit ect. (Im starting a golf site) I thought i had a pretty good idea on how to do it but i obviously dont lol. If anyone out there can offer me any help id appriciate it. you will probaly need some more info from me too. i just dont know what. thanks in advance Link to comment https://forums.phpfreaks.com/topic/115328-general-question/ Share on other sites More sharing options...
unkwntech Posted July 17, 2008 Share Posted July 17, 2008 Do you intend on storing more then one set of scores per player? Could you show us the script? And please give us some of your database design info. Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592926 Share on other sites More sharing options...
darrennickerson Posted July 17, 2008 Author Share Posted July 17, 2008 Yes i want them to have multiple scores and stuff. this is what was giving me the trouble. www.golfblogonline.com/login is the script its from maaking.com Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592929 Share on other sites More sharing options...
unkwntech Posted July 17, 2008 Share Posted July 17, 2008 For the script we need the source... don't forget to insert it between \ tags when you post it. Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592932 Share on other sites More sharing options...
darrennickerson Posted July 17, 2008 Author Share Posted July 17, 2008 -- phpMyAdmin SQL Dump -- version 2.10.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Apr 26, 2008 at 06:17 AM -- Server version: 5.0.37 -- PHP Version: 5.2.2 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `login_script` -- -- -------------------------------------------------------- -- -- Table structure for table `maaking_admin` -- CREATE TABLE `maaking_admin` ( `adminid` int(11) NOT NULL auto_increment, `admin_name` varchar(10) NOT NULL default '', `password` varchar(50) NOT NULL default '', `email` varchar(50) NOT NULL default '', `fullname` varchar(50) default NULL, `site` varchar(105) NOT NULL default '', `country` varchar(50) NOT NULL default '', `city` varchar(50) NOT NULL default '', `tel` varchar(50) NOT NULL default '', `profile` text NOT NULL, `regdate` datetime NOT NULL default '0000-00-00 00:00:00', `ipaddress` varchar(50) NOT NULL default '', `lastlogin` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`adminid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `maaking_admin` -- INSERT INTO `maaking_admin` (`adminid`, `admin_name`, `password`, `email`, `fullname`, `site`, `country`, `city`, `tel`, `profile`, `regdate`, `ipaddress`, `lastlogin`) VALUES (1, 'admin', '71a81e2afb8ac1659c61c04c9d638f68', '[email protected]', 'Mohammed Ahmed', '', '', '', '', '', '0000-00-00 00:00:00', '', '2008-04-26 04:54:24'); -- -------------------------------------------------------- -- -- Table structure for table `maaking_options` -- CREATE TABLE `maaking_options` ( `site_name` varchar(50) NOT NULL default '', `site_email` varchar(50) NOT NULL default '', `site_url` varchar(50) NOT NULL default '', `site_info` text NOT NULL, `language` varchar(50) default NULL, `tmp_header` text NOT NULL, `tmp_footer` text NOT NULL, `validate` tinyint(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `maaking_options` -- INSERT INTO `maaking_options` (`site_name`, `site_email`, `site_url`, `site_info`, `language`, `tmp_header`, `tmp_footer`, `validate`) VALUES ('maaking Login System', '[email protected]', 'http://www.maaking.com/', 'login script, login, php, maaking,,,,,', 'english', '<div align="center">\r\n <table border="1" width="750" id="table1" cellpadding="2" bordercolor="#C0C0C0" height="74">\r\n <tr>\r\n <td bgcolor="#F2FAFF">go to setup and put all your \r\n stuff header here.</td>\r\n </tr>\r\n </table>\r\n</div>\r\n\r\n\r\n<!-- table for main suff-->\r\n <div align="center">\r\n <table border="0" width="750" id="table2" cellspacing="4" cellpadding="4">\r\n <tr>\r\n <td>', '</td>\r\n </tr>\r\n </table>\r\n</div>\r\n<!-- end of table for main suff-->\r\n\r\n\r\n<div align="center">\r\n <table border="1" width="750" id="table1" cellpadding="2" bordercolor="#C0C0C0" height="50">\r\n <tr>\r\n <td bgcolor="#F2FAFF">go to setup and put all your \r\n stuff footer here.</td>\r\n </tr>\r\n </table>\r\n</div>', 0); -- -------------------------------------------------------- -- -- Table structure for table `maaking_users` -- CREATE TABLE `maaking_users` ( `userid` int(11) NOT NULL auto_increment, `username` varchar(10) NOT NULL default '', `password` varchar(50) NOT NULL default '', `email` varchar(50) NOT NULL default '', `fullname` varchar(50) default NULL, `site` varchar(105) NOT NULL default '', `country` varchar(50) NOT NULL default '', `city` varchar(50) NOT NULL default '', `tel` varchar(50) NOT NULL default '', `profile` text NOT NULL, `regdate` datetime NOT NULL default '0000-00-00 00:00:00', `ipaddress` varchar(50) NOT NULL default '', `lastlogin` datetime NOT NULL default '0000-00-00 00:00:00', `isactive` tinyint(1) NOT NULL default '0', `code` varchar(10) NOT NULL, PRIMARY KEY (`userid`), KEY `userid` (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `maaking_users` -- Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592933 Share on other sites More sharing options...
unkwntech Posted July 18, 2008 Share Posted July 18, 2008 How about your your register script or the script to update the database. Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592938 Share on other sites More sharing options...
darrennickerson Posted July 18, 2008 Author Share Posted July 18, 2008 login_form(); } //this function will do the login porcess for you. function do_login(){ // define the values from the form. //note for functions: if you want to include a value of some variables inside the funtions, //then you have to GLOBAL it first. global $prefix,$db,$username,$password, $remember, $user_err,$pass_err,$error_msg,$validate; //check username and password fields. if((!$username) || (!$password)){ $reqmsg= "(<font class=\"error\">"._REQUIRED."</font>)"; if(trim(empty($username))){ $user_err= $reqmsg; } if(empty($password)){ $pass_err= $reqmsg; } //load the login form again. login_form(); exit(); } ##--nothing empty? lets do the login //encyrpt password for more Security $md5_pass = md5($password); $sql = $db->sql_query("SELECT * FROM ".$prefix."_users WHERE username='$username' AND password='$md5_pass'"); $login_check = $db->sql_numrows($sql); /////////////////////////////////////////////////////////////////////// //if the entered informations are correct, then login and create the cookies. if($login_check > 0){ $row = $db->sql_fetchrow($sql); $userid = $row['userid']; $username = $row['username']; $password = $row['password']; $ipaddress = $row['ipaddress']; $isactive = $row['isactive']; #if the user hasn't validated his account. if($isactive == 0){ echo "<br><br><br>"; echo "<font class=error>"._VALIDATE_ERROR_LOGIN."</font> "; echo "<br><br>"._GOHOME."<br>"; exit(); } $lastlogin = explode(" ", $row['lastlogin']); $lastlogin_date = $lastlogin[0]; $lastlogin_time = $lastlogin[1]; $info = base64_encode("$userid|$username|$password|$ipaddress|$lastlogin_date|$lastlogin_time"); if (isset($remember)){ setcookie("user","$info",time()+1209600); }else{ setcookie("user","$info",0); } $db->sql_query("UPDATE ".$prefix."_users SET ipaddress='$REMOTE_ADDR', lastlogin=NOW() WHERE userid='$userid'"); //print success message and redirect browser msg_redirect(""._LOGIN_SUCCESS."","users.php","5"); //if the entered informations are wrong, then print error message. }else{ //include("header.php"); $error_msg = "<font class=\"error\">"._LOGIN_ERROR."</font>"; unset($username); unset($password); login_form(); exit(); } } Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592944 Share on other sites More sharing options...
darrennickerson Posted July 18, 2008 Author Share Posted July 18, 2008 sorry that was the login function Register(){ register_form(); } function register_form(){ global $username, $password, $password2, $email, $fullname, $user_taken_err, $email_taken_err; echo "<center><font class=\"title\">"._REG_FORM."</font></center><br>\n"; //onsubmit='return CheckRegisterForm(RegisterForm)' echo "<center>"._FILED_STAR_REQUIRED." <form name=\"RegisterForm\" method=\"POST\" action=\"users.php\"> <table align=\"center\" border=\"1\" width=\"400\" id=\"table1\" cellpadding=\"2\" bordercolor=\"#C0C0C0\"> <tr> <td width=\"150\" align=\"right\">"._USERNAME." :</td> <td><input type=\"text\" name=\"username\" size=\"18\" value=\"$username\"> * $user_taken_err</td> </tr> <tr> <td align=\"right\">"._PASSWORD." :</td> <td><input type=\"password\" name=\"password\" size=\"18\" value=\"$password\"> *</td> </tr> <tr> <td align=\"right\">"._RETYPE_PASSWORD." :</td> <td><input type=\"password\" name=\"password2\" size=\"18\" value=\"$password2\"> *</td> </tr> <tr> <td align=\"right\">"._EMAIL." :</td> <td><input type=\"text\" name=\"email\" size=\"27\" value=\"$email\"> * $email_taken_err</td> </tr> <tr> <td align=\"right\">"._FULLNAME." :</td> <td><input type=\"text\" name=\"fullname\" size=\"27\" value=\"$fullname\"></td> </tr> <tr> <td> </td> <td> <input type=\"hidden\" name=\"maa\" value=\"do_Register\"> <input type=\"submit\" value=\""._REGISTER."\"></td> </tr> </table> </form> <center>"._GOBACK." "._GOHOME."</center>"; } function do_Register(){ global $db, $prefix, $username, $password, $password2, $email, $fullname, $user_taken_err, $email_taken_err; global $site_name, $site_email, $site_url, $validate; //this function will check fields incase of javascript not working. if((!$username) || (!$password) || (!$password2) || (!$email)){ if(trim(empty($username))){ } if(empty($password)){ } if(empty($password2)){ } if(trim(empty($email))){ } //print the error message and load the form. echo "<center><font class=\"error\">"._ERROR_PLEASE_FILL_FIELDS."</font></center>\n"; register_form(); exit(); } //this code will check if the 2 passwords are match or not. if($password != $password2){ //print the error message and load the form. register_form(); echo "<center><font class=\"error\">"._ERROR_PASSWORD_DOESNT_MATCH."</font></center>\n"; exit(); } //this code will check if the email is correct or not if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ //print the error message and load the form. register_form(); echo "<center><font class=\"error\">"._ERROR_INVALID_EMAIL."</font></center>\n"; exit(); } //--nothing empty? everything is okay? lets do the register. $sql_email_check = $db->sql_query("SELECT email FROM ".$prefix."_users WHERE email='$email'"); $sql_username_check = $db->sql_query("SELECT username FROM ".$prefix."_users WHERE username='$username'"); $email_check = $db->sql_numrows($sql_email_check); $username_check = $db->sql_numrows($sql_username_check); if(($email_check > 0) || ($username_check > 0)){ //define error message for usage in multi plces. $exist_msg= "<font class=\"error\">"._ALREADY_TAKEN."</font>"; if($email_check > 0){ $email_taken_err = $exist_msg; unset($email); } if($username_check > 0){ $user_taken_err = $exist_msg; unset($username); } //if the username or email already been taken load the form and print errors. register_form(); exit(); } //if you as and admin forsed users to vaildate their accounts. if($validate == 1){ $isactive = 0; //generate random code $code = md5(time()); $code = rand(0,999999999); $subject = _VALIDATE_EMAIL; }else{ $isactive = 1; $subject = _YOUR_INFO_AT; } $md5_password = md5($password); $result = $db->sql_query("INSERT INTO ".$prefix."_users ( username,password,email,fullname,regdate,isactive,code) " ." VALUES('$username','$md5_password','$email','$fullname',NOW(),'$isactive','$code')"); $eol ="\r\n"; $message = "$eol"; $message .= ""._WELCOME_TO." $site_name $eol"; $message .= "$eol"; $message .= ""._PLZ_KEEP_THIS_EMAIL." $eol"; $message .= "$eol"; $message .= "---------------------------- $eol"; $message .= ""._USERNAME.": $username $eol" ; $message .= ""._PASSWORD.": $password $eol"; $message .= "---------------------------- $eol"; $message .= "$eol" ; if($validate == 1){ $message .= ""._YOUR_ACCOUNT_IS_NOT_ACTIVE." $eol"; $message .= "$eol" ; $message .= "$site_url/users.php?maa=Activate&code=$code $eol"; }else{ $message .= ""._YOUR_ACCOUNT_IS_CURRENTLY_ACTIVE." $eol"; $message .= "$eol" ; $message .= "$site_url $eol"; } $message .= "$eol"; $message .= ""._PLZ_DONT_FORGOT_PWD." $eol"; $message .= " $eol"; $message .= ""._THANKS_FOR_REGISTERING." $eol"; $message .= "$eol"; $message .= "-- $eol"; $message .= "- $site_name $eol"; $message .= "$site_url $eol"; $message .= "$eol"; $message .= "$eol"; $message .= ""._THIS_EMAIL_AUTO_GENERATED." $eol" ; $message .= ""._DONT_RESPOND_WILL_IGNORED." $eol"; #set email headers to aviod spam filters $headers .= "From: ".$site_name."<".$site_email.">".$eol; $headers .= "Reply-To: ".$site_name."<".$site_email.">".$eol; $headers .= "Return-Path: ".$site_name."<".$site_email.">".$eol; $headers .= "Message-ID: <".time()."-".$site_email.">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $headers .= 'MIME-Version: 1.0'.$eol.$eol; if(!mail($email,$subject,$message, $headers)){ die (""._EMAIL_DIE.""); }else{ if($validate == 1){ echo "<br><br><div align=\"center\" class=\"div\">"._REG_SUCCESS_VALIDATE."</div><br><br> <center>"._GOHOME."</center>"; }else{ echo "<div align=\"center\" class=\"div\">"._REG_SUCCESS."</div>"; login_form(); } } }[code] [/code] Link to comment https://forums.phpfreaks.com/topic/115328-general-question/#findComment-592987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.