Jump to content

reffik024

Members
  • Posts

    3
  • Joined

  • Last visited

reffik024's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I wrote the following code to display messages from the database. Currently it produces a long list, I'm trying to figure out how to break this list up into two columns to shorten the length of the page. Any help is appreciated! $output .= "<div class=\"selector\">\n"; $output .= "<form method=\"post\">\n"; if ($type == "new") { $output .= "<input type=\"hidden\" name=\"type\" value=\"new\">\n"; $output .= getPhaseDD("phase", $phase) . " "; $output .= "Day:" . getDayDD($day) . " "; $output .= "Number:" . getNumDD($num) . " "; } else { $output .= "<input type=\"hidden\" name=\"type\" value=\"existing\">\n"; $output .= "<input type=\"hidden\" name=\"phase\" value=\"{$phase}\">\n"; $output .= "<input type=\"hidden\" name=\"day\" value=\"{$day}\">\n"; $output .= "<input type=\"hidden\" name=\"num\" value=\"{$num}\">\n"; $output .= "<div>Phase: {$phase}, Day: {$day}, Number: {$num}</div>"; } if ($type == "new") { $output .= "<div><textarea name=\"msg\" rows=\"8\" cols=\"50\" id=\"msg\" onkeyup=\"javascript:countTXT(this, 'cnt', 160);\" onkeydown=\"javascript:countTXT(this, 'cnt', 160);\">" . stripslashes($msg) . "</textarea></div>\n"; $output .= "<div id=\"cnt\"></div>\n"; } else { $output .= "<div><textarea name=\"msg\" id=\"msg_{$day}_{$num}\" onkeyup=\"javascript:countTXT(this, 'cnt_{$day}_{$num}', 160);\" onkeydown=\"javascript:countTXT(this, 'cnt_{$day}_{$num}', 160);\">" . stripslashes($msg) . "</textarea></div>\n"; $output .= "<div id=\"cnt_{$day}_{$num}\"></div>\n"; } $output .= "<div>\n"; if ($type == "new") { $output .= "<input type=\"submit\" name=\"create_btn\" value=\"Create\" class=\"create_btn\">\n"; } else { $output .= "<input type=\"submit\" name=\"update_btn\" value=\"Update\" class=\"update_btn\"> \n"; $output .= "<input type=\"submit\" name=\"delete_btn\" value=\"Delete\" class=\"delete_btn\" onclick=\"javascript:return confirmDelete();\">\n"; } $output .= "</div>\n"; $output .= "</form>\n"; $output .= "</div>\n"; if ($type == "new") { $output .= "<script type=\"text/javascript\">countTXT(document.getElementById('msg'), 'cnt', 160);</script>\n"; } else { $output .= "<script type=\"text/javascript\">countTXT(document.getElementById('msg_{$day}_{$num}'), 'cnt_{$day}_{$num}', 160);</script>\n"; } return $output;
  2. I tried putting full URL in header to no avail
  3. Hey all, new to PHPfreaks, seems like a very active site. Anyhow, I'm having an issue with this login script. It works just fine for me in chrome and safari, but in firefox and ie it does nothing, not even spit out an error. I'm not sure what's going wrong here, I'm thinking something with the header function. <?php session_start(); include 'dbcon.php'; $err = array(); foreach($_GET as $key => $value) { $get[$key] = filter($value); //get variables are filtered. } if ($_POST['doLogin']=='Login') { foreach($_POST as $key => $value) { $data[$key] = filter($value); // post variables are filtered } $user_email = $data['usr_email']; $pass = $data['pwd']; if (strpos($user_email,'@') === false) { $user_cond = "user_name='$user_email'"; } else { $user_cond = "user_email='$user_email'"; } $result = mysql_query("SELECT `id`,`pwd`,`full_name`,`approved`,`user_level` FROM adminusers WHERE $user_cond AND `banned` = '0' ") or die (mysql_error()); $num = mysql_num_rows($result); // Match row found with more than 1 results - the user is authenticated. if ( $num > 0 ) { list($id,$pwd,$full_name,$approved,$user_level) = mysql_fetch_row($result); if(!$approved) { //$msg = urlencode("Account not activated. Please check your email for activation code"); $err[] = "Account not activated."; //header("Location: login.php?msg=$msg"); //exit(); } //check against salt if ($pwd === PwdHash($pass,substr($pwd,0,9))) { if(empty($err)){ // this sets session and logs user in session_start(); session_regenerate_id (true); //prevent against session fixation attacks. // this sets variables in the session $_SESSION['user_id']= $id; $_SESSION['user_name'] = $full_name; $_SESSION['user_level'] = $user_level; $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); //update the timestamp and key for cookie $stamp = time(); $ckey = GenKey(); mysql_query("update adminusers set `ctime`='$stamp', `ckey` = '$ckey' where id='$id'") or die(mysql_error()); //set a cookie if(isset($_POST['remember'])){ setcookie("user_id", $_SESSION['user_id'], time()+60*60*24*COOKIE_TIME_OUT, "/"); setcookie("user_key", sha1($ckey), time()+60*60*24*COOKIE_TIME_OUT, "/"); setcookie("user_name",$_SESSION['user_name'], time()+60*60*24*COOKIE_TIME_OUT, "/"); } header("Location: ../index.php"); exit (); } } else { //$msg = urlencode("Invalid Login. Please try again with correct user email and password. "); $err[] = "Invalid Login. Please try again with correct user email and password."; //header("Location: login.php?msg=$msg"); } } else { $err[] = "Error - Invalid login. No such user exists"; } } ?> <script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script language="JavaScript" type="text/javascript" src="js/jquery.validate.js"></script> <script> $(document).ready(function(){ $("#logForm").validate(); }); </script>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.