I tried reading some of the other topics regarding this and now feel like a complete dumbA =S so going to start from the beginning
Several years ago (2005 or so?) someone 'built' a simple mysql/php thingy for my RPG group, it worked fine up through php5.3 but recently I had to upgrade my site to php5.4 so the newest vB4.x.x installation would work. Problem is NOW our little 'member' section doesn't work. I tried reading up on the problem and it has something to do with session_register, and found I should use $_SESSION instead of session_register ; so i changed the session_register to $_SESSION - obviously I 'missed' something else, or this is way over my head =S
I have the directory 'protected' on my site so that you have to securely log-in via a system pop-up to reach 'mmbrs' directory where the following files (among others) exist.
What do I need to do to get the log-in etc to work? Any help would be greatly appreciated.
First authorized users after securely logging in via the system pop-up will be shown 'index.php'
<?php include "new-header.html"; ?>
<table
style="text-align: center; width: 366px; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="0">
<tbody><tr><td><b><big><big>Member Log-In</b></big></big></tr></td><br><br>
<td align="center" bgcolor="#c0b378" valign="top" width="577"><form name="form1" method="post" action="checklogin.php">
<strong>USERNAME</strong><br>
<input name="myusername" type="text" id="myusername">
<br>
<br>
<strong>PASSWORD</strong><br>
<input name="mypassword" type="password" id="mypassword">
<br>
<br>
<input type="submit" name="Submit" value="LOG IN">
<br>
<br>
NOT A MEMBER? <a href="register.php">REGISTER NOW</a>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<?php include "new-footer.html"; ?>
so once they put in their username and password (the one for the actual d/b) checklogin.php should 'run'
<?php
$host="localhost"; // Host name
$db_name="*****_********"; // Database name
$tbl_name="member"; // Table name
$username="******_*****"; // Mysql username
$password="************"; // Mysql password
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from signup form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql="SELECT * FROM $tbl_name WHERE member_un='$myusername' and member_pw='$mypassword'";
$result=mysql_query($sql);
$row=mysql_fetch_row($result);
$importantnumber=$row[0];
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION("myusername");
$_SESSION("mypassword");
$_SESSION("importantnumber");
header("location:member_profile.php");
}
else {
echo "Wrong Username or Password";
}
?>
*NOTE: login stopped working when upgraded to php5.4 on my host; there is no 'login_success.php' file, never has been =S now when you 'log in' it goes to a plain white page =S instead of member_profile.php once logged in it's supposed to redirect to member_profile.php
<?
session_start();
if ($_SESSION["authorized"] == true) {
header("location:index.php");
}
?>
<?php include('../Connections/SPARKYTIME.php'); ?>
<!-- <?php Print_r ($_SESSION); ?> -->
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$numero_USEROKAY = "-1";
if (isset($_SESSION["importantnumber"])) {
$numero_USEROKAY = $_SESSION["importantnumber"];
}
mysql_select_db($database_SPARKYTIME, $SPARKYTIME);
$query_USEROKAY = sprintf("SELECT * FROM member, user WHERE member_id = %s AND user_member_id = member_id", GetSQLValueString($numero_USEROKAY, "int"));
$USEROKAY = mysql_query($query_USEROKAY, $SPARKYTIME) or die(mysql_error());
$row_USEROKAY = mysql_fetch_assoc($USEROKAY);
$totalRows_USEROKAY = mysql_num_rows($USEROKAY);
?>
<?php include "new-header.html"; ?>
<table
style="text-align: left; width: 832px; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="0">
<tbody><tr><td></tr></td>
<tr>
<td class="sbar_on" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="member_profile.php">Member Profile</a></div>
<?php if ($totalRows_USEROKAY > 0) { // Show if recordset not empty ?><td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="edit_profile.php">Edit Profile</a></div>
<td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="edit_account.php">Edit Account</a></div>
<td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="view_characters.php">View Characters</a></div>
<td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="add_character.php">Add Character</a></div>
<td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="pet_create.php">Create Pet</a></div><?php } // Show if recordset not empty ?>
<?php if ($totalRows_USEROKAY == 0) { // Show if recordset not empty ?><td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="add_profile.php">Create Profile</a></div><?php } // Show if recordset not empty ?>
<td class="sbar_up" style="vertical-align: middle; text-align: center; font-weight: bold; width: 122px;"><a href="logout.php">Log Out</a></td>
</tr>
</tbody>
</table><br>
<a href="logout.php"></a>
<div class="ttxt" align="center">
<?php if ($totalRows_USEROKAY > 0) { // Show if recordset not empty ?><div class="ttxt" align="center"><br><strong>WELCOME, <?php echo strtoupper($row_USEROKAY['member_un']); ?>.</strong><br>
<br>
</div><center>
<table width="75%" border="0" cellspacing="0" cellpadding="3">
<tr bgcolor="#d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>MEMBER SINCE </strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo date("Y-m-d", $row_USEROKAY['member_created']); ?></td>
</tr>
<tr bgcolor="#d2ca9e">
<td width="20%" align="right" valign="top" nowrap class="ttxt"><strong>STATUS</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" class="ttxt"><?php if ($row_USEROKAY['member_stat'] == 0) echo "Pending";
if ($row_USEROKAY['member_stat'] == 1) echo "Active";
if ($row_USEROKAY['member_stat'] == 2) echo "InActive/Former"; ?></td>
</tr>
<tr bgcolor="#d8bd4e">
<td width="20%" align="right" valign="top" nowrap class="ttxt"><strong>LEVEL</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" class="ttxt"><?php
if ($row_USEROKAY['member_level'] == 0) echo "Pending";
if ($row_USEROKAY['member_level'] == 1) echo "Standard";
if ($row_USEROKAY['member_level'] == 2) echo "BoD Member";
if ($row_USEROKAY['member_level'] == 3) echo "Administrator"; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>USERNAME</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['member_un']; ?></td>
</tr>
<tr bgcolor="d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>FIRST NAME </strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo $row_USEROKAY['user_first']; ?></td>
</tr>
<tr bgcolor="#d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>MIDDLE NAME </strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo $row_USEROKAY['user_middle']; ?></td>
</tr>
<tr bgcolor="#d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>LAST NAME </strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo $row_USEROKAY['user_last']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>GENDER</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_gender']; ?></td>
</tr>
<tr bgcolor="#d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>BIRTHDATE</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo date("Y-m-d", $row_USEROKAY['user_birthdate']); ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>MALING ADDRESS</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_address1']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>STREET ADDRESS </strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_address2']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>CITY</strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_city']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>STATE/PROVINCE</strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_state']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>POSTAL CODE </strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_postal']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>COUNTRY</strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_country']; ?></td>
</tr>
<tr bgcolor="#d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>EMAIL</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo $row_USEROKAY['user_email']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>AIM</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_im']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>YAHOO IM ID </strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_yahooid']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>MSN MESSANGER </strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_msn']; ?></td>
</tr>
<tr bgcolor="d2ca9e">
<td align="right" valign="top" nowrap bgcolor="#d2ca9e" class="ttxt"><strong>OTHER IMs </strong></td><td width="5%"></td>
<td align="left" valign="top" bgcolor="#d2ca9e" class="ttxt"><?php echo $row_USEROKAY['user_oim']; ?></td>
</tr>
<tr bgcolor="d8bd4e">
<td width="20%" align="right" valign="top" nowrap bgcolor="#d8bd4e" class="ttxt"><strong>OTHER ***** CLUBS</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#d8bd4e" class="ttxt"><?php echo $row_USEROKAY['user_pclubs']; ?></td>
</tr>
<tr bgcolor="#BAAE85">
<td width="20%" align="right" valign="top" nowrap bgcolor="#BAAE85" class="ttxt"><strong>PROFILE CREATED</strong></td><td width="5%"></td>
<td width="75%" align="left" valign="top" bgcolor="#BAAE85" class="ttxt"><?php echo date("Y-m-d", $row_USEROKAY['user_created']); ?></td>
</tr>
<tr bgcolor="#BAAE85">
<td align="right" valign="top" nowrap class="ttxt"><strong>LAST MODIFIED</strong></td><td width="5%"></td>
<td align="left" valign="top" class="ttxt"><?php echo date("Y-m-d", $row_USEROKAY['user_modified']); ?></td>
<tr bgcolor="#d8bd4e">
<td align="right" valign="top" nowrap class="ttxt"><strong>PROFILE STATUS</strong></td><td width="5%"></td>
<td align="left" valign="top" class="ttxt"><?php if ($row_USEROKAY['user_stat'] == 0) echo "OFF";
if ($row_USEROKAY['user_stat'] == 1) echo "ON"; ?></td>
</tr>
</tr>
<tr bgcolor="#BAAE85">
<td colspan="3" align="center" valign="top" nowrap bgcolor="#302808" class="ttxt"><span class="style1"><a href="edit_profile.php">EDIT PROFILE</a> | <a href="edit_account.php">EDIT ACCOUNT</a> </span></td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_USEROKAY == 0) { // Show if recordset not empty ?><div class="ttxt" align="center"><br><strong><big><big>Whoa, Please add your profile now - <a href="add_profile.php">Create Profile</a></strong></big></big></div><?php } // Show if recordset not empty ?>
<p><a href="logout.php">LOG OUT</a> </p></td></tr>
</table>
</div>
<?php include "new-footer.html"; ?>
<?php
mysql_free_result($USEROKAY);
?>
Again, I'd really appreciate some help; this all got dropped in my lap when previous 'club coder' disappeared.