Jump to content

matrixx1

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

matrixx1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. PROBLEM SOLVED....I feel like an idiot....was entering the wrong password
  2. CORRECTION!! This is the userlogon page: <?php $link = mysql_connect('localhost:/tmp/mysql5.sock', 'db_user', 'db_pw'); if (!$link) { die('Could not connect: ' . mysql_error()); } //mysql_close($link); if (!mysql_select_db('db_name', $link)) { echo 'Could not select database'; exit; } $username = $HTTP_POST_VARS["username"]; $password = $HTTP_POST_VARS["password"]; $member_id = ''; $role = ''; $firstname = ''; // Formulate Query // This is the best way to perform a SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT users.member_id, users.username, users.password, users.role, members.firstname FROM users join members on users.member_id = members.member_id WHERE users.username ='%s' AND users.password='%s'", mysql_real_escape_string($username), mysql_real_escape_string($password)); // Perform Query $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { $member_id = $row['member_id']; $username = $row['username']; $firstname = $row['firstname']; $role = $row['role']; } if ($member_id != ''){ session_start(); $_SESSION['membername'] = $username; $_SESSION['username'] = $username; $_SESSION['firstname'] = $firstname; $_SESSION['memberid'] = $member_id; $_SESSION['role'] = $role; print "<META HTTP-EQUIV='Refresh' content='0;URL=members.php'>"; } else { print "<META HTTP-EQUIV='Refresh' content='0;URL=memberlogon.php'>"; } // Free the resources associated with the result set // This is done automatically at the end of the script mysql_free_result($result); ?>
  3. I have a site with a members area that uses sessions. I migrated my DB from MySQL 4 to 5. Now my login page does not work. Please help. Member Login Page: <?php session_name ('name'); ini_set ('session.use_cookies', 0); session_start(); ?><!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> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/swfobject/swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; flashvars.xml = "config.xml"; flashvars.font = "font.swf"; var attributes = {}; attributes.wmode = "transparent"; attributes.id = "slider"; swfobject.embedSWF("cu3er.swf", "cu3er-container", "960", "400", "9", "expressInstall.swf", flashvars, attributes); </script> <link href="css/menu.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #apDiv1 { position:absolute; left:592px; top:75px; width:552px; height:53px; z-index:1; } a:visited { color: #5D4580; } a:hover { color: #FFF; } a:active { color: #5D4580; } </style> </head> <body> <div class="main"> <div class="blok_header"> <div class="header"> <div class="rss"><strong>P</strong></div> <div class="clr"></div> <div class="logo"><a href="index.html"><img src="images/logo.jpg" width="211" height="88" border="0" alt="" class="one" /></a></div> <div class="menu"> <ul id="css3menu"> <li class="topfirst"><a href="index.html" title="Home">Home</a></li> <li><a href="#" title=""><span>Omega Psi Phi</span></a> <ul> <li><a href="founders.html" title="Fraternity Founders">Fraternity Founders</a></li> <li><a href="omegahistory.html" title="Fraternity History">Fraternity History</a></li> <li><a href="programs.html" title="Mandated Programs">Mandated Programs</a></li> <li><a href="links.html" title="Links">Links</a></li> </ul> </li> <li><a href="#" title="Phi Gamma Chapter"><span>Phi Gamma Chapter</span></a> <ul> <li><a href="history.html" title="Phi Gamma History">Phi Gamma History</a></li> <li><a href="lineage.html" title="Phi Gamma Lineage">Phi Gamma Lineage</a></li> <li><a href="dedication.html" title="Dedication">Dedication</a></li> <li><a href="calendar.html" title="Calendar">Calendar</a></li> <li><a href="photogallery.html" title="Photo Gallery">Photo Gallery</a></li> <li><a href="members/login.php" title="Member Login">Member Login</a></li> <li><a href="roster.html" title="Chapter Roster">Chapter Roster</a></li> </ul> </li> <li><a href="members/login.php" title="Member Login">Member Login</a></li> <li class="toplast"><a href="contact.html" title="Contact Info.">Contact Info.</a></li> </ul> </div> </div> <div class="clr"></div> <div class="body"> <div class="body_bg"> <h2>Member's Only </h2> <?php if ($_SESSION['membername'] != null) { // print "<META HTTP-EQUIV='Refresh' content='0;URL=updatemember.php'>"; echo "You are already logged in. Please wait to be redirected to the members page, or <a href=\"members.php\">click here</a> if you are not automatically redirected. User name for the session is ".$_SESSION['username'].", the member name is ".$_SESSION['membername']; print "<META HTTP-EQUIV='Refresh' content='5;URL=members.php'>"; //header("Location: members.php"); //exit; } else { ?> <form name="admin" method="post" action="userlogon.php"> <table width="891" border="0" cellspacing="5" cellpadding="5"> <tr> <td height="80" colspan="2" align="left"><p>Please enter you username and password. Don't remember your password, <u><strong><a href="password.php">click here</a></strong></u><strong><a href="password.php"></a></strong>.</td> <td width="360" rowspan="5" align="center" valign="middle"><img src="images/login_image.jpg" width="239" height="314" /></td> </tr> <tr> <td width="257" height="38" align="right"><p><strong>Username:</strong></td> <td width="224" align="left"><input type="text" name="username"></td> </tr> <tr> <td height="38" align="right"><p><strong>Password:</strong></td> <td align="left"><input type="password" name="password"></td> </tr> <tr> <td height="34"> </td> <td align="left"><input type="submit" class="yellowbutton" name="submit" value="Sign In"></td> </tr> <tr> <td colspan="2"><p>To register for a username and password with Phi Gamma, please <u><strong><a href="register.php">click here</a></strong></u><strong><a href="password.php"></a></strong>.</td> </tr> </table> </form> <?php } ?> <p> </p> <div class="clr"></div> </div> <div class="clr"></div> </div> </div> <div class="footer"> <div class="footer_resize"> <p class="center"> <a href="index.html">Home</a> | <a href="contact.html">Contact</a> </p> <div class="clr"></div> </div> <div class="clr"></div> </div> </body> </html> After the credentials are entered the user is returned back to the login page and NOT the member's page. This is the userlogon.php page: <?php $link = mysql_connect('localhost:/tmp/mysql5.sock', 'dbuser', 'dbpw'); if (!$link) { die('Could not connect: ' . mysql_error()); } //mysql_close($link); if (!mysql_select_db('db_name', $link)) { echo 'Could not select database'; exit; } $username = $HTTP_POST_VARS["username"]; $password = $HTTP_POST_VARS["password"]; $member_id = ''; $role = ''; $firstname = ''; // Formulate Query // This is the best way to perform a SQL query // For more examples, see mysql_real_escape_string() $query = sprintf("SELECT users.member_id, users.username, users.password, users.role, FROM users join members on users.member_id = members.member_id WHERE users.username ='%s' AND users.password='%s'", mysql_real_escape_string($username), mysql_real_escape_string($password)); // Perform Query $result = mysql_query($query); // Check result // This shows the actual query sent to MySQL, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { $member_id = $row['member_id']; $username = $row['username']; $role = $row['role']; } if ($member_id != ''){ session_start(); $_SESSION['membername'] = $username; $_SESSION['username'] = $username; $_SESSION['memberid'] = $member_id; $_SESSION['role'] = $role; print "<META HTTP-EQUIV='Refresh' content='0;URL=members.php'>"; } else { print "<META HTTP-EQUIV='Refresh' content='0;URL=memberlogin.php'>"; } // Free the resources associated with the result set // This is done automatically at the end of the script mysql_free_result($result); ?> It worked fine before the migration??? Anyone know where the problem is?
  4. THANKS A MILLION!!!....works!!! One last thing...do you know how I can put a white border around the pic? Is that a css solution?
  5. I'm creating a funeral home site and on the side of the page I would like to display the last 5 funeral obituaries that are in mySQL database (name and certain sized image (images are in "image" field) w/ a link to an "obituaries detail page for the individual deceased person"). I am able to do this successfully listing only the names....how can I list the image associated with the name? This is what I have so far: <?php include("connect.php"); ?> <?php $query = "SELECT id, deceased_name, deceased_date, DATE_FORMAT(deceased_date, '%M %D, %Y') as datetext"; $query .= " FROM scales_obits ORDER BY deceased_date DESC LIMIT 5"; $listings = mysql_query($query); if (!listings) { echo("<p>Error retrieving listings from lookup table<br>". "Error: " . mysql_error()); exit(); } echo("<table border=\"0\" width=\"100%\" class=\"obit\">"); while ($listing = mysql_fetch_array($listings)) { $deceased_name = $listing["deceased_name"]; $deceased_date = $listing["datetext"]; $id = $listing["id"]; echo("<tr><td width=\"100%\"><a href=\"obitdetail.php?id=".$id."\"><strong>".$deceased_name."</strong></a></td><td> </td>"); } echo("</table>"); ?>
×
×
  • 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.