Hydrian Posted August 29, 2012 Share Posted August 29, 2012 I have chat and a loginsystem i want know how to change the color of the users, so i can make like Admin, and Moderators. Im not sure which code you would need. My login page or my index page so here are both <?php session_start(); include_once"loginsystem/config.php"; if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){ echo 'you are not logged in.'; }else { echo 'You are logged in'; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta name="google-site-verification" content="V-MlKGWPoAzJ_-vfEsEZFg92geK_hsIr53hVfcy8ydg" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>TestChat Page</title> <link rel="stylesheet" href="style.css" type="text/css" /> <link rel="stylesheet" href="ol.css" type="text/css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="chat.js"></script> <script type="text/javascript"> // ask user for name with popup prompt var name = <?php echo json_encode((string)$_SESSION['username']); ?>; // default name is 'Username' if (!name || name === ' ') { name = <?php echo json_encode((string)$_SESSION['username']); ?>; } // strip tags name = name.replace(/(<([^>]+)>)/ig,""); // display name on page $("#name-area").html("You are: <span>" + name + "</span>"); // kick off chat var chat = new Chat(); $(function() { chat.getState(); // watch textarea for key presses $("#sendie").keydown(function(event) { var key = event.which; //all keys including return. if (key >= 33) { var maxLength = $(this).attr("maxlength"); var length = this.value.length; // don't allow new content if length is maxed out if (length >= maxLength) { event.preventDefault(); } } }); // watch textarea for release of key press $('#sendie').keyup(function(e) { if (e.keyCode == 13) { var text = $(this).val(); var maxLength = $(this).attr("maxlength"); var length = text.length; // send if (length <= maxLength + 1) { chat.send(text, name); $(this).val(""); } else { $(this).val(text.substring(0, maxLength)); } } }); }); </script> <meta name="Generator" content="Serif WebPlus X6 (14.0.0.020)"> <meta name="vieort" content="width=1000"> <link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <style type="text/css"> body{ padding:20px; color:FFFFFF; font-size:14px; background-color:#454545; font-family:Arial, Helvetica, sans-serif;} h2 {font-weight:bold; color:#000099; margin:10px 0px; } p span {color:#006600; font-weight:bold; } a, a:link, a:visited {color:#FFFFFF;} textarea {width: 100%; margin: 10px 0 15px 0; font-size: 13px; font-family: Consolas,monospace;} textarea.html {height: 300px;} p {margin: 0 0 10px 0;} code, pre {font-family: Consolas,monospace; color: green;} ol li {margin: 0 0 15px 0;} </style> </head> <body onload="setInterval('chat.update()', 1000)"> <br><br><br> <?php if ($_SESSION){ ?> <div id="page-wrap"> <p id="name-area"></p> <div id="chat-wrap"><div id="chat-area"></div></div> <form id="send-message-area"> <p><font size="5">Message: </font></p> <textarea id="sendie" maxlength = '225' ></textarea> </form> </div> <?php } ?> <br><br> </body> </html> <? session_start(); include_once"config.php"; if(isset($_POST['login'])){ $username= trim($_POST['username']); $password = trim($_POST['password']); if($username == NULL OR $password == NULL){ $final_report.="Please complete all the fields below.."; }else{ $check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error()); if(mysql_num_rows($check_user_data) == 0){ $final_report.="This username does not exist.."; }else{ $get_user_data = mysql_fetch_array($check_user_data); if($get_user_data['password'] == $password){ $start_idsess = $_SESSION['username'] = "".$get_user_data['username'].""; $start_passsess = $_SESSION['password'] = "".$get_user_data['password'].""; mysql_query ("UPDATE members SET logged_on = 1 WHERE username = '$username'") or die(mysql_error()); $final_report.="You are about to be logged in, please wait... <meta http-equiv='Refresh' content='2; URL=members.php'/>"; }}}} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="../php-tec/css/style.css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title></title> </head> <body><form action="" method="post"> <table width="312" align="center"> <? echo "<tr><td colspan='2'>".$final_report."</td></tr><tr>";?> <tr> <td width="120">Username:</td> <td width="180"><input type="text" name="username" size="30" maxlength="25"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" size="30" maxlength="25"></td> </tr> <tr> <td> </td> <td><input type="submit" name="login" value="Login" /></td> </tr> </table> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/267736-changing-a-color-of-a-certain-user/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.