Notoriouswow Posted August 7, 2009 Share Posted August 7, 2009 I Compiled This Simple Script, But I Need Help Making A Checkbox That You NEED To Check To Accept Terms and Conditions. Also Next To It A Link To My Terms and Conditions. <?php /* SPORA for ArcEMU v. 1.0 Original Creation by mirage666 for MaNGOS http://pomm.da.ru/ Modified for ArcEMU and WOTLK by Bljardkungen http://www.biljardkungen.tk Fixes: 1. Death Knight wasent a class but fixed now 2. Fixed picture for DK 3. Fixed some errors 4. made the flag to 24 instead of 44 */ $lang="en"; // Language ("en" - english, "ru" - russian) $title="Notorrious WoW"; // Insert the title of your server here $host="localhost"; // HOST for Character+logon database $user="root"; // USER for Character+logon database $password="ascent"; // PASS for Character+logon database $db="chat"; // NAME of Character+ logon database $hostr="localhost"; // HOST for Logonserver+characters database $userr="root"; // USER for Logonserver database[same as character] $passwordr="ascent"; // PASS for Logonserver+char database $dbr="chat"; // NAME of logon+char database $database_encoding = 'CP1251'; // Set encoding $img_base = "img/"; // Image dir $server = "notoriouswow.no-ip.org"; // ArcEMU server addres (the realmlist) $port = "8129"; // ArcEMU Server Port $lock_acc=1; // Lock created account to IP address (1 - on, 0 - off) $lock_reg=1; // Registration only one (or more) account from one IP address // 0 - not limit, 1 - one acc, 2 - two acc, etc... Switch ($lang) { case "en": $button="create_en.gif"; $text = Array( 'acc' => 'Creation of account', 'create' => 'is completed !', 'failed' => 'was not possible !', 'not_all' => 'Fields are filled not all', 'taken' => 'is already taken !', 'playerson' => 'players online', 'name' => 'Account Name', 'password' => 'Password', 'ip_limit' => Array('From your IP ',' accounts are already created'), ); break; } $maps_a = Array( 0 => 'Azeroth', 1 => 'Kalimdor', 2 => 'UnderMine', 13 => 'Test zone', 17 => 'Kalidar', 30 => 'Alterac Valley', 33 => 'Shadowfang Keep', 34 => 'The Stockade', 35 => 'Stormwind Prison', 36 => 'Deadmines', 37 => 'Plains of Snow', 43 => 'Wailing Caverns', 44 => 'Monastery Interior', 47 => 'Razorfen Kraul', 48 => 'Blackfathom Deeps', 70 => 'Uldaman', 90 => 'Gnomeregan', 109 => 'Sunken Temple', 129 => 'Razorfen Downs', 169 => 'Emerald Forest', 189 => 'Scarlet Monastery', 209 => 'Zul\'Farrak', 229 => 'Blackrock Spire', 230 => 'Blackrock Depths', 249 => 'Onyxias Lair', 269 => 'Caverns of Time', 289 => 'Scholomance', 309 => 'Zul\'Gurub', 329 => 'Stratholme', 349 => 'Maraudon', 369 => 'Deeprun Tram', 389 => 'Ragefire Chasm', 409 => 'The Molten Core', 429 => 'Dire Maul', 449 => 'Alliance PVP Barracks', 450 => 'Horde PVP Barracks', 451 => 'Development Land', 469 => 'Blackwing Lair', 489 => 'Warsong Gulch', 509 => 'Ruins of Ahn\'Qiraj', 529 => 'Arathi Basin', 530 => 'Burning Crusade Zones', 531 => 'Temple of Ahn\'Qiraj', 532 => 'Karazhan', 533 => 'Naxxramas', 534 => 'Hyjal Past', 540 => 'Shattered Halls', 542 => 'Blood Furnace', 543 => 'Hellfire Ramparts', 544 => 'Magtheridon\'s Lair', 545 => 'The Steamvault', 546 => 'The Black Temple', 547 => 'The Slave Pens', 548 => 'Coilfang Resevoir', 550 => 'The Eye', 552 => 'The Arcatraz', 553 => 'The Botanica', 554 => 'The Mechanar', 555 => 'Shadow Labyrinth', 556 => 'Sethekk Halls', 557 => 'Mana-Tombs', 558 => 'Auchenai Crypts', 559 => 'Nagrand Arena', 560 => 'Hillsbrad Past', 562 => 'Blade\'s Edge Arena', 564 => 'Black Temple', 565 => 'Gruul\'s Lair', 566 => 'Eye of the Storm', 568 => 'Zul\'aman', ); $zone = Array( 0 => Array( Array(700,10,1244,1873,'Undercity',1497), Array(-840,-1330,-5050,-4560,'Ironforge',1537), Array(1190,200,-9074,-8280,'Stormwind City',1519), Array(-2170,-4400,-7348,-6006,'Badlands',3), Array(-500,-4400,-4485,-2367,'Wetlands',11), Array(2220,-2250,-15422,-11299,'Stranglethorn Vale',33), Array(-1724,-3540,-9918,-8667,'Redridge Mountains',44), Array(-2480,-4400,-6006,-4485,'Loch Modan',38), Array(662,-1638,-11299,-9990,'Duskwood',10), Array(-1638,-2344,-11299,-9918,'Deadwind Pass',41), Array(834,-1724,-9990,-8526,'Elwynn Forest',12), Array(-500,-3100,-8667,-7348,'Burning Steppes',46), Array(-608,-2170,-7348,-6285,'Searing Gorge',51), Array(2000,-2480,-6612,-4485,'Dun Morogh',1), Array(-1575,-5425,-432,805,'The Hinterlands',47), Array(3016,662,-11299,-9400,'Westfall',40), Array(600,-1575,-1874,220,'Hillsbrad Foothills',267), Array(-2725,-6056,805,3800,'Eastern Plaguelands',139), Array(-850,-2725,805,3400,'Western Plaguelands',28), Array(2200,600,-900,1525,'Silverpine Forest',130), Array(2200,-850,1525,3400,'Tirisfal Glades',85), Array(-2250,-3520,-12800,-10666,'Blasted Lands',4), Array(-2344,-4516,-11070,-9600,'Swamp of Sorrows',, Array(-1575,-3900,-2367,-432,'Arathi Highlands',45), Array(600,-1575,220,1525,'Alterac Mountains',36), ), 1 => Array( Array(2698,2030,9575,10267,'Darnassus',1657), Array(326,-360,-1490,-910,'Thunder Bluff',1638), Array(-3849,-4809,1387,2222,'Orgrimmar',1637), Array(-1300,-3250,7142,8500,'Moonglade',493), Array(2021,-400,-9000,-6016,'Silithus',1377), Array(-2259,-7000,4150,8500,'Winterspring',618), Array(-400,-2094,-8221,-6016,'Un\'Goro Crater',490), Array(-590,-2259,3580,7142,'Felwood',361), Array(-3787,-8000,1370,6000,'Azshara',16), Array(-1900,-5500,-10475,-6825,'Tanaris',440), Array(-2478,-5500,-5135,-2330,'Dustwallow Marsh',15), Array(360,-1536,-3474,-412,'Mulgore',215), Array(4000,-804,-6828,-2477,'Feralas',357), Array(3500,360,-2477,372,'Desolace',405), Array(-804,-5500,-6828,-4566,'Thousand Needles',400), Array(-3758,-5500,-1300,1370,'Durotar',14), Array(1000,-3787,1370,4150,'Ashenvale',331), Array(2500,-1300,4150,8500,'Darkshore',148), Array(3814,-1100,8600,11831,'Teldrassil',141), Array(3500,-804,-412,3580,'Stonetalon Mountains',406), Array(-804,-4200,-4566,1370,'The Barrens',17), ), 530 => Array( Array(6135.25,4829,-2344.78,-1473.95,'Shattrath City',3703), Array(-6400.75,-7612.20,9346.93,10153.70,'Silvermoon City',3487), Array(5483.33,-91.66,1739.58,5456.25,'Netherstorm',3523), Array(7083.33,1683.33,-4600,-999.99,'Terokkar Forest',3519), Array(10295.83,4770.83,-3641.66,41.66,'Nagrand',3518), Array(-10075,-13337.49,-2933.33,-758.33,'Bloodmyst Isle',3525), Array(8845.83,3420.83,791.66,4408.33,'Blades Edge Mountains',3522), Array(4225,-1275,-5614.58,-1947.91,'Shadowmoon Valley',3520), Array(-11066.36,-12123.13,-4314.37,-3609.68,'The Exodar',3557), Array(9475,4447.91,-1416.66,1935.41,'Zangarmarsh',3521), Array(5539.58,375,-1962.49,1481.25,'Hellfire Peninsula',3483), Array(-10500,-14570.83,-5508.33,-2793.75,'Azuremyst Isle',3524), Array(-5283.33,-8583.33,6066.66,8266.66,'Ghostlands',3433), Array(-4487,-9412,7758,11041,'Eversong Woods',3430) ), ); $def = Array( 'character_race' => Array( 1 => 'Human', 2 => 'Orc', 3 => 'Dwarf', 4 => 'Night Elf', 5 => 'Undead', 6 => 'Tauren', 7 => 'Gnome', 8 => 'Troll', 9 => 'Goblin', 10 => 'Blood Elf', 11 => 'Draenei', ), 'character_class' => Array( 1 => 'Warrior', 2 => 'Paladin', 3 => 'Hunter', 4 => 'Rogue', 5 => 'Priest', 6 => 'Death Knight', 7 => 'Shaman', 8 => 'Mage', 9 => 'Warlock', 11 => 'Druid', ), ); class DBLayer { var $link_id; var $query_result; var $saved_queries = array(); var $num_queries = 0; function DBLayer($db_host, $db_username, $db_password, $db_name) { $this->link_id = @mysql_connect($db_host, $db_username, $db_password, true); if ($this->link_id) { if (@mysql_select_db($db_name, $this->link_id)) return $this->link_id; else error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__); } else error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__); } function query($sql) { $this->query_result = @mysql_query($sql, $this->link_id); if ($this->query_result) { ++$this->num_queries; return $this->query_result; } else { return false; } } function result($query_id = 0, $row = 0) { return ($query_id) ? @mysql_result($query_id, $row) : false; } function fetch_assoc($query_id = 0) { return ($query_id) ? @mysql_fetch_assoc($query_id) : false; } function fetch_row($query_id = 0) { return ($query_id) ? @mysql_fetch_row($query_id) : false; } function num_rows($query_id = 0) { return ($query_id) ? @mysql_num_rows($query_id) : false; } function affected_rows() { return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false; } function insert_id() { return ($this->link_id) ? @mysql_insert_id($this->link_id) : false; } function get_num_queries() { return $this->num_queries; } function get_saved_queries() { return $this->saved_queries; } function free_result($query_id = false) { return ($query_id) ? @mysql_free_result($query_id) : false; } function escape($str) { if (function_exists('mysql_real_escape_string')) return mysql_real_escape_string($str, $this->link_id); else return mysql_escape_string($str); } function error() { $result['error_sql'] = @current(@end($this->saved_queries)); $result['error_no'] = @mysql_errno($this->link_id); $result['error_msg'] = @mysql_error($this->link_id); return $result; } function close() { if ($this->link_id) { if ($this->query_result) @mysql_free_result($this->query_result); return @mysql_close($this->link_id); } else return false; } } function error($message, $file, $line, $db_error = false) { global $siteerrors; $s = "\t\t".'Error: <strong>'.$message.'.</strong>'."\n"; echo $s; } function get_zone_name($mapid, $x, $y){ global $maps_a, $zone; if (!empty($maps_a[$mapid])) { $zmap=$maps_a[$mapid]; if (($mapid==0) or ($mapid==1) or ($mapid==530)) { $i=0; $c=count($zone[$mapid]); while ($i<$c) { if ($zone[$mapid][$i][2] < $x AND $zone[$mapid][$i][3] > $x AND $zone[$mapid][$i][1] < $y AND $zone[$mapid][$i][0] > $y) $zmap=$zone[$mapid][$i][4]; $i++; } } } else $zmap="Unknown zone"; return $zmap; } function test_realm(){ global $server, $port; $s = @fsockopen("$server", $port, $ERROR_NO, $ERROR_STR,(float)0.5); if($s){@fclose($s);return true;} else return false; } function get_realm_name(){ global $hostr, $userr, $passwordr, $dbr, $database_encoding; $realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr); $realm_db->query("SET NAMES $database_encoding"); $query = $realm_db->query("SELECT * FROM `realmlist`"); $result = $realm_db->fetch_assoc($query); $realm_db->close(); unset($realm_db); return($result['name']); } if (empty($_POST['username']) and empty($_POST['passw']) and empty($_POST['email'])) { $cont=' <TR> <TD rowSpan=6><IMG height=110 src="'.$img_base.'pixel.gif" width=15></TD> <TD vAlign=center align=left width=190><B style="FONT-SIZE: 8pt;"><LABEL for=username>'.$text["name"].':</LABEL> </b><BR><INPUT id=username style="WIDTH: 175px" tabIndex=1 maxLength=16 size=18 name=username></TD> <TD rowSpan=6><IMG height=1 src="'.$img_base.'pixel.gif" width=15></TD></TR> <TR><TD width=190 height=1></TD></TR> <TR><TD width=190 height=1></TD></TR> <TR> <TD vAlign=center align=left width=190><B style="FONT-SIZE: 8pt;"><LABEL for=passw>'.$text["password"].':</LABEL> </B><BR><INPUT id=passw style="WIDTH: 175px" tabIndex=2 type=password maxLength=16 size=18 name=passw></TD></TR> <TR> <TD vAlign=center align=left width=190><B style="FONT-SIZE: 8pt;"><LABEL for=email>E-mail:</LABEL> </B><BR><INPUT id=email style="WIDTH: 175px" tabIndex=2 maxLength=50 size=18 name=email></TD></TR> <TR> <TD align=left> <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <input type="checkbox" name="flags" value="1" checked></td> <TD></TD> <TD></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD align=left colSpan=3> <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD><IMG height=39 src="'.$img_base.'pixel.gif" width=19></TD> <TD><INPUT class=button style="WIDTH: 168px; HEIGHT: 39px" tabIndex=3 type=image alt=Create src="'.$img_base.$button.'" value=Create border=0></TD> </TR></TBODY></TABLE></TD></TR>'; } elseif (empty($_POST['username']) or empty($_POST['passw']) or empty($_POST['email'])) { $cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error> '.$text["not_all"].' <br><br><br><br></SMALL></TD></TD></TR><br>'; } else { $username = htmlspecialchars(trim("$_POST[username]")); $passw = trim($_POST['passw']); $email = htmlspecialchars(trim($_POST['email'])); $ip = getenv('REMOTE_ADDR'); // ñäåëàòü ïðîâåðêó íà íåïîëó÷åíèå èïà $realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr); $realm_db->query("SET NAMES $database_encoding"); if($realm_db->query("INSERT INTO `flashchat_users` (login, password, roles, profile) VALUES ('$username','$passw','1','NULL')")) { $cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL> '.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["create"].' <br><br><br><br></SMALL></TD></TD></TR><br>'; } else { $cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error> '.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["failed"].' <br><br><br><br></SMALL></TD></TD></TR><br>'; } } function make_players_array(){ global $host, $user, $password, $db, $database_encoding, $pl_array; $i=0; $ascent_db = new DBLayer($host, $user, $password, $db); $ascent_db->query("SET NAMES $database_encoding"); $query = $ascent_db->query("SELECT * FROM `logon_all_realms` WHERE `online`='1' ORDER BY `name`"); while($result = $ascent_db->fetch_assoc($query)) { $char_data = ($result['level']); $char_gender = ($result['gender']); $res_pos=get_zone_name($result['mapId'], $result['positionX'], $result['positionY']); $pl_array[$i] = Array($result['name'], $result['race'], $result['class'], $char_data, $res_pos, $char_gender); $i++; } $ascent_db->close(); unset($ascent_db); return $i; } $onlineplayers=make_players_array(); if (!$sort = &$_GET['s']) $sort=0; if (!$flag = &$_GET['f']) $flag=0; if ($flag==0) { $flag=1; $sort_type='<'; } else { $flag=0; $sort_type='>'; } $link=$_SERVER['PHP_SELF']."?f=".$flag."&s="; if (!empty($pl_array)) { usort($pl_array, create_function('$a, $b', 'if ( $a['.$sort.'] == $b['.$sort.'] ) return 0; if ( $a['.$sort.'] '.$sort_type.' $b['.$sort.'] ) return -1; return 1;')); } $list=""; $i=0; while ($i < $onlineplayers) { $name=$pl_array[$i][0]; $race=$pl_array[$i][1]; $class=$pl_array[$i][2]; $res_race = $def['character_race'][$race]; $res_class = $def['character_class'][$class]; $lvl=$pl_array[$i][3]; $loc=$pl_array[$i][4]; $gender=$pl_array[$i][5]; $list.= " <tr class=txt> <td></td> <td>$name</td> <td align='center'><img alt=$res_race src='".$img_base.$race."-$gender.gif' height='18' width='18'></td> <td align='center'><img alt=$res_class src='".$img_base."$class.gif' height='18' width='18'></td> <td align='center'>$lvl</td> <td >$loc</td> </tr>"; $i++; } if (test_realm()) { $title.=(' ('.$onlineplayers.' '.$text["playerson"].')'); } else { $title.=(' '.$text["off"]); } // Main part !!! ?> <HTML><HEAD><META HTTP-EQUIV="Pragma" CONTENT="no-cache"><TITLE><?php print $title ?></TITLE> <META http-equiv=Content-Type content="text/html; charset=windows-1251"><LINK id=bnetstyle href="<?php print $img_base ?>style.css" type=text/css rel=stylesheet> <SCRIPT language=javascript> <!-- var styleSheet; var agt = navigator.userAgent.toLowerCase(); var appVer = navigator.appVersion.toLowerCase(); var verInt = parseInt(appVer); var ie = (appVer.indexOf('msie') != -1); var opera = (agt.indexOf('opera') != -1); var mozilla = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('opera')==-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); var ns4 = (mozilla && (verInt == 4)); if (ie && !opera) { document.styleSheets["bnetstyle"].addRule ("input", "background-color: #040D1A"); document.styleSheets["bnetstyle"].addRule ("input", "border-style: solid"); document.styleSheets["bnetstyle"].addRule ("input", "border-width: 1px"); document.styleSheets["bnetstyle"].addRule ("input", "border-color: #7F7F7F"); document.styleSheets["bnetstyle"].addRule ("input", "color: #FFAC04"); document.styleSheets["bnetstyle"].addRule ("textarea", "background-color: #040D1A"); document.styleSheets["bnetstyle"].addRule ("textarea", "border-style: solid"); document.styleSheets["bnetstyle"].addRule ("textarea", "border-width: 1px"); document.styleSheets["bnetstyle"].addRule ("textarea", "border-color: #7F7F7F"); document.styleSheets["bnetstyle"].addRule ("textarea", "color: #FFAC04"); document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Base-Color: #012158"); document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Arrow-Color: #7F7F7F"); document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-3dLight-Color: #7F7F7F"); document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-DarkShadow-Color: black"); document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Highlight-Color: black"); document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Shadow-Color: #00B3FF"); document.styleSheets["bnetstyle"].addRule ("select", "background-color: #040D1A"); document.styleSheets["bnetstyle"].addRule ("select", "color: #FFAC04"); document.styleSheets["bnetstyle"].addRule ("select.gray", "background-color: #040D1A"); document.styleSheets["bnetstyle"].addRule ("select.gray", "color: #FFAC04"); document.styleSheets["bnetstyle"].addRule ("ul.thread", "margin-left: 22px;"); } //--> </SCRIPT> </HEAD> <BODY text=#cccc99 vLink=#aaaaaa link=#ffffbb bgColor=#000000 leftMargin=0 topMargin=0 marginheight="0" marginwidth="0"> <FORM name=login_form method=post> <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD align=middle> <TABLE cellSpacing=0 cellPadding=0 background="<?php print $img_base ?>back_create.jpg" border=0 style="background-repeat: no-repeat;"> <TBODY> <TR> <TD vAlign=top> <DIV style="POSITION: relative"> <DIV style="LEFT: 130px; WIDTH: 400px; POSITION: absolute; TOP: 0px"></DIV></DIV></TD> <TD><IMG height=169 src="<?php print $img_base ?>pixel.gif" width=1></TD> <TD></TD></TR> <TR> <TD><IMG height=1 src="<?php print $img_base ?>pixel.gif" width=203></TD> <TD> <TABLE cellSpacing=0 cellPadding=0 width=220 border=0> <TBODY> <?php print $cont ?></TBODY></TABLE></TD> <TD><IMG height=1 src="<?php print $img_base ?>pixel.gif" width=217></TD></TR> <TR> <TD colSpan=3> <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD colSpan=3><IMG height=17 src="<?php print $img_base ?>pixel.gif" width=1></TD></TR> <TR> <TD width=106><IMG height=1 src="<?php print $img_base ?>pixel.gif" width=106></TD> <TD width=410><SMALL> <class=text> <table cellpadding='3' cellspacing='0' align='center'> <tbody> <tr><td class='txt' align='center' colspan='6' nowrap='nowrap'><IMG height=1 src='<?php print $img_base ?>pixel.gif' width=400></td></tr> <?php print $list ?> </tbody> </table> </SMALL></TD> <TD width=124><IMG height=1 src="<?php print $img_base ?>pixel.gif" width=124></TD></TR> <TR> <TD colSpan=3><IMG height=100 src="<?php print $img_base ?>pixel.gif" width=1></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM></BODY></HTML> Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/ Share on other sites More sharing options...
_DarkLink_ Posted August 7, 2009 Share Posted August 7, 2009 First, as an example, to make a check box and a submit button in a form: <form name="testform" action="myphpfile.php" method="POST" onsubmit="return validate();"> <input type="checkbox" name="terms"> I accept the <a href="http://www.example.com/terms.html">Term and Conditions</a>. <input type="submit" value="Register" name="submit"> </form> Alright, so to validate if the check box is checked, there are two ways, you either use PHP to validate it AFTER the form is sent and send the user back to the form if it is not checked, Or simply use JavaScript to check it if it is checked BEFORE the form is sent, an example would be: <script type="text/javascript"> function validate(){ if (document.testform.terms.checked == false) { alert ( "Please accept the terms before continuing." ); return false; } else { return true; } } </script> So basically the JavaScript checks the form, on submit if the check box is checked, it it's not, send a little pop up message saying to check it and the form is not submitted. If it is checked, then let the form submit. Hope it helps. Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/#findComment-892630 Share on other sites More sharing options...
_DarkLink_ Posted August 7, 2009 Share Posted August 7, 2009 Oh and since this is a PHP forum, I'll make a little PHP validation script too. <form name="testform" action="myphpfile.php" method="POST" onsubmit="return validate();"> <input type="checkbox" name="terms" value="on"> I accept the <a href="http://www.example.com/terms.html">Term and Conditions</a>. <input type="submit" value="Register" name="submit"> </form> PHP processing script: <?php if ($_POST['submit']) { if {$_POST['terms'] =="on") { //your piece of code that will execute if terms are checked. } else{ echo "Please accept the Terms and Contions first."; header("Refresh: 5; url=registrationform.html");//if it isn't checked, send back to the registration form in five seconds. } } ?> Hope it helps. Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/#findComment-892632 Share on other sites More sharing options...
Notoriouswow Posted August 18, 2009 Author Share Posted August 18, 2009 Actually, I Submitted The Wrong Script. This One Is Much Shorter, I Just Wanted To Know How Would I Insert This Into The Script? I Got Errors Every time I Tried. <?php $locale['400'] = "Register"; $locale['401'] = "Activate Account"; // Registration Errors $locale['402'] = "You must specify a user name, password & email address."; $locale['403'] = "User name contains invalid characters."; $locale['404'] = "Your two Passwords do not match."; $locale['405'] = "Invalid password, use alpha numeric characters only.<br> Password must be a minimum of 6 characters long."; $locale['406'] = "Your email address does not appear to be valid."; $locale['407'] = "Sorry, the user name ".(isset($_POST['username']) ? $_POST['username'] : "")." is in use."; $locale['408'] = "Sorry, the email address ".(isset($_POST['email']) ? $_POST['email'] : "")." is in use."; $locale['409'] = "An inactive account has been registered with the email address."; $locale['410'] = "Incorrect validation code."; $locale['411'] = "Your email address or email domain is blacklisted."; // Email Message $locale['449'] = "Welcome to ".$settings['sitename']; $locale['450'] = "Hello ".(isset($_POST['username']) ? $_POST['username'] : "").",\n Welcome to ".$settings['sitename'].". Here are your login details:\n Username: ".(isset($_POST['username']) ? $_POST['username'] : "")." Password: ".(isset($_POST['password1']) ? $_POST['password1'] : "")."\n Please activate your account via the following link:\n"; // Registration Success/Fail $locale['451'] = "Registration complete"; $locale['452'] = "You can now log in site.<br><br><span style='color:#ff0000;'><font size='2'>Note : You will have to wait <b><u>10</u></b> minutes before your Game account is activated on the server!</font></span>"; $locale['453'] = "An administrator will activate your account shortly."; $locale['454'] = "Your registration is almost complete, you will receive an email containing your login details along with a link to verify your account."; $locale['455'] = "Your account has been verified."; $locale['456'] = "Registration Failed"; $locale['457'] = "Send mail failed, please contact the <a href='mailto:".$settings['siteemail']."'>Site Administrator</a>."; $locale['458'] = "Registration failed for the following reason(s):"; $locale['459'] = "Please Try Again"; // Register Form $locale['500'] = "Please enter your details below. "; $locale['501'] = "A verification email will be sent to your specified email address. "; $locale['502'] = "Fields marked <span style='color:#ff0000;'>*</span> must be completed. Your user name and password is case-sensitive."; $locale['503'] = " You can enter additional information by going to Edit Profile once you are logged in."; $locale['504'] = "Validation Code:"; $locale['505'] = "Enter Validation Code:"; $locale['506'] = "Register"; $locale['507'] = "The registration system is currently disabled."; // Validation Errors $locale['550'] = "Please specify a user name."; $locale['551'] = "Please specify a password."; $locale['552'] = "Please specify an email address."; ?> Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/#findComment-900690 Share on other sites More sharing options...
Notoriouswow Posted August 18, 2009 Author Share Posted August 18, 2009 <?php /*---------------------------------------------------+ | PHP-Fusion 6 Content Management System +----------------------------------------------------+ | Copyright © 2002 - 2006 Nick Jones | http://www.php-fusion.co.uk/ +----------------------------------------------------+ | Released under the terms & conditions of v2 of the | GNU General Public License. For details refer to | the included gpl.txt file or visit http://gnu.org +----------------------------------------------------*/ require_once "maincore.php"; require_once "subheader.php"; require_once "side_left.php"; include LOCALE.LOCALESET."register.php"; include LOCALE.LOCALESET."user_fields.php"; if (iMEMBER) fallback("index.php"); if ($settings['enable_registration']) { if (isset($activate)) { if (!preg_match("/^[0-9a-z]{32}$/", $activate)) fallback("index.php"); $result = dbquery("SELECT * FROM ".$db_prefix."new_users WHERE user_code='$activate'"); if (dbrows($result) != 0) { $data = dbarray($result); $user_info = unserialize($data['user_info']); $activation = $settings['admin_activation'] == "1" ? "2" : "0"; $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('".$user_info['user_name']."', '".$user_info['user_password']."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', 'Default', '0', '', '', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')"); $result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'"); opentable($locale['401']); if ($settings['admin_activation'] == "1") { echo "<center><br>\n".$locale['455']."<br><br>\n".$locale['453']."<br><br>\n</center>\n"; } else { echo "<center><br>\n".$locale['455']."<br><br>\n".$locale['452']."<br><br>\n</center>\n"; } closetable(); } else { fallback("index.php"); } } else if (isset($_POST['register'])) { $error = ""; $username = stripinput(trim(eregi_replace(" +", " ", $_POST['username']))); $email = stripinput(trim(eregi_replace(" +", "", $_POST['email']))); $password1 = stripinput(trim(eregi_replace(" +", "", $_POST['password1']))); if ($username == "" || $password1 == "" || $email == "") $error .= $locale['402']."<br>\n"; if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) $error .= $locale['403']."<br>\n"; if (preg_match("/^[0-9A-Z@]{6,20}$/i", $password1)) { if ($password1 != $_POST['password2']) $error .= $locale['404']."<br>\n"; } else { $error .= $locale['405']."<br>\n"; } if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) { $error .= $locale['406']."<br>\n"; } $email_domain = substr(strrchr($email, "@"), 1); $result = dbquery("SELECT * FROM ".$db_prefix."blacklist WHERE blacklist_email='".$email."' OR blacklist_email='$email_domain'"); if (dbrows($result) != 0) $error = $locale['411']."<br>\n"; $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_name='$username'"); if (dbrows($result) != 0) $error = $locale['407']."<br>\n"; $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_email='".$email."'"); if (dbrows($result) != 0) $error = $locale['408']."<br>\n"; if ($settings['email_verification'] == "1") { $result = dbquery("SELECT * FROM ".$db_prefix."new_users"); while ($new_users = dbarray($result)) { $user_info = unserialize($new_users['user_info']); if ($new_users['user_email'] == $email) { $error = $locale['409']."<br>\n"; } if ($user_info['user_name'] == $username) { $error = $locale['407']."<br>\n"; break; } } } if ($settings['display_validation'] == "1") { if (!check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) { $error .= $locale['410']."<br />\n"; } } $user_hide_email = isNum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1"; if ($settings['email_verification'] == "0") { $user_location = isset($_POST['user_location']) ? stripinput(trim($_POST['user_location'])) : ""; if ($_POST['user_month'] != 0 && $_POST['user_day'] != 0 && $_POST['user_year'] != 0) { $user_birthdate = (isNum($_POST['user_year']) ? $_POST['user_year'] : "0000") ."-".(isNum($_POST['user_month']) ? $_POST['user_month'] : "00") ."-".(isNum($_POST['user_day']) ? $_POST['user_day'] : "00"); } else { $user_birthdate = "0000-00-00"; } $user_aim = isset($_POST['user_aim']) ? stripinput(trim($_POST['user_aim'])) : ""; $user_icq = isset($_POST['user_icq']) ? stripinput(trim($_POST['user_icq'])) : ""; $user_msn = isset($_POST['user_msn']) ? stripinput(trim($_POST['user_msn'])) : ""; $user_yahoo = isset($_POST['user_yahoo']) ? stripinput(trim($_POST['user_yahoo'])) : ""; $user_web = isset($_POST['user_web']) ? stripinput(trim($_POST['user_web'])) : ""; $user_theme = stripinput($_POST['user_theme']); $user_offset = is_numeric($_POST['user_offset']) ? $_POST['user_offset'] : "0"; $user_sig = isset($_POST['user_sig']) ? stripinput(trim($_POST['user_sig'])) : ""; } if ($error == "") { if ($settings['email_verification'] == "1") { require_once INCLUDES."sendmail_include.php"; mt_srand((double)microtime()*1000000); $salt = ""; for ($i=0;$i<=7;$i++) { $salt .= chr(rand(97, 122)); } $user_code = md5($email.$salt); $activation_url = $settings['siteurl']."register.php?activate=".$user_code; if (sendemail($username,$email,$settings['siteusername'],$settings['siteemail'],$locale['449'], $locale['450'].$activation_url)) { $user_info = serialize(array( "user_name" => $username, "user_password" => md5(md5($password1)), "user_email" => $email, "user_hide_email" => isNum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1" )); $result = dbquery("INSERT INTO ".$db_prefix."new_users (user_code, user_email, user_datestamp, user_info) VALUES('$user_code', '".$email."', '".time()."', '$user_info')"); opentable($locale['400']); echo "<center><br>\n".$locale['454']."<br><br>\n</center>\n"; closetable(); } else { opentable($locale['456']); echo "<center><br>\n".$locale['457']."<br><br>\n</center>\n"; closetable(); } } else { $activation = $settings['admin_activation'] == "1" ? "2" : "0"; $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('$username', '".md5(md5($password1))."', '".$email."', '$user_hide_email', '$user_location', '$user_birthdate', '$user_aim', '$user_icq', '$user_msn', '$user_yahoo', '$user_web', 'Default', '$user_offset', '', '$user_sig', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '0')"); opentable($locale['400']); if ($settings['admin_activation'] == "1") { echo "<center><br>\n".$locale['451']."<br><br>\n".$locale['453']."<br><br>\n</center>\n"; } else { echo "<center><br>\n".$locale['451']."<br><br>\n".$locale['452']."<br><br>\n</center>\n"; } closetable(); //this line make by asicstar and blitztech include_once("includes/connection.php"); $query="INSERT INTO accounts(login,password,email,gm,flags,banned,lastlogin,lastip) VALUES ('".$username."','".$password1."','".$email."',0,8,0,'0000-00-00 00:00:00','".USER_IP."')"; mysql_query($query); @mysql_select_db ("$db_name"); } } else { opentable($locale['456']); echo "<center><br>\n".$locale['458']."<br><br>\n$error<br>\n<a href='".FUSION_SELF."'>".$locale['459']."</a></div></br>\n"; closetable(); } } else { if ($settings['email_verification'] == "0") { $theme_files = makefilelist(THEMES, ".|..", true, "folders"); array_unshift($theme_files, "Default"); $offset_list = ""; for ($i=-13;$i<17;$i++) { if ($i > 0) { $offset="+".$i; } else { $offset=$i; } $offset_list .= "<option".($offset == "0" ? " selected" : "").">$offset</option>\n"; } } opentable($locale['400']); echo "<center><img src='".BASEDIR."images/register.png'></center><center>".$locale['500']."\n"; if ($settings['email_verification'] == "1") echo $locale['501']."\n"; echo $locale['502']; if ($settings['email_verification'] == "1") echo "\n".$locale['503']; echo "</center><br> <table align='center' cellpadding='0' cellspacing='0'> <form name='inputform' method='post' action='".FUSION_SELF."' onSubmit='return ValidateForm(this)'> <tr> <td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td> <td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;'></td> </tr> <tr> <td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td> <td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;'></td> </tr> <tr> <td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td> <td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;'></td> </tr> <tr> <td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td> <td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;'></td> </tr> <tr> <td class='tbl'>".$locale['u006']."</td> <td class='tbl'><input type='radio' name='user_hide_email' value='1'>".$locale['u007']." <input type='radio' name='user_hide_email' value='0' checked>".$locale['u008']."</td> </tr>\n"; if ($settings['display_validation'] == "1") { echo "<tr>\n<td class='tbl'>".$locale['504']."</td>\n<td class='tbl'>"; echo make_captcha(); echo "</td> </tr> <tr> <td class='tbl'>".$locale['505']."<span style='color:#ff0000'>*</span></td> <td class='tbl'><input type='text' name='captcha_code' class='textbox' style='width:100px'></td> </tr>\n"; } if ($settings['email_verification'] == "0") { echo "<tr> <td class='tbl'>".$locale['u009']."<span style='color:#ff0000'>*</span></td> <td class='tbl'><input type='text' name='user_location' maxlength='50' class='textbox' style='width:200px;'></td> </tr> \n"; } echo "<tr> <td align='center' colspan='2'><br> <input type='submit' name='register' value='".$locale['506']."' class='button'> </td> </tr> </form> </table>"; closetable(); echo "<script language='JavaScript'> function ValidateForm(frm) { if (frm.username.value==\"\") { alert(\"".$locale['550']."\"); return false; } if (frm.password1.value==\"\") { alert(\"".$locale['551']."\"); return false; } if (frm.email.value==\"\") { alert(\"".$locale['552']."\"); return false; } } </script>\n"; } } else { opentable($locale['400']); echo "<center><br>\n".$locale['507']."<br><br>\n</center>\n"; closetable(); } <form name="testform" action="myphpfile.php" method="POST" onsubmit="return validate();"> <input type="checkbox" name="terms"> I Accept The <a href="http://notoriouswow.no-ip.org/viewpage.php?page_id=58">Term and Conditions</a>. <input type="submit" value="Register" name="submit"> </form> } <script type="text/javascript"> function validate(){ if (document.testform.terms.checked == false) { alert ( "Please accept the terms before continuing." ); return false; } else { return true; } } </script> } require_once "side_right.php"; require_once "footer.php"; ?> Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/#findComment-900697 Share on other sites More sharing options...
Notoriouswow Posted August 19, 2009 Author Share Posted August 19, 2009 BUMP ... Please Help! Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/#findComment-901629 Share on other sites More sharing options...
Notoriouswow Posted August 20, 2009 Author Share Posted August 20, 2009 Bumpidy Doo Link to comment https://forums.phpfreaks.com/topic/169172-website-registration-script/#findComment-902714 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.