Jump to content

okrobie

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

About okrobie

  • Birthday 04/09/1942

Profile Information

  • Gender
    Male
  • Location
    Jacksonville FL

okrobie's Achievements

Member

Member (2/5)

0

Reputation

  1. Why mess with perfection? Thanks a million.
  2. Thanks cyberRoot, those both sound like good approaches, but I'm a novice and don't know how to do either one. Can you please give me a few clues? Thanks
  3. Hi cyberRobot and Drongo_III, thanks for the replies. cyberRobot: I added the id="current"statement to the menu item number 6 and you can see what it does. Meanwhile the "current page" function seems to be working because it does point to the correct page but without any formatting. Drongo_III: editing or removing that line does not affect the menu item for the current page, but it does change the Hover characteristics. There are no typeface characteristics in that line so I'm guessing the font is a default value. I tried putting typeface parameters in the line but there was no effect. Here is a link to the site so you can both see what is going on. http://jacquesghazirhaddad.org/ Thanks again. I appreciate your help.
  4. Hello, I got this basic code from a website and it is supposed to highlight the current page on the menu, which it does very well. The problem is that I cannot stylize the font, color or size of the type in the current page menu display. No matter what I do, it always stays as the default font. The other buttons on the menu can be stylized but not the current page. Is there a way to do this? ## SNIPPET 1 - THE PHP ## // To be saved in the 'includes' directory as "nav_include.php" <?php $menu=file_get_contents("includes/menu.html"); // get the navigation list of pages $base=basename($_SERVER['PHP_SELF']); // get the current page $menu=preg_replace("|<li><a href=\"".$base."\">(.*)</a></li>|U", "<li id=\"current\">$1</li>", $menu); // add an id of 'active' to the link and id of class to the list item for the current page echo $menu; // echo the HTML list with the current page highlighted ?> ## SNIPPET 2 - THE HTML LIST ## To be saved as menu.html <ul id="navlist"> <li><a href="index.php">Home</a></li> <li><a href="products.php">Products</a></li> <li><a href="services.php">Services</a></li> <li><a href="about.php">About Us</a></li> <li><a href="contact.php">Contact Us</a></li> </ul> ## CSS ## for the *.css file #navlist { margin: 0; padding: 30px 0 20px 10px; float: right; width: 60%; } #navlist ul, #navlist li { margin: 0; padding: 0; display: inline; list-style-type: none; } #navlist a:link, #navlist a:visited { float: left; line-height: 14px; font-weight: bold; margin: 0 10px 4px; text-decoration: none; color: #4F4F4F; width: auto; } /* link and visited link styles - the visited state can be styled separately if you wish */ #navlist a:link#current, #navlist a:visited#current, #navlist a:hover { border-bottom: 4px solid #66733f; padding-bottom: 2px; background: transparent; color: #4F4F4F; } /* this line's the style for the current page link */ #navlist a:hover { border-bottom: 4px solid #4F4F4F; color: #4F4F4F; } /* hover state for all the links */ ## TO DISPLAY ON THE PAGE ## <?php include("includes/nav_include.php"); ?>
  5. Hello isedeasy, thanks for your help. Sorry for the delay I have been at my day job. This code has a lot of extraneous garbage in it but I don't know what is important and what is not so I'll post the whole thing. <?php include 'dbc.php'; page_protect(); if(!checkAdmin()) { header("Location: login.php"); exit(); } $page_limit = 10; $host = $_SERVER['HTTP_HOST']; $host_upper = strtoupper($host); $login_path = @ereg_replace('adminsettings','',dirname($_SERVER['PHP_SELF'])); $path = rtrim($login_path, '/\\'); // filter GET values foreach($_GET as $key => $value) { $get[$key] = filter($value); } foreach($_POST as $key => $value) { $post[$key] = filter($value); } if($post['doBan'] == 'Ban') { if(!empty($_POST['u'])) { foreach ($_POST['u'] as $uid) { $id = filter($uid); mysql_query("update users set banned='1' where id='$id'"); } } $ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];; header("Location: $ret"); exit(); } if($_POST['doUnban'] == 'Unban') { if(!empty($_POST['u'])) { foreach ($_POST['u'] as $uid) { $id = filter($uid); mysql_query("update users set banned='0' where id='$id'"); } } $ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];; header("Location: $ret"); exit(); } if($_POST['doDelete'] == 'Delete') { if(!empty($_POST['u'])) { foreach ($_POST['u'] as $uid) { $id = filter($uid); mysql_query("delete from users where id='$id'"); } } $ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];; header("Location: $ret"); exit(); } if($_POST['doApprove'] == 'Approve') { if(!empty($_POST['u'])) { foreach ($_POST['u'] as $uid) { $id = filter($uid); mysql_query("update users set approved='1' where id='$id'"); list($to_email) = mysql_fetch_row(mysql_query("select user_email from users where id='$uid'")); $message = "Hello,\n Thank you for registering with the Holy Family Catholic School website. Your account has been activated...\n *****LOGIN LINK*****\n http://$host$path/login.php Thank You Administrator $host_upper ______________________________________________________ THIS IS AN AUTOMATED RESPONSE. ***DO NOT RESPOND TO THIS EMAIL**** "; @mail($to_email, "HFCS User Activation", $message, "From: \"HFCS Website Registration\" <auto-reply@$host>") ; } } $ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str']; header("Location: $ret"); exit(); } $rs_all = mysql_query("select count(*) as total_all from users") or die(mysql_error()); $rs_active = mysql_query("select count(*) as total_active from users where approved='1'") or die(mysql_error()); $rs_total_pending = mysql_query("select count(*) as tot from users where approved='0'"); list($total_pending) = mysql_fetch_row($rs_total_pending); list($all) = mysql_fetch_row($rs_all); list($active) = mysql_fetch_row($rs_active); ?> <html> <head> <title>Admin Control Panel</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="style2.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script> </head> <body> <div id="container"> <table width="100%" border="0" cellpadding="5" cellspacing="0" class="myaccount"> <tr> <td>Total users: <?php echo $all;?></td> <td>Active users: <?php echo $active; ?></td> <td>Pending users: <?php echo $total_pending; ?></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="45" > <tr> <td width="14%" valign="top"><?php if (isset($_SESSION['user_id'])) ?> <td width="74%" valign="top" style="padding: 10px;"><h2><font color="#FF0000">Administration Page</font></h2> <!-- Begin Sidebar --> <div id="sidebar"> <ul> <li><a href="defaultusers.php">Home</a></li> <li><a href="email.php">Email all users</a></li> <li><a href="logout.php">Logout</a></li> </ul> </div> <!-- End Sidebar --> <p><?php if(!empty($msg)) { echo $msg[0]; } ?></p> <table width="80%" border="0" align="center" cellpadding="10" cellspacing="0" style="background-image: url('images/mission background.jpg'); background-color: #FFCC00;padding: 2px 5px;border: 1px solid #CAE4FF;" > <tr> <td><form name="form1" method="get" action="adminsettings.php"> <p align="center">Search <input name="q" type="text" id="q" size="40"> <br> [Type email or user name] </p> <p align="center"> <input type="radio" name="qoption" value="pending"> Pending users <input type="radio" name="qoption" value="recent"> Recently registered <input type="radio" name="qoption" value="banned"> Banned users <br> <br> [You can leave search blank to if you use above options]</p> <p align="center"> <input name="doSearch" type="submit" id="doSearch2" value="Search"> </p> </form></td> </tr> </table> <p> <?php if ($get['doSearch'] == 'Search') { $cond = ''; if($get['qoption'] == 'pending') { $cond = "where `approved`='0' order by date desc"; } if($get['qoption'] == 'recent') { $cond = "order by date desc"; } if($get['qoption'] == 'banned') { $cond = "where `banned`='1' order by date desc"; } if($get['q'] == '') { $sql = "select * from users $cond"; } else { $sql = "select * from users where `user_email` = '$_REQUEST[q]' or `user_name`='$_REQUEST[q]' "; } $rs_total = mysql_query($sql) or die(mysql_error()); $total = mysql_num_rows($rs_total); if (!isset($_GET['page']) ) { $start=0; } else { $start = ($_GET['page'] - 1) * $page_limit; } $rs_results = mysql_query($sql . " limit $start,$page_limit") or die(mysql_error()); $total_pages = ceil($total/$page_limit); ?> <p>Approve -> A notification email will be sent to user notifying activation.<br> Ban -> No notification email will be sent to the user. <p><strong>*Note: </strong>Once the user is banned, he/she will never be able to register new account with same email address. <p align="right"> <?php // outputting the pages if ($total > $page_limit) { echo "<div><strong>Pages:</strong> "; $i = 0; while ($i < $page_limit) { $page_no = $i+1; $qstr = ereg_replace("&page=[0-9]+","",$_SERVER['QUERY_STRING']); echo "<a href=\"adminsettings.php?$qstr&page=$page_no\">$page_no</a> "; $i++; } echo "</div>"; } ?> </p> <form name "searchform" action="adminsettings.php" method="post"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr bgcolor="#E6F3F9"> <td width="4%"><strong>ID</strong></td> <td width="10%"><strong>Date</strong></td> <td width="10%"><div align="center"><strong>First Name</strong></div></td> <td width="10%"><div align="center"><strong>Last Name</strong></div></td> <td width="10%"><div align="center"><strong>User Name</strong></div></td> <td width="25%"><strong>Email</strong></td> <td width="5%"><strong>Approval</strong></td> <td width="5%"> <strong>Banned</strong></td> <td width="15%"> </td> </tr> <tr> <td> </td> </tr> <?php while ($rrows = mysql_fetch_array($rs_results)) {?> <tr> <td><input name="u[]" type="checkbox" value="<?php echo $rrows['id']; ?>" id="u[]"></td> <td><?php echo $rrows['date']; ?></td> <td> <div align="center"><?php echo $rrows['first_name'];?></div></td> <td> <div align="center"><?php echo $rrows['last_name'];?></div></td> <td> <div align="center"><?php echo $rrows['user_name'];?></div></td> <td><?php echo $rrows['user_email']; ?></td> <td><span id="approve<? echo $rrows['id']; ?>"> <?php if(!$rrows['approved']) { echo "Pending"; } else {echo "Active"; }?></span> </td> <td><span id="ban<? echo $rrows['id']; ?>"> <?php if(!$rrows['banned']) { echo "no"; } else {echo "yes"; }?> </span> </td> <td> <font size="2"> <a href="javascript:void(0);" onclick='$.get("do.php",{ cmd: "approve", id: "<? echo $rrows['id']; ?>" } ,function(data){ $("#approve<? echo $rrows['id']; ?>").html(data); });'>Approve</a> <a href="javascript:void(0);" onclick='$.get("do.php",{ cmd: "ban", id: "<? echo $rrows['id']; ?>" } ,function(data){ $("#ban<? echo $rrows['id']; ?>").html(data); });'>Ban</a> <a href="javascript:void(0);" onclick='$.get("do.php",{ cmd: "unban", id: "<? echo $rrows['id']; ?>" } ,function(data){ $("#ban<? echo $rrows['id']; ?>").html(data); });'>Unban</a> <a href="javascript:void(0);" onclick='$("#edit<?php echo $rrows['id'];?>").show("slow");'>Edit</a> </font> </td> </tr> <tr> <td colspan="7"> <div style="display:none;font: normal 11px arial; padding:10px; background: #e6f3f9" id="edit<?php echo $rrows['id']; ?>"> <form name="edit<?php echo $rrows['id']; ?>" action="" method="get"> <input type="hidden" name="id<?php echo $rrows['id']; ?>" id="id<?php echo $rrows['id']; ?>" value="<?php echo $rrows['id']; ?>"><br> First Name: <input name="first_name<?php echo $rrows['id']; ?>" id="first_name<?php echo $rrows['id']; ?>" type="text" size="10" value="<?php echo $rrows['first_name']; ?>" > Last Name: <input name="last_name<?php echo $rrows['id']; ?>" id="last_name<?php echo $rrows['id']; ?>" type="text" size="10" value="<?php echo $rrows['last_name']; ?>" > User Name: <input name="user_name<?php echo $rrows['id']; ?>" id="user_name<?php echo $rrows['id']; ?>" type="text" size="10" value="<?php echo $rrows['user_name']; ?>" > <br><br> User Email:<input id="user_email<?php echo $rrows['id']; ?>" name="user_email<?php echo $rrows['id']; ?>" type="text" size="30" value="<?php echo $rrows['user_email']; ?>" > Level: <input id="user_level<?php echo $rrows['id']; ?>" name="user_level<?php echo $rrows['id']; ?>" type="text" size="5" value="<?php echo $rrows['user_level']; ?>" > 1->Parent,2->Teacher,5->Admin <br><br> New Password: <input id="pass<?php echo $rrows['id']; ?>" name="pass<?php echo $rrows['id']; ?>" type="text" size="20" value="" > (leave blank) <!--Teacher<span class="example"></span><br> <textarea name="teacher" cols="80" rows="5" id="teacher"><? echo $row_settings['teacher']; ?></textarea> --> <!--Teacher: <input name="teacher<?php echo $rrows['id']; ?>" id="teacher<?php echo $rrows['id']; ?>" type="text" size="10" value="<?php echo $rrows['teacher']; ?>" >--> <br>Teacher:<textarea name="teacher<?php echo $rrows['id']; ?>" id="teacher<?php echo $rrows['id']; ?>" rows="5" cols="80"><?php echo $rrows['teacher']; ?></textarea> <!--Teacher:<br> <textarea name="teacher<?php echo $rrows['id']; ?>" id="teacher<?php echo $rrows['id']; ?>" cols="80" rows="5" > </textarea><br><br>--> Homework: <br> <textarea name="homework<?php echo $rrows['id']; ?>" cols="80" rows="5" id="homework<?php echo $rrows['id']; ?>"> </textarea><br><br> Projects: <br> <textarea name="projects<?php echo $rrows['id']; ?>" cols="80" rows="5" id="projects"> <?php echo $rrows['projects']; ?> </textarea><br><br> Schedules:<br> <textarea name="schedules<?php echo $rrows['id']; ?>" cols="80" rows="5" id="schedules"> <?php echo $rrows['schedules']; ?> </textarea><br><br> News & Information:<br> <textarea name="news<?php echo $rrows['id']; ?>" cols="80" rows="5" id="news"> <?php echo $rrows['news']; ?> </textarea><br> <br><br> <input name="doSave" type="button" id="doSave" value="Save" onclick='$.get("do.php",{ cmd: "edit", pass:$("input#pass<?php echo $rrows['id']; ?>").val(),first_name:$("input#first_name<?php echo $rrows['id']; ?>").val(),last_name:$("input#last_name<?php echo $rrows['id']; ?>").val(),user_level:$("input#user_level<?php echo $rrows['id']; ?>").val(),user_name:$("input#user_name<?php echo $rrows['id']; ?>").val(),teacher:$("input#teacher<?php echo $rrows['id']; ?>").val(),user_email:$("input#user_email<?php echo $rrows['id']; ?>").val(),homework:$("input#homework<?php echo $rrows['id']; ?>").val(),projects:$("input#projects<?php echo $rrows['id']; ?>").val(),schedules:$("input#schedules<?php echo $rrows['id']; ?>").val(),news:$("input#news<?php echo $rrows['id']; ?>").val(),id:$("input#id<?php echo $rrows['id']; ?>").val() } ,function(data){ $("#msg<?php echo $rrows['id']; ?>").html(data); });'> <a onclick='$("#edit<?php echo $rrows['id'];?>").hide();' href="javascript:void(0);">close</a> </form> <div style="color:red" id="msg<?php echo $rrows['id']; ?>" name="msg<?php echo $rrows['id']; ?>"></div> </div> </td> </tr> <?php } ?> </table> <p><br> <input name="doApprove" type="submit" id="doApprove" value="Approve"> <input name="doBan" type="submit" id="doBan" value="Ban"> <input name="doUnban" type="submit" id="doUnban" value="Unban"> <input name="doDelete" type="submit" id="doDelete" value="Delete"> <input name="query_str" type="hidden" id="query_str" value="<?php echo $_SERVER['QUERY_STRING']; ?>"> <strong>Note:</strong> If you delete the user, they can register again. Instead, ban the user. </p> </form> <?php } ?> <p> </p> <?php if($_POST['doSubmit'] == 'Create') { $rs_dup = mysql_query("select count(*) as total from users where user_name='$post[user_name]' OR user_email='$post[user_email]'") or die(mysql_error()); list($dups) = mysql_fetch_row($rs_dup); if($dups > 0) { die("The user name or email already exists in the system"); } if(!empty($_POST['pwd'])) { $pwd = $post['pwd']; $hash = PwdHash($post['pwd']); } else { $pwd = GenPwd(); $hash = PwdHash($pwd); } mysql_query("INSERT INTO users (`first_name`,`last_name`,`user_name`,`user_email`,`pwd`,`approved`,`date`,`user_level`,`homework`,`projects`,`schedules`,`news`) VALUES ('$post[first_name]','$post[last_name]','$post[teacher]','$post[user_email]','$hash','1',now(),'$post[user_level]','$post[homework]','$post[projects]','$post[schedules]','$post[news]') ") or die(mysql_error()); $message = "Thank you for registering with Holy Family Catholic School Website. Here are your login details...\n User Email: $post[user_email] \n Passwd: $pwd \n *****LOGIN LINK*****\n http://$host$path/login.php Thank You Administrator $host_upper ______________________________________________________ THIS IS AN AUTOMATED RESPONSE. ***DO NOT RESPOND TO THIS EMAIL**** "; if($_POST['send'] == '1') { mail($post['user_email'], "HFCS Login Details", $message, "From: \"HFCS Website Registration\" <auto-reply@$host>"); } echo "<div class=\"msg\">User created with password $pwd....done.</div>"; } ?> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="12%"> </td> </tr> </table> </div> </body> </html>
  6. Thanks pbs, but my problem goes deeper than that. Thanks isedeasy, that looks like it should work but it doesn't retrieve the data from the database and displays "undefined" instead. It also won't allow me to edit or save from that textbox. Please see if you can see what is wrong. Thanks again, okrobie
  7. Hello, this line retrieves information from the database and allows me to edit it and save it and it works great so far. But now I need it to be a textarea. I tried a straight conversion but it replaced the database data with, "value=undefined". I read somewhere that "value" is not allowed in a textarea. Can someone please help me? Thanks, okrobie Teacher: <input name="teacher<?php echo $rrows['id']; ?>" id="teacher<?php echo $rrows['id']; ?>" type="text" size="10" value="<?php echo $rrows['teacher']; ?>" >
  8. I got it. I changed the ending single quote to a double quote and moved the ending </h3> { echo "<h3>Teachers Name: <p>" . $row["first_name"] . " " . $row["last_name"]."</p></h3>" ; } Thanks for all the help.
  9. Thanks wildteen88, that is correct but I'm still getting the unexpected $end error. I removed the whole line and the rest of the page displayed correctly without an error.
  10. thanks onlyican, that looks like it should work, but I'm getting a "unexpected $end" syntax error. Am I missing something? (I did put a bracket in front of it)
  11. Thanks onlyican. I took away the <h3> and it now displays in one line, but it is in default font. Now how do I get it to display in <h3> style font?
  12. How to get this echo line to display as one line? No matter what I have done it displays as two lines. I even tried <nobr></nobr> Teachers Name: John Jones $userid = mysql_real_escape_string($_GET['user_id']); $sql = "select * from users where `id`='$userid' "; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { echo "<h3>Teachers Name: </h3>" . $row["first_name"] . " " . $row["last_name"] ; } Thanks for your help.
  13. Someone from another board directed me to HTML Sanitizer http://www.phpclasses.org/package/3746-PHP-Remove-unsafe-tags-and-attributes-from-HTML-code.html It does exactly what I wanted and is easy to install. Thanks for all the help on this board. It is appreciated.
  14. Thanks for your comments dj Kat, When I use HTML in the textarea, then click save, the textarea seems to strip out the HTML and save only the text like the example I showed above. When I use BB code it saves the whole link literally but when displayed it is not a link. I have looked up all the Google references to mysql_real_escape_string() but I don't understand how the examples relate to my problem. (I'm a novice) I hate to impose but I could sure use an example that relates to a textarea. Thanks again for the support.
  15. Thanks kenrbnsn, I'm hoping to allow users to enter the HTML (mostly Hyperlinks) via a text area. How would that work? Is it possible?
×
×
  • 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.