function showform() { $webname = $_SERVER["PHP_SELF"]; $username = getvardata("username", ""); $password = getvardata("password", ""); $errormsg = getvardata("errormsg", ""); java(); echo "<form name='mlogin' id='mlogin' action=\"{$webname}\" method='POST'>\n"; echo "<input type=hidden name=nextact id=nextact value=\"{$nextact}\">\n"; echo "<input type=hidden name=errmsg id=errmsg value=\"{$errormsg}\">\n"; echo "\t\t\tUsername? <input type=text name=username id=username value=\"{$username}\" size=10\">\n"; echo "\t\t\tPassword? <input type=password name=password id=password value=\"{$password}\" size=10>\n"; echo "\t\t\t<hr/>\n"; echo "\t\t\t<a href=\"#\" onclick=\"setnext('login');\">\"Login\"</a> \n"; echo "\t\t\t<a href='../../mobile.php'>\"Quit\"</a>\n"; echo "</form>\n"; if (strlen($errmsg) > 0) { echo "<hr>\n"; echo $errormsg; } setfocus("username"); }
function savepass($user, $pass1, $pass2, $shandle) { echo "<div name='savepass' id='savepass' class='nclass'>\n"; if ($pass1 == $pass2) { // save encrypted pass to table $usepass = md5($pass1); $sql = "update accounts set password=\"{$usepass}\" where username=\"{$user}\""; echo "<!-- update[{$sql}] -->\n"; $sresult = mysql_query($sql, $shandle) or die("Cannot update accounts"); echo "Thank you {$user},<br/>Your new password has been set<br/>\n"; echo "<input type=button name='ebtn' id='ebtn' value='Next ->' onclick=\"go('login');\">\n"; setfocus('ebtn'); } else { // setup error and loop to getpass echo "<input type=hidden name='error' id='error' value=\"Passwords not the same, please re-enter your password.\">\n"; echo "<script type='text/javascript'>setnext('getnewpass');go('pages/login/changepass.inc')</script>\n"; } echo "</div>\n"; }
function fillform($shandle, $username, $fullname, $password, $passchk, $email, $question, $answer, $ru_nextact, $error) { $cbtn = strlen($error) < 1 ? "" : "disabled"; $error = strlen($error) < 1 ? "Your Information has been validated, choose \"Confirm\" to register." : $error; echo "<div class='lmaindiv' name='regdiv' id='regdiv'>\n"; echo " <input type=hidden name='question' id='question' value=\"{$question}\">\n"; echo " <input type=hidden name='ru_nextact' id='ru_nextact' value=\"{$ru_nextact}\">\n"; echo " <table name='regtable' id='regtable' class='inputable' cellpadding=0 border=0 cellspacing=0>\n"; echo "\t<tr>\n"; echo "\t <td width=40%>\n"; echo "\t pick a username?: \n"; echo "\t </td>\n"; echo "\t <td width=60%>\n"; echo "\t <input type=text size=20 id=username name=username value=\"{$username}\" onblur=\"chkvars();\">\n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td width=40%>\n"; echo "\t What is your real name?: \n"; echo "\t </td>\n"; echo "\t <td width=60%>\n"; echo "\t <input type=text size=20 id=fullname name=fullname value=\"{$fullname}\" onblur=\"chkvars();\">\n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td>\n"; echo "\t Select a Password: \n"; echo "\t </td>\n"; echo "\t <td>\n"; echo " \t <input type=password name=password id=password value=\"{$password}\" size=20 onblur=\"chkvars();\">\n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td>\n"; echo "\t Verify your Password: \n"; echo "\t </td>\n"; echo "\t <td>\n"; echo " \t <input type=password name=passchk id=passchk value=\"{$passchk}\" size=20 onblur=\"chkvars();\">\n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td>\n"; echo "\t Enter your E-Mail address:\n"; echo "\t </td>\n"; echo "\t <td>\n"; echo " \t <input type=email name=email id=email value=\"{$email}\" size=20 onblur=\"chkvars();\">\n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td>\n"; echo "\t Select a secret question:\n"; echo "\t </td>\n"; echo "\t <td>\n"; selquestion($question); echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td>\n"; echo "\t Enter the answer to your qustion:\n"; echo "\t </td>\n"; echo "\t <td>\n"; echo " <input type=text size=20 name=answer id=answer value=\"{$answer}\" onblur=\"chkvars();\">\n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td colspan=2>\n"; echo "\t <input type=button name=vbtn value=\"Verify\" onclick=\"javascript:document.forms[0].ru_nextact.value='verify';go('pages/login/reguser.php')\" disabled>   \n"; echo "\t <input type=button name=cbtn value=\"Confirm\" onclick=\"javascript:document.forms[0].ru_nextact.value='confirm';go('pages/login/reguser.php');\" {$cbtn}> \n"; echo "\t <input type=button name=qbtn value=\"Quit\" onclick=\"go('login');\"> \n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t <td colspan=2 name=helpcell id=helpcell>\n"; if (strlen($error) > 0 && $error != "unknown") { echo $error; } echo "\t \n"; echo "\t </td>\n"; echo "\t</tr>\n"; echo " </table>\n"; echo "</div>\n"; echo "<script type='text/javascript'>\n"; echo " function setval(tVal){\n"; echo " document.forms[0].question.value=tVal;\n"; echo " document.forms[0].answer.focus();\n"; echo " document.forms[0].answer.select();\n"; echo " }\n"; echo " function chkvars(){\n"; echo " objX = document.forms[0];\n"; echo " var vFilled = '';\n"; echo " vFilled = (objX.username.value == '') ? vFilled+' Enter UserName ' : vFilled;\n"; echo " vFilled = (objX.fullname.value == '') ? vFilled+' Enter real Name ' : vFilled;\n"; echo " vFilled = (objX.password.value == '') ? vFilled+' Enter Password ' : vFilled;\n"; echo " vFilled = (objX.passchk.value == '') ? vFilled+' Verify Password ' : vFilled;\n"; echo " vFilled = (objX.email.value == '') ? vFilled+' Enter your E-Mail ' : vFilled;\n"; echo " vFilled = (objX.email.value.indexOf('@') < 0) ? vFilled+' E-Mail must contain an \"@\" ' : vFilled;\n"; echo " vFilled = (objX.email.value.indexOf('.') < 0) ? vFilled+' E-Mail must contain a \".\" ' : vFilled;\n"; echo " vFilled = (objX.answer.value == '') ? vFilled+' Enter your secret Answer ' : vFilled;\n"; echo " vFilled = (objX.password.value != objX.passchk.value) ? vFilled+' Passwords do not match ' : vFilled;\n"; echo " if( vFilled == '' ){objX.vbtn.disabled=false;}else{objX.vbtn.disabled=true;}\n"; echo " document.getElementById('helpcell').innerHTML=vFilled;\n"; echo " }\n"; echo "</script>\n"; setfocus("username"); }
function askuser($shandle, $username, $email, $question, $answer) { $sqlwho = strlen($username) > 0 ? "username=\"{$username}\"" : "email=\"{$email}\""; if (strlen($question < 1)) { $sql = "select fullname,question from accounts where {$sqlwho} limit 1"; echo "<!-- sql [{$sql}] -->\n"; $sresult = mysql_query($sql, $shandle) or die("Cannot connect to accounts"); $sdata = mysql_fetch_array($sresult); $fullname = $sdata["fullname"]; $question = $sdata["question"]; } if (strlen($question) < 1) { echo "<script type='text/javascript'>\n"; echo " document.forms[0].sp_nextact.value='retry';\n"; echo " go('pages/login/sendpass.inc');\n"; echo "</script>\n"; } else { echo "<div name='passdiv' id='passdiv' class='lmaindiv'>\n"; echo " <input type=hidden name='username' id='username' value=\"{$username}\">\n"; echo " <table cellpadding=0 cellspacing=0 border=0 class='ntable'>\n"; echo " <tr><td colspan=2>Lost Password recovery:</td></tr>\n"; echo " <tr><td colspan=2>Hello {$fullname}, please answer the following question:</td></tr>\n"; echo " <tr><td>{$question}?</td>\n"; echo " <td><input type=text size=20 name='answer' id='answer' value=\"{$answer}\" onchange=\"checkvars();\"></td></tr>\n"; echo " <tr><td colspan=2><input type=button name='vbtn' id='vbtn' value=\"Next ->\" onclick=\"javascript:document.forms[0].sp_nextact.value='answered';go('pages/login/sendpass.inc');\" disabled> \n"; echo " <input type=button name=qbtn id=qbtn value=\"Quit\" onclick=\"go('login');\"></td></tr>\n"; echo " </table>\n"; echo "</div>\n"; setfocus("answer"); echo "<script type='text/javascript'>\n"; echo " function checkvars(){\n"; echo " xBtn = document.forms[0].vbtn;\n"; echo " vAnswer = ( document.forms[0].answer.value == '' ) ? 'false' : 'true';\n"; echo " if( vAnswer == 'true' ){xBtn.disabled=false;}else{xBtn.disabled=true;}\n"; echo " }\n"; echo "</script>\n"; } }
function editstyle($stylearray, $name) { $name = $name == "" ? getvardata("name", "", 99) : $name; $acton = getvardata("acton", "unknown", 99); $statusmessage = ""; //echo "<!-- acton [$acton] -->\n"; //echo "<!-- edit style with [$name]:";print_r($stylearray);echo "-->\n"; $section = $stylearray["section"]; $type = $stylearray["type"]; $source = $stylearray["source"]; unset($stylearray["section"]); unset($stylearray["type"]); unset($stylearray["source"]); $source = $source == "" ? $_SESSION["activetheme"] : $source; $section = $section == "" ? $_SESSION["activesection"] : $section; $type = $type == "" ? "class" : $type; //echo "<!-- edit style with [$name][$section][$type][$source]:";print_r($stylearray);echo "-->\n"; // set up $_POST["css_parts"] and $_POST["css_values"] from stylearray $css_index = 1; if (!isset($_POST["css_parts"])) { foreach ($stylearray as $this_place => $props) { $tname = $props["name"]; $tvalue = $props["value"]; $_POST["css_parts"][$css_index] = $tname; $_POST["css_values"][$css_index++] = $tvalue; } } //echo "<!-- display [css_parts]:";print_r($_POST["css_parts"]);echo "-->\n"; //echo "<!-- display [css_values]:";print_r($_POST["css_values"]);echo "-->\n"; $new_place = 1; // acton == 1 when we're gonna add a new property switch ($acton) { case "1": $new_place = count($stylearray); $new_place++; $_POST["css_parts"][$new_place] = ""; $_POST["css_value"][$new_place] = ""; break; case "2": // update the mysql table $statusmessage = updatestyles($name, $section, $type, $source); break; } $name = showgoodname($name); $stylename = $type == "class" ? ".{$name}" : "#{$name}"; $section = $section == "" ? "default" : $section; $nameline = $name == "" ? "<td>style Name?</td><td><input type='text' name='name' id='name' value=\"\"></td>" : "<td colspan=2>{$stylename}</td>"; echo "<table>\n"; echo "\t<tr><td>theme:{$source}</td><td>section:{$section}</td></tr>\n"; echo "\t<tr>{$nameline}</td></tr>\n"; if (isset($_POST["css_parts"]) and count($_POST["css_parts"]) > 0) { $index = 0; $focuson = "unknown"; foreach ($_POST["css_parts"] as $this_part => $this_name) { $this_value = isset($_POST["css_values"][$this_part]) ? $_POST["css_values"][$this_part] : ""; $showpicker = strpos($this_name, "color") > -1 ? "picker" : "static"; echo "<tr>\n"; echo "<td colspan=2><input type='text' name=css_parts[] id=\"x{$this_part}\" value=\"{$this_name}\"></td>\n"; echo "<td colspan=2><input type='text' class=\"{$showpicker}\" name=css_values[] id=\"y{$this_part}\" value=\"{$this_value}\"></td>\n"; echo "</tr>\n"; $focuson = $focuson == "unknown" ? "x{$this_part}" : $focuson; } } else { echo "<td><input type='text' name=css_parts[] id=css_parts[] value=\"\"></td>\n"; echo "<td><input type='text' name=css_values[] id=css_values[] value=\"\"></td>\n"; $focuson = "name"; } echo "<tr>\n"; echo "<td><input type=button name='abtn' id='abtn' value='Add New' onclick=\"nextaction('1');\"></td>\n"; echo "<td><input type=button name='sbtn' id='sbtn' value='Update' onclick=\"nextaction('2');\"></td>\n"; echo "<td><input type=button name='qbtn' id='qbtn' value='Quit' onclick=\"oops();\"></td>\n"; echo "</tr>\n"; echo "<tr><td colspan=2><hr/></td></tr>\n"; echo "<tr><td colspan=2>{$statusmessage}</td></tr>\n"; echo "</table>\n"; setfocus($focuson); }