Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. sure paste your code... I am not that good at Javascript but I could try to lend a hand in PHP
  2. As far as the two webpages needed to be open I would assume you would have to do this via some Javascript. The tickboxes is fairly simple... if(isset($_POST['tickbox'])) { //do something } else { //do something else }
  3. http://www.phpfreaks.com/tutorial/php-security http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/ http://www.sitepoint.com/article/php-security-blunders/
  4. Thanks! I will have to check it out... I have used the PHPExcel before to dump results from MySQL out to an excel spreadsheet so loading in an excel spreadsheet and modifying it via this script shouldn't be too hard to do. Thanks again!
  5. A set of books I would steer clear of are the For Dummies series though... they seem to not have a lot of useful information. Some of their series of books do but the Web Development series is not something to consider for your set of books. Check out Amazon.com for awesome sales on books. I have bought PHP books on there for a $1.
  6. www.tizag.com is a good site
  7. This is what they had on the website function getBase() { var baseTag = document.getElementsByTagName("base"); for(var i=0; i<baseTag.length; i++) { var baseId = baseTag[i].id; var baseHref = baseTag[i].href; alert("ID = "+ baseId +"\nhref = "+ baseHref); } } <body onload="getBase()">
  8. don't know if this will help but here ya go http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21050182.html
  9. I have a huge excel spreadsheet and a lot of rows are highlighted the same color (IE: red) I am wanting to go through and delete all of the rows that have the same background color... is there anyway of doing this? I have tried googling it and I can't find anything... everything i find is in VB (EW)
  10. i actually just added the premiso and it works! Thanks!
  11. yeah the file i am modifying is an include and the session_start(); is called in the main file...
  12. I am trying to pass a row id into the $_SESSION var and its not working... $session_id = $_SESSION[$row->post_id]; Is this possible?
  13. you could do another query that selects the owner name WHERE id = $id... not tested just quick thoughts
  14. well i couldn't get the mysql way to work so I used the PHP way and it worked fine... but i reckon both work just as great!
  15. sweet it worked! Thanks Neil! Also thanks premiso... i didn't know about the thing in mysql!
  16. I have a field in my DB that contains the current timestamp when an entry is posted into the DB... the timestamp shows like this currently, 2009-02-02 21:03:52... but how do i get it to show like this: 02/02/2009?
  17. I have a search field that has a preset value and I have a javascript onclick that erases that preset text but how do you reset the preset value once the user has clicked off of the search field?
  18. i think i have figured it all out fixed code: <?php require_once "includes/header.php"; ?> <?php if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $checklogin = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'")or die(mysql_error()); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_object($checklogin); $_SESSION['username'] = $username; $_SESSION['loggedin'] = 1; } } if(!empty($_SESSION['username'])) { require_once "switch.php"; } else { echo '<div class="in forms">'; echo '<form name="login" method="post" action="index.php">'; echo '<p><strong>Username</strong><br />'; echo '<input type="text" name="username" class="box" /></p>'; echo '<p><strong>Password</strong><br />'; echo '<input type="password" name="password" class="box" /></p>'; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="LOGIN" /></p>'; echo '</form>'; echo '</div>'; } ?> <?php require_once "includes/footer.php"; ?>
  19. well i got it working like this <?php session_start(); session_unset(); session_destroy(); ob_end_flush(); echo '<META http-equiv="refresh" content="0;URL=index.php">'; ?> but now when you click on a navigational item you get the login form index.php <?php require_once "includes/header.php"; ?> <?php if($_POST) { if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $checklogin = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'")or die(mysql_error()); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_object($checklogin); $_SESSION['username'] = $username; $_SESSION['loggedin'] = 1; } require "switch.php"; } } else { echo '<div class="in forms">'; echo '<form name="login" method="post" action="index.php">'; echo '<p><strong>Username</strong><br />'; echo '<input type="text" name="username" class="box" /></p>'; echo '<p><strong>Password</strong><br />'; echo '<input type="password" name="password" class="box" /></p>'; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="LOGIN" /></p>'; echo '</form>'; echo '</div>'; } ?> <?php require_once "includes/footer.php"; ?>
  20. i think i almost have it all figured out but when you click on the logout button you receive the following: Warning: Cannot modify header information - headers logout.php <?php session_start(); session_unset(); session_destroy(); ob_end_flush(); header("location: index.php"); ?>
  21. adjusted code a little bit more <?php require_once "includes/header.php"; ?> <?php if(!empty($_SESSION['loggedin'])) { if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $checklogin = mysql_query("SELECT * FROM users WHERE username = '".$username."' AND password = '".$password."'")or die(mysql_error()); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_object($checklogin); $_SESSION['username'] = $username; $_SESSION['loggedin'] = 1; } require "switch.php"; } } else { echo '<div class="in forms">'; echo '<form name="login" method="post" action="login.php">'; echo '<p><strong>Username</strong><br />'; echo '<input type="text" name="username" class="box" /></p>'; echo '<p><strong>Password</strong><br />'; echo '<input type="password" name="password" class="box" /></p>'; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="LOGIN" /></p>'; echo '</form>'; echo '</div>'; } ?> <?php require_once "includes/footer.php"; ?> Now when you click on a navigational item you only see the header and footer but no middle content... no "action" switch.php <?php switch($action) { case "write": echo '<div class="in forms">'; echo '<form id="form1" name="form1" method="post" action="index.php?action=create">'; echo '<p><strong>TITLE</strong><br />'; echo '<input type="text" name="title" class="box" /></p>'; echo '<p><strong>STORY</strong><br />'; echo '<textarea name="story" rows="5" cols="30" ></textarea></p> '; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="UPDATE" /></p>'; echo '</form>'; echo '</div>'; break; case "create": echo '<div class="in">'; echo '<p>This is a test</p>'; echo '</div>'; break; default: echo '<div class="in">'; echo '<p>This is a test</p>'; echo '</div>'; break; } ?>
  22. ok i have adjusted the code a little... everything is on one page <?php require_once "includes/header.php"; ?> <?php if(!empty($_SESSION)) { if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $checklogin = mysql_query("SELECT * FROM users WHERE username = '".$username."' AND password = '".$password."'")or die(mysql_error()); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_object($checklogin); $_SESSION['username'] = $username; $_SESSION['loggedin'] = 1; switch($action) { case "write": echo '<div class="in forms">'; echo '<form id="form1" name="form1" method="post" action="index.php?action=create">'; echo '<p><strong>TITLE</strong><br />'; echo '<input type="text" name="title" class="box" /></p>'; echo '<p><strong>STORY</strong><br />'; echo '<textarea name="story" rows="5" cols="30" ></textarea></p> '; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="UPDATE" /></p>'; echo '</form>'; echo '</div>'; break; case "create": echo '<div class="in">'; echo '<p>This is a test</p>'; echo '</div>'; break; default: echo '<div class="in">'; echo '<p>This is a test</p>'; echo '</div>'; break; } } } else { echo '<div class="in forms">'; echo '<form name="login" method="post" action="login.php">'; echo '<p><strong>Username</strong><br />'; echo '<input type="text" name="username" class="box" /></p>'; echo '<p><strong>Password</strong><br />'; echo '<input type="password" name="password" class="box" /></p>'; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="LOGIN" /></p>'; echo '</form>'; echo '</div>'; } } ?> <?php require_once "includes/footer.php"; ?> But when you click on one of the navigational items it displays the login form
  23. that isn't a "check" its just a div tag...the naming scheme for that individual page is bad on my part. not important to the script
  24. ok i know i have done these before... It was a really long weekend for me.. updated code: login.php <?php include "includes/loginheader.php"; include "includes/logincheck.php"; if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $checklogin = mysql_query("SELECT * FROM users WHERE username = '".$username."' AND password = '".$password."'")or die(mysql_error()); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_object($checklogin); $_SESSION['username'] = $username; $_SESSION['loggedin'] = 1; } } else { echo '<div class="in forms">'; echo '<form name="login" method="post" action="login.php">'; echo '<p><strong>Username</strong><br />'; echo '<input type="text" name="username" class="box" /></p>'; echo '<p><strong>Password</strong><br />'; echo '<input type="password" name="password" class="box" /></p>'; echo '<p><input name="submit" type="submit" id="submit" tabindex="5" class="com_btn" value="LOGIN" /></p>'; echo '</form>'; echo '</div>'; } include "includes/footer.php"; ?> loginheader.php <?php session_start(); ob_start(); include "includes/sql.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> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>DennisMonsewicz.com Admin</title> <link rel="stylesheet" type="text/css" href="main.css" /> <script type="text/javascript" src="includes/js/tinymce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,spellchecker,pagebreak,style,layer,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull, bullist,numlist,outdent,indent,blockquote,link,unlink,cleanup,help,code", theme_advanced_buttons2 : "", theme_advanced_buttons3: "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, }); </script> </head> <body> <div class="wrapper"> <h1 class="logo">DennisMonsewicz.com Admin</h1> <p class="txt_right">Logged in as <strong><?php echo $_SESSION['username']; ?> </strong> <span class="v_line"> | </span> <a href="#"> Logout</a></p> <!-- Navigation --> <div class="navigation"> <ul> <li><a href="index.php?action=write" <?php if($action == 'write') { ?> class="active" <?php } elseif($action == "create") { ?> class="active" <?php } ?>>WRITE</a></li> <li><a href="index.php?action=manage" <?php if($action == 'manage') { ?> class="active" <?php } ?>>MANAGE</a></li> <li><a href="index.php?action=settings" <?php if($action == 'settings') { ?> class="active" <?php } ?>>SETTINGS</a></li> </ul> </div> <div class="clear"></div> <div class="content"> header.php <?php session_start(); ob_start(); if(!empty($_SESSION['loggedin'])) { header("location: index.php"); } $action = $_GET['action']; include "includes/sql.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> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>DennisMonsewicz.com Admin</title> <link rel="stylesheet" type="text/css" href="main.css" /> <script type="text/javascript" src="includes/js/tinymce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,spellchecker,pagebreak,style,layer,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull, bullist,numlist,outdent,indent,blockquote,link,unlink,cleanup,help,code", theme_advanced_buttons2 : "", theme_advanced_buttons3: "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, }); </script> </head> <body> <div class="wrapper"> <h1 class="logo">DennisMonsewicz.com Admin</h1> <p class="txt_right">Logged in as <strong><?php echo $_SESSION['username']; ?> </strong> <span class="v_line"> | </span> <a href="#"> Logout</a></p> <!-- Navigation --> <div class="navigation"> <ul> <li><a href="index.php?action=write" <?php if($action == 'write') { ?> class="active" <?php } elseif($action == "create") { ?> class="active" <?php } ?>>WRITE</a></li> <li><a href="index.php?action=manage" <?php if($action == 'manage') { ?> class="active" <?php } ?>>MANAGE</a></li> <li><a href="index.php?action=settings" <?php if($action == 'settings') { ?> class="active" <?php } ?>>SETTINGS</a></li> </ul> </div> <div class="clear"></div> <div class="content"> I am getting the redirect loop problem when i login
  25. I get the login form... the included header on the login form is the same header that is being used throughout the site...
×
×
  • 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.