Jump to content

cookie set, then after function "not logged in"


dolcezza

Recommended Posts

I set a cookie, and the cookie is showing in my system. I can navigate to the next page (contactspage.php) which is protected by cookie without a prob.

This is a contacts database click "add" to go to insert.php (inserts info i database) and try to redirect back to contactspage.php it says not logged in.

Any help? I am a pretty new, so any help is appreciated.

insert.php:

<?php
include_once('connect.php');


$last=$_POST['last'];
$first=$_POST['first'];
$venue=$_POST['venue'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$fax=$_POST['fax'];
$email=$_POST['email'];
$website=$_POST['website'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$notes=$_notes['notes'];


$query = "INSERT INTO contacts (last,first,venue,phone,mobile,fax,email,website,address,city,state,zip,notes) VALUES ('$last','$first','$venue','$phone','$mobile','$fax','$email','$website','$address','$city','$state','$zip','$notes')";
header('Location: http://www.katzconnects.com/admin/contactspage.php');



$my_result=mysql_query($query);
if(!$my_result){echo mysql_error();}


?>

contactspage.php:

	<?php
include("config.php");
$cookuser = $_COOKIE["cookuser"];
$cookpass = $_COOKIE["cookpass"];
$adminpass = md5($adminpass);
if($cookuser && $cookpass) {
    if(($cookuser == $adminuser) && ($cookpass == $adminpass)){
    echo("Hello Susan!"); ?>  <a href=logout.php><img src="buttons/logout_0.jpg" alt="Log Out Button" border="0"></a> <a href=addcontact.php><img src="buttons/add_0.jpg" alt="Add" border="0"></a><br />
        <?
include_once("contacts.php"); 

    }
    else{
    echo($incorrect_error);
    }
}
else{
echo($not_loggedin);
}
?>

included contacts.php:

<?php
include_once("connect.php");
$id=$_GET['id'];


$query="SELECT * FROM contacts ORDER BY last ASC";
$result=mysql_query($query);
// count how many rows are in the table
$num=mysql_num_rows($result); 
mysql_close();
?>

<table border="0" cellspacing="1" cellpadding="2">
<tr bgcolor="#3333ff" >

<th>Name</th>
<th>Venue</th>
<th>Phone</th>
<th>Mobile</th>
<th>Fax</th>
<th>E-mail</th>
<th>Website</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Notes</th>
<th>Delete</th>
<th>Edit</th>
</tr>
<?php
//loop
if ($num==0) {echo"The database contains no records";}
else
{
$i=0;
while($i<$num){
$id=mysql_result($result,$i,"id");
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$venue=mysql_result($result,$i,"venue");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$website=mysql_result($result,$i,"website");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$notes=mysql_result($result,$i,"notes");

$r = 0;
while($db_fetch = mysql_fetch_array($result))
{
if($i%2 == 0)
{
echo "<tr bgcolor='#e3e3f4'>";
$r++;
}
else
{
echo "<tr bgcolor='#ffffff'>";
$r++;
}
}

?>
	<td><? echo $last.", ".$first; ?></td>
	<td><? echo $venue; ?></td>
	<td><? echo $phone; ?></td>
	<td><? echo $mobile; ?></td>
	<td><? echo $fax; ?></td>
	<td><a href="mailto:<? echo $email; ?>">E-mail</a></td>
	<td><? echo $website; ?></td>
	<td><? echo $address; ?></td>
	<td><? echo $city; ?></td>
	<td><? echo $state; ?></td>
	<td><? echo $zip; ?></td>
	<td><? echo $notes; ?></td>
	<td><a href='delete.php?id=<?=$id;?>'><delete><img src="buttons/delete.png" border="0" alt="delete"></a></td>
		<td><a href='updatepage.php?id=<?=$id;?>'><img src="buttons/edit.png" border="0" alt="edit"></a></td>
</tr>
<?
$i++;
}
}
echo "</table>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.