deaf_digit
01-11-2006, 03:39 PM
Hi.. this is kind of a very specific problem.
I have a login-script on my site and it's working like a charm.
Only problem is that when you log in you are directed to a very boring site, log.php:
<?
// This is the main part, log.php
// Constants
include("cons.php");
// If the user exists
if ($user) {
echo "Welcome ".$user."! "; // Welcome message
echo "Menu: "; // shows the menu
echo "(<a href=\"inbox.php\">Inbox</a> | "; // creates inbox button
echo "<a href=\"login.php?out=yes&user=$user\">Logout</a> | ";// Logout button
echo "<a href=\"edit.php\">Edit Account</a>";
if ($admin) {
echo " | <a href=\"admin.php\">Admin Centre</a> | ";
}
if ($mod) {
echo " <a href=\"mod.php\">Moderator Centre</a> | ";
}
echo ")";
echo " ";
/****************************************************/
/***** This shows how many users are active and *****/
/*********** it shows their names too! **************/
/****************************************************/
$ro = mysql_query("SELECT * FROM active_users");
$active = mysql_num_rows($ro); // sets $active as the number of active users
echo "Currently active users: ".$active.", "; // lists the number of active users
// Actually lists the users
while ($ra = mysql_fetch_array($ro)) {
$name = $ra['name']; // Sets $name as the users' names
// Lists the users names
if ($i != ($active - 1)) { // if $i doesn't equal $active minus 1
echo $name." | ";
}
else {
echo $name;
}
$i++; // increase temp variable
}
/******************************************/
/********** End of active users! **********/
/******************************************/
}
else {
if ($reg) {
echo $reg;
}
/********** Show the login form ************/
?>
<html>
<head>
<style type="text/css" media="screen">
<!--
#regi {
position: absolute;
width: 130px;
top: 135px;
left: 435px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
--></style>
<body bgcolor="#e0eeee">
<div id="regi">
<form action="login.php">
<input type="text" name="name"> Username<br>
<input type="password" name="pass"> Password<br>
<input type="submit" value="Login!">
</form>
Er du endnu ikke registreret? Så <a href="reg.php">klik her</a> og bliv det!
</div>
<br><br><br>
<a href="index.php" target="_self">Tilbage til forsiden</a>
</body>
</html>
<?
/*********** End of login form ************/
}
?>
Now, I would like to incorporate the most essential things from this script into the main site, which would be like a members-index.php for members that are logged in. The codes for the main site are here:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>The Official Site of The Dingodism</title>
<script>
var oLogmeImg = new Image();
oLogmeImg.style.visibility="hidden";
oLogmeImg.src=
"http://www.Website-Tracking.com/Logme/FoxLog.dll/logme.logme.Logme?dingodism,"
+ escape(document.location.href.substr(document.location.href.lastIndexOf("/") + 1))
+ " ," + escape(document.referrer) + " ," + window.navigator.appVersion
+ " ," + window.screen.width;
</script>
<style type="text/css" media="screen">
<!--
html>body { /* just for the little image on top right */
background-image: url(t2_45x44_grey.gif); /* take your image or remove */
background-repeat: no-repeat;
background-position: top right;
}
body {
margin-top: 60px; /* take care - if changed - all boxpositions must be changed too */
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
border: 0 none; /* border: 1px solid #fff; for proof only - if - box-positions will change */
padding: 0px;
background-color: #ccccff;
color: #555;
font-size: 10px;
line-height: 16px;
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
z-index: 1;
}
h1 {
font-size: 12px;
line-height: 16px;
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
font-weight: bold;
color: #555; /*overskrift*/
margin: 0px 0px 0px 0px; /* top, right, bottom, left */
padding: 0px;
}
p {
font-size: 10px;
line-height: 16px;
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
color: #555; /*normal skrift*/
margin: 0px 0px 0px 0px; /* top, right, bottom, left */
padding: 0px;
}
a {
color: #ddd;
text-decoration: none;
}
a:link {
color: #555;
}
a:visited {
color: #777;
}
a:hover {
background-color: #ccc;
color: #999;
font-weight: bold;
}
img { /* affects all images */
border: 0 none;
}
img.w3cimage { /* affects only images with class w3cimage */
background-color: #ccc;
border: 0 none;
vertical-align: middle;
}
.content {
position: relative; /* Position is declared "relative" to gain control of stacking order (z-index). good idear ... */
width: 640px; /*fleksibelt: auto*/
min-width: 150px;
margin-top: -2px; /* because of headliner */
margin-right: 0px; /* width of rightside + position right */
margin-bottom: 61px;
margin-left: 160px; /* width of leftside + position left */
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 4; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
}
.underbox {
position: relative; /* Position is declared "relative" to gain control of stacking order (z-index). good idear ... */
width: 640px; /*fleksibelt: auto*/
min-width: 150px;
margin-top: -52px; /* because of headliner */
margin-right: 0px; /* width of rightside + position right */
margin-bottom: 61px;
margin-left: 160px; /* width of leftside + position left */
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 4; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
}
#member {
position: absolute;
width: 960px;
height: 20px;
top: 220px;
left: 10px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
#leftside {
position: absolute;
width: 130px;
top: 270px;
left: 10px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
#leftside ul {
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
font-size: 10px;
line-height: 18px;
margin: 0px 0px 0px 0px;
padding: 0px;
}
#leftside li {
list-style-type: none;
border-bottom: 1px dotted #666;
margin: 0;
}
#leftside li a {
display: block;
padding-left: 10px;
color: #555;
text-decoration: none;
width: 120px;
background-image: url(bullets_c_01.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
}
#leftside li a:hover {
display: block;
padding-left: 15px;
color: #ff0000;
background-color: #ccc;
text-decoration: none;
width: 115px;
background-image: url(bullets_c_03.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
font-weight: bold;
}
#leftside li a:visited { /* shows the visited links with other image */
display: block;
padding-left: 10px;
color: #555;
text-decoration: none;
width: 120px;
background-image: url(bullets_c_01.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
}
#leftside li a:visited:hover { /* if you use li a:visited then this */
display: block;
padding-left: 15px;
color: #ccc;
background-color: #999;
text-decoration: none;
width: 115px;
background-image: url(bullets_c_03.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
font-weight: bold;
}
.headliner {
position: relative;
width: 685px; /* is positioned after body, so it gets the right width *//*brug auto for flex*/
top: -60px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
border: 1px solid #000;
background-color: #e0eeee;
color: #ccc;
font-weight: bold;
padding: 10px;
z-index: 6;
}
#underls {
position: absolute;
width: 130px;
top: 410px;
left: 10px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
#poll {
position: absolute;
width: 130px;
top: 520px;
left: 839px;
border: 1px solid #000;
background-color: #e0eeee
z-index: 3;
}
#login {
position: absolute;
width: 130px;
top: 270px;
left: 840px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
--></style>
</head>
<body>
<div class="headliner">
<img src="grafik/header_2.jpg" width="960" height="180" border="0" align="middle">
</div>
<div class="content">
<font color="gray">Dingodism.tk<br>----------------</font>
<br><br>
<center>
<h1>Velkommen til DINGODISMENS OFFICIELLE <font color="red">TEST-</font>hjemmeside!!!</h1>
<hr><br>
Som det kan ses er siden stadig under opbyggelse, men bare rolig - i løbet af kort tid bliver her masser <br>
af sjov og spas. <br><br>
Hilsen Disciplene og Den religiøse leder
<br><br><br>
<i>Æret være den Ferske Dingo</i>
</center>
<br>
</div>
<div class="underbox">
<script language="JavaScript">
<!--
document.write("Sidst opdateret: ");
document.write(document.lastModified);
//-->
</script>
<br>
<br>
<u>Webmasters:</u><br>
deaf_digit <br>
DigitalDingo
</div>
<div id="leftside">
<h1>Menu</h1>
<br> <ul>
<li><a href="index.htm">Main <--</a>
<li><a href="info.htm">Info</a>
<li><a href="nyheder.htm">Nyheder</a>
<li><a href="artikler.htm">Artikler</a>
<li><a href="contact.htm">Kontakt</a>
<li><a href="links.htm">Links</a>
<li><a href="http://s14.invisionfree.com/Dingodismen/index.php?" target="_new">Forum</a>
<li><a href="pray_ask.php">Bed en bøn</a>
</ul>
</div>
<div id="poll">
<script src=http://www.mypoll.dk/module/myPoll.php?checkkey=b6e88e086c057871c723b1f69d008742></script>
</div>
<div id="member">
</div>
<div id="login">
<h5>Log ind:</h5>
<form action="login.php">
<textarea name="name" rows="1" cols="15" style="overflow: hidden"></textarea> Brugernavn
<textarea name="pass" type="password" rows="1" cols="15" style="overflow: hidden"></textarea> Kodeord
<br><br><center>
<input type="submit" value="Login!">
</center>
</form>
<h7>
Er du endnu ikke registreret? Så <a href="reg.php">klik her</a> og bliv det!
</h7>
</div>
</body>
</html>
how do I do this in a smart way? .. I would like for the menu-thing from the log.php to be displayed in the <div id="member"></div> that I've made. Also...if you're not identified you should be redirected to index.php
I know this is a big one...please help anyway... thanks a bunch :)
I have a login-script on my site and it's working like a charm.
Only problem is that when you log in you are directed to a very boring site, log.php:
<?
// This is the main part, log.php
// Constants
include("cons.php");
// If the user exists
if ($user) {
echo "Welcome ".$user."! "; // Welcome message
echo "Menu: "; // shows the menu
echo "(<a href=\"inbox.php\">Inbox</a> | "; // creates inbox button
echo "<a href=\"login.php?out=yes&user=$user\">Logout</a> | ";// Logout button
echo "<a href=\"edit.php\">Edit Account</a>";
if ($admin) {
echo " | <a href=\"admin.php\">Admin Centre</a> | ";
}
if ($mod) {
echo " <a href=\"mod.php\">Moderator Centre</a> | ";
}
echo ")";
echo " ";
/****************************************************/
/***** This shows how many users are active and *****/
/*********** it shows their names too! **************/
/****************************************************/
$ro = mysql_query("SELECT * FROM active_users");
$active = mysql_num_rows($ro); // sets $active as the number of active users
echo "Currently active users: ".$active.", "; // lists the number of active users
// Actually lists the users
while ($ra = mysql_fetch_array($ro)) {
$name = $ra['name']; // Sets $name as the users' names
// Lists the users names
if ($i != ($active - 1)) { // if $i doesn't equal $active minus 1
echo $name." | ";
}
else {
echo $name;
}
$i++; // increase temp variable
}
/******************************************/
/********** End of active users! **********/
/******************************************/
}
else {
if ($reg) {
echo $reg;
}
/********** Show the login form ************/
?>
<html>
<head>
<style type="text/css" media="screen">
<!--
#regi {
position: absolute;
width: 130px;
top: 135px;
left: 435px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
--></style>
<body bgcolor="#e0eeee">
<div id="regi">
<form action="login.php">
<input type="text" name="name"> Username<br>
<input type="password" name="pass"> Password<br>
<input type="submit" value="Login!">
</form>
Er du endnu ikke registreret? Så <a href="reg.php">klik her</a> og bliv det!
</div>
<br><br><br>
<a href="index.php" target="_self">Tilbage til forsiden</a>
</body>
</html>
<?
/*********** End of login form ************/
}
?>
Now, I would like to incorporate the most essential things from this script into the main site, which would be like a members-index.php for members that are logged in. The codes for the main site are here:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>The Official Site of The Dingodism</title>
<script>
var oLogmeImg = new Image();
oLogmeImg.style.visibility="hidden";
oLogmeImg.src=
"http://www.Website-Tracking.com/Logme/FoxLog.dll/logme.logme.Logme?dingodism,"
+ escape(document.location.href.substr(document.location.href.lastIndexOf("/") + 1))
+ " ," + escape(document.referrer) + " ," + window.navigator.appVersion
+ " ," + window.screen.width;
</script>
<style type="text/css" media="screen">
<!--
html>body { /* just for the little image on top right */
background-image: url(t2_45x44_grey.gif); /* take your image or remove */
background-repeat: no-repeat;
background-position: top right;
}
body {
margin-top: 60px; /* take care - if changed - all boxpositions must be changed too */
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
border: 0 none; /* border: 1px solid #fff; for proof only - if - box-positions will change */
padding: 0px;
background-color: #ccccff;
color: #555;
font-size: 10px;
line-height: 16px;
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
z-index: 1;
}
h1 {
font-size: 12px;
line-height: 16px;
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
font-weight: bold;
color: #555; /*overskrift*/
margin: 0px 0px 0px 0px; /* top, right, bottom, left */
padding: 0px;
}
p {
font-size: 10px;
line-height: 16px;
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
color: #555; /*normal skrift*/
margin: 0px 0px 0px 0px; /* top, right, bottom, left */
padding: 0px;
}
a {
color: #ddd;
text-decoration: none;
}
a:link {
color: #555;
}
a:visited {
color: #777;
}
a:hover {
background-color: #ccc;
color: #999;
font-weight: bold;
}
img { /* affects all images */
border: 0 none;
}
img.w3cimage { /* affects only images with class w3cimage */
background-color: #ccc;
border: 0 none;
vertical-align: middle;
}
.content {
position: relative; /* Position is declared "relative" to gain control of stacking order (z-index). good idear ... */
width: 640px; /*fleksibelt: auto*/
min-width: 150px;
margin-top: -2px; /* because of headliner */
margin-right: 0px; /* width of rightside + position right */
margin-bottom: 61px;
margin-left: 160px; /* width of leftside + position left */
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 4; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
}
.underbox {
position: relative; /* Position is declared "relative" to gain control of stacking order (z-index). good idear ... */
width: 640px; /*fleksibelt: auto*/
min-width: 150px;
margin-top: -52px; /* because of headliner */
margin-right: 0px; /* width of rightside + position right */
margin-bottom: 61px;
margin-left: 160px; /* width of leftside + position left */
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 4; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
}
#member {
position: absolute;
width: 960px;
height: 20px;
top: 220px;
left: 10px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
#leftside {
position: absolute;
width: 130px;
top: 270px;
left: 10px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
#leftside ul {
font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
font-size: 10px;
line-height: 18px;
margin: 0px 0px 0px 0px;
padding: 0px;
}
#leftside li {
list-style-type: none;
border-bottom: 1px dotted #666;
margin: 0;
}
#leftside li a {
display: block;
padding-left: 10px;
color: #555;
text-decoration: none;
width: 120px;
background-image: url(bullets_c_01.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
}
#leftside li a:hover {
display: block;
padding-left: 15px;
color: #ff0000;
background-color: #ccc;
text-decoration: none;
width: 115px;
background-image: url(bullets_c_03.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
font-weight: bold;
}
#leftside li a:visited { /* shows the visited links with other image */
display: block;
padding-left: 10px;
color: #555;
text-decoration: none;
width: 120px;
background-image: url(bullets_c_01.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
}
#leftside li a:visited:hover { /* if you use li a:visited then this */
display: block;
padding-left: 15px;
color: #ccc;
background-color: #999;
text-decoration: none;
width: 115px;
background-image: url(bullets_c_03.gif);
background-repeat: no-repeat;
background-position: 0px 6px;
font-weight: bold;
}
.headliner {
position: relative;
width: 685px; /* is positioned after body, so it gets the right width *//*brug auto for flex*/
top: -60px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
border: 1px solid #000;
background-color: #e0eeee;
color: #ccc;
font-weight: bold;
padding: 10px;
z-index: 6;
}
#underls {
position: absolute;
width: 130px;
top: 410px;
left: 10px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
#poll {
position: absolute;
width: 130px;
top: 520px;
left: 839px;
border: 1px solid #000;
background-color: #e0eeee
z-index: 3;
}
#login {
position: absolute;
width: 130px;
top: 270px;
left: 840px;
border: 1px solid #000;
background-color: #e0eeee;
padding: 10px;
z-index: 3;
}
--></style>
</head>
<body>
<div class="headliner">
<img src="grafik/header_2.jpg" width="960" height="180" border="0" align="middle">
</div>
<div class="content">
<font color="gray">Dingodism.tk<br>----------------</font>
<br><br>
<center>
<h1>Velkommen til DINGODISMENS OFFICIELLE <font color="red">TEST-</font>hjemmeside!!!</h1>
<hr><br>
Som det kan ses er siden stadig under opbyggelse, men bare rolig - i løbet af kort tid bliver her masser <br>
af sjov og spas. <br><br>
Hilsen Disciplene og Den religiøse leder
<br><br><br>
<i>Æret være den Ferske Dingo</i>
</center>
<br>
</div>
<div class="underbox">
<script language="JavaScript">
<!--
document.write("Sidst opdateret: ");
document.write(document.lastModified);
//-->
</script>
<br>
<br>
<u>Webmasters:</u><br>
deaf_digit <br>
DigitalDingo
</div>
<div id="leftside">
<h1>Menu</h1>
<br> <ul>
<li><a href="index.htm">Main <--</a>
<li><a href="info.htm">Info</a>
<li><a href="nyheder.htm">Nyheder</a>
<li><a href="artikler.htm">Artikler</a>
<li><a href="contact.htm">Kontakt</a>
<li><a href="links.htm">Links</a>
<li><a href="http://s14.invisionfree.com/Dingodismen/index.php?" target="_new">Forum</a>
<li><a href="pray_ask.php">Bed en bøn</a>
</ul>
</div>
<div id="poll">
<script src=http://www.mypoll.dk/module/myPoll.php?checkkey=b6e88e086c057871c723b1f69d008742></script>
</div>
<div id="member">
</div>
<div id="login">
<h5>Log ind:</h5>
<form action="login.php">
<textarea name="name" rows="1" cols="15" style="overflow: hidden"></textarea> Brugernavn
<textarea name="pass" type="password" rows="1" cols="15" style="overflow: hidden"></textarea> Kodeord
<br><br><center>
<input type="submit" value="Login!">
</center>
</form>
<h7>
Er du endnu ikke registreret? Så <a href="reg.php">klik her</a> og bliv det!
</h7>
</div>
</body>
</html>
how do I do this in a smart way? .. I would like for the menu-thing from the log.php to be displayed in the <div id="member"></div> that I've made. Also...if you're not identified you should be redirected to index.php
I know this is a big one...please help anyway... thanks a bunch :)