the problem is, i can't get the sessions to keep their values. so, you click log in, and go to the second page, it shows everything it's supposed to, but... if you click the link on that page FOR that page, it goes to the "you cant access this page" error. it SHOULD keep the username and password in the session so you could theoretically refresh that page, navigate away, come back etc. this is going to be KEY, because i have 5 or 6 pages in all that will require them to stay logged in.
FYI.... the password portion of this doesn't work at the moment.. i haven't put all of that in. i'm focusing mainly on getting the sessions aspect to work by testing it on the user name. HELP PLEASE!!!!
i need actual CODE help. PLEASE don't send me a damned link to some PPC site you're getting paid to spam..
thanks in advance.
////index.php =
php include"head.php" (which has session_start(); and is included in every file)
<form id="form1" name="form1" method="post" action="lead_view.php">
<input type="text" name="affiliate_username" id="affiliate_username" />
<input type="password" name="affiliate_password" id="affiliate_password" />
<input type="submit" name="Go" id="Go" value="Submit" />
--------------
/////lead_view.php
<?php
include "head.php";
/* $affiliate_username = $_POST['affiliate_username'];
$affiliate_password = $_POST['affiliate_password']; */
$username = isset($_POST['affiliate_username']) ? $_POST['affiliate_username'] : $_SESSION['affiliate_username'];
$password = isset($_POST['affiliate_password']) ? $_POST['affiliate_password'] : $_SESSION['affiliate_password'];
(((the immediately above and immediately below aren't supposed to be ON at the same time. i was experimenting with both... neither worked.)))
if (isset($_POST['affiliate_username']))
{
$affiliate_username = $_POST['affiliate_username'];
}
else {
$affiliate_username = $_SESSION['affiliate_username'];
}
if (isset($_POST['affiliate_password'])) {
$pwd = $_POST['affiliate_password'];
} else {
$pwd = $_SESSION['affiliate_password'];
}
$checkusername =mysql_query("SELECT * FROM users WHERE affiliate_username = '".$affiliate_username."'");
$checkpassword = mysql_query("SELECT * FROM users WHERE affiliate_password = '".$password."'");
/*
if (mysql_num_rows($checkusername) != 1)
{
die ('<h1>OOPS!</h1>
<p><br /><br /><br />Sorry, the <strong>user name</strong> you provided doesn\'t exist.<br />
Please go back and try again, or <a href=\"../pw/password.php\">request a lost password</a></p></span>');
} */
echo "welcome $affiliate_username";
$result = mysql_query("SELECT * FROM leads JOIN users ON users.user_id = leads.user_id WHERE affiliate_username = '".$affiliate_username."'");
$check= 0;
?>
<br />
<a href="logout.php">logout</a>
<table width="1000px" border="0px">
<tr>
<td><hr />
</td>
</tr>
</table>
<br />
<br /><br />
<?
if (!isset($affiliate_username))
{
echo "you cant access this page";
}
else
{
echo "
<table width=\"\" border=\"1px\">
<td>Change</td>
<td>ID</td>
<td>User</td>
<td>Last Name</td>
<td>First Name</td>
<td>MI</td>
<td>DOB</td>
<td>Email</td>
<td>Address</td>
<td>City</td>
<td>State</td>
<td>zip</td>
<td>Debt</td>
<td>Best Time</td>
<td>Home Phone</td>
<td>Cell Phone</td>
<td>Work Phone</td>
<td>Signed</td>
<td>Drafted</td>
<td>Commission</td>
</tr>";
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
$check = $check+1;
echo "<tr>";
/* echo "<td><input type=\"checkbox\" name=\"affiliate_user_id[]\" value=\"".$row['affiliate_user_id'];
echo "\" /></td>"; */
echo "<td>
<form method=\"post\" action=\"lead_update.php\">
<input type=\"hidden\" name=\"leads_id\" value=\"".$row['leads_id'];
echo "\"/><input name=\"update\" type=\"submit\" value=\"update\" />
</form>
<form method=\"post\" action=\"lead_delete.php\">
<input type=\"hidden\" name=\"leads_id\" value=\"".$row['leads_id'];
echo "\" /><input name=\"update\" type=\"submit\" value=\"delete\" />
</form>
</td>";
echo "<td>".$row['leads_id'];
echo "</td>";
echo "<td>".$row['user_id'];
echo "</td>";
echo "<td>".$row['Last_Name'];
echo "</td>";
echo "<td>".$row['First_Name'];
echo "</td>";
echo "<td>".$row['MI'];
echo "</td>";
echo "<td>".$row['DOB'];
echo "</td>";
echo "<td><a href=\"".$row['Email'];
echo "\">".$row['Email'];
echo "</a>";
echo "</td>";
echo "<td>".$row['Address'];
echo "</td>";
echo "<td>".$row['City'];
echo "</td>";
echo "<td>".$row['State'];
echo "</td>";
echo "<td>".$row['Zip'];
echo "</td>";
echo "<td>".$row['Debt'];
echo "</td>";
echo "<td>".$row['Best_Time'];
echo "</td>";
echo "<td>".$row['Home_Phone'];
echo "</td>";
echo "<td>".$row['Cell_Phone'];
echo "</td>";
echo "<td>".$ro
awakening, i stuck it in there because 1. its multi lines... 2. i have that command favorited, 3, because i didn't need that snippet of code.
as for the rest, yes i didn't learn it completely, which is why i'm looking for help. i've read every tutorial i can find and have only gotten this far.
pierdiem, please read it closer.
there is a start session. its in the included head.php as stated.
thanks
FYI.... the password portion of this doesn't work at the moment.. i haven't put all of that in. i'm focusing mainly on getting the sessions aspect to work by testing it on the user name. HELP PLEASE!!!!
i need actual CODE help. PLEASE don't send me a damned link to some PPC site you're getting paid to spam..
thanks in advance.
////index.php =
php include"head.php" (which has session_start(); and is included in every file)
<form id="form1" name="form1" method="post" action="lead_view.php">
<input type="text" name="affiliate_username" id="affiliate_username" />
<input type="password" name="affiliate_password" id="affiliate_password" />
<input type="submit" name="Go" id="Go" value="Submit" />
--------------
/////lead_view.php
<?php
include "head.php";
/* $affiliate_username = $_POST['affiliate_username'];
$affiliate_password = $_POST['affiliate_password']; */
$username = isset($_POST['affiliate_username']) ? $_POST['affiliate_username'] : $_SESSION['affiliate_username'];
$password = isset($_POST['affiliate_password']) ? $_POST['affiliate_password'] : $_SESSION['affiliate_password'];
(((the immediately above and immediately below aren't supposed to be ON at the same time. i was experimenting with both... neither worked.)))
if (isset($_POST['affiliate_username']))
{
$affiliate_username = $_POST['affiliate_username'];
}
else {
$affiliate_username = $_SESSION['affiliate_username'];
}
if (isset($_POST['affiliate_password'])) {
$pwd = $_POST['affiliate_password'];
} else {
$pwd = $_SESSION['affiliate_password'];
}
$checkusername =mysql_query("SELECT * FROM users WHERE affiliate_username = '".$affiliate_username."'");
$checkpassword = mysql_query("SELECT * FROM users WHERE affiliate_password = '".$password."'");
/*
if (mysql_num_rows($checkusername) != 1)
{
die ('<h1>OOPS!</h1>
<p><br /><br /><br />Sorry, the <strong>user name</strong> you provided doesn\'t exist.<br />
Please go back and try again, or <a href=\"../pw/password.php\">request a lost password</a></p></span>');
} */
echo "welcome $affiliate_username";
$result = mysql_query("SELECT * FROM leads JOIN users ON users.user_id = leads.user_id WHERE affiliate_username = '".$affiliate_username."'");
$check= 0;
?>
<br />
<a href="logout.php">logout</a>
<table width="1000px" border="0px">
<tr>
<td><hr />
</td>
</tr>
</table>
<br />
<br /><br />
<?
if (!isset($affiliate_username))
{
echo "you cant access this page";
}
else
{
echo "
<table width=\"\" border=\"1px\">
<td>Change</td>
<td>ID</td>
<td>User</td>
<td>Last Name</td>
<td>First Name</td>
<td>MI</td>
<td>DOB</td>
<td>Email</td>
<td>Address</td>
<td>City</td>
<td>State</td>
<td>zip</td>
<td>Debt</td>
<td>Best Time</td>
<td>Home Phone</td>
<td>Cell Phone</td>
<td>Work Phone</td>
<td>Signed</td>
<td>Drafted</td>
<td>Commission</td>
</tr>";
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
$check = $check+1;
echo "<tr>";
/* echo "<td><input type=\"checkbox\" name=\"affiliate_user_id[]\" value=\"".$row['affiliate_user_id'];
echo "\" /></td>"; */
echo "<td>
<form method=\"post\" action=\"lead_update.php\">
<input type=\"hidden\" name=\"leads_id\" value=\"".$row['leads_id'];
echo "\"/><input name=\"update\" type=\"submit\" value=\"update\" />
</form>
<form method=\"post\" action=\"lead_delete.php\">
<input type=\"hidden\" name=\"leads_id\" value=\"".$row['leads_id'];
echo "\" /><input name=\"update\" type=\"submit\" value=\"delete\" />
</form>
</td>";
echo "<td>".$row['leads_id'];
echo "</td>";
echo "<td>".$row['user_id'];
echo "</td>";
echo "<td>".$row['Last_Name'];
echo "</td>";
echo "<td>".$row['First_Name'];
echo "</td>";
echo "<td>".$row['MI'];
echo "</td>";
echo "<td>".$row['DOB'];
echo "</td>";
echo "<td><a href=\"".$row['Email'];
echo "\">".$row['Email'];
echo "</a>";
echo "</td>";
echo "<td>".$row['Address'];
echo "</td>";
echo "<td>".$row['City'];
echo "</td>";
echo "<td>".$row['State'];
echo "</td>";
echo "<td>".$row['Zip'];
echo "</td>";
echo "<td>".$row['Debt'];
echo "</td>";
echo "<td>".$row['Best_Time'];
echo "</td>";
echo "<td>".$row['Home_Phone'];
echo "</td>";
echo "<td>".$row['Cell_Phone'];
echo "</td>";
echo "<td>".$ro
awakening, i stuck it in there because 1. its multi lines... 2. i have that command favorited, 3, because i didn't need that snippet of code.
as for the rest, yes i didn't learn it completely, which is why i'm looking for help. i've read every tutorial i can find and have only gotten this far.
pierdiem, please read it closer.
there is a start session. its in the included head.php as stated.
thanks