Well, i know that your probably all going to hate this code, it's my first learning project.And this page in particular is a real ugly thing. it's ment for IE7 and FF2 only (not releasing it for quite some time)
Outputs: www.newstuff.benjaminfaulkner.net/login.php
I'm using functions to output different things for my login page, there is 3 functions outputting. That's the denied, confirmed, and form. Now it accepts ". $_POST[username] ." and outputs it correctly, but the rest wont work seems like anything inside <?php with:
". $sitetitle ."
<?php echo $sitetitle ?>
$sitetitle
This has me completely stumped, it's effected 4 other pages, and I can only assume the function or the SQL is wrong. but anyway.
I have a templates folder, the front page is only there to pull things up, so the first page looks like this:
(note, not worked at implimenting multi-themes yet)
<?php include('includes/global-functions.php'); ?>
<?php include('design/templates/prometheus1/login.php'); ?>
global-functions looks like this:
<?php
/*******************************************************************
*Coded by Benjamin 'Comet' Faulkner
*Code audited by Rick with General Feedback & fixes
*CC Copyright. Rihard & Silver Comet
*MAIL: benjamin_faulkner01@hotmail.com
*Helped a lot by CrazyRick of rihardsonline.com/sgnonline.com
*
*Ex mentor credit for some of global-functions ZaphodMcmillan.com
*******************************************************************/
#### Includes, Fairly obvious that. ####
require('mysql_connect.php');
#### ACCOUNTS - Do Not Edit####
$query = "SELECT * FROM users WHERE username='" . $_COOKIE['username'] ."'";
$resultlogin2=mysql_query($query) or die(mysql_error());
$user = mysql_fetch_array($resultlogin2);
if($user['password'] == $_COOKIE['password'])
$useracp=$user['can_acp'];
$useruca=$user['can_comment'];
$userbsa=$user['can_post'];
#### BB-HTML translator, Global. ####
$old = array(chr(10), "[js]", "[jstitle]", "[/jstitle]", "[img]", "[/img]", "[/js]");
$new = array("<br/>", "<a href='../images/details/", ".jpg' rel='lightbox[list]' title='", "'>", "<img src='../images/details/", ".jpg' width='75' height='50' alt='' />", "</a>");
#### Starting config ####
$query = "SELECT * FROM config ORDER BY configid DESC";
$result2 = mysql_query($query) or die("Config Load Dead");
while ($pro_config=mysql_fetch_array($result2))
{
$configid=$pro_config['configid'];
$name=$pro_config['name'];
$closedvar=$pro_config['closedvar'];
$closed1=$pro_config['closed1'];
$closed2=$pro_config['closed2'];
$sitetitle=$pro_config['sitetitle'];
$home=$pro_config['home'];
$gallery=$pro_config['gallery'];
$archive=$pro_config['archive'];
$biography=$pro_config['biography'];
$data=$pro_config['data'];
$links=$pro_config['links'];
$accounts=$pro_config['accounts'];
$comments=$pro_config['comments'];
}
## update config for that style ##
function update_config($configid, $name, $closedvar, $closed1, $closed2, $sitetitle, $home, $gallery, $archive, $biography, $data, $links, $accounts, $comments) {
global $dbc;
$query = "UPDATE config SET name = '$name', closedvar = '$closedvar', closed1 = '$closed1', closed2 = '$closed2', sitetitle = '$sitetitle', home = '$home', gallery = '$gallery', archive = '$archive', biography = '$biography', data = '$data', links = '$links', accounts = '$accounts', comments = '$comments' WHERE configid = '$configid'";
$result2 = mysql_query($query) or die(mysql_error());
}
#### Starting Blog ##
##blog##
$query="SELECT * from blogentry order by blogid DESC";
$result3=mysql_query($query) or die("Could not get blogs");
while($pro_blogmain=mysql_fetch_array($result3))
{
$blogtitle=$pro_blogmain['blogtitle'];
$blogdate=date("l \t\h\e iS \o\n F o \a\t H:i:s a", $pro_blogmain['blogdate']);
$blogtext=$pro_blogmain['blogtext'];
}
##next##
$query=mysql_query("SELECT blogid FROM blogentry WHERE blogid > '$id' order by blogid asc limit 1");
while($pro_blognext=mysql_fetch_array($query))
{
$blognext=$pro_blognext['blogid'];
}
##back##
$query=mysql_query("SELECT blogid FROM blogentry WHERE blogid < '$id' order by blogid desc limit 1");
while($pro_blogback=mysql_fetch_array($query))
{
$blogback=$pro_blogback['blogid'];
}
##max row##
$query=mysql_query("SELECT blogid FROM blogentry order by blogid desc limit 1");
while($pro_blogmax=mysql_fetch_array($query))
{
$blogmax=$pro_blogmax['blogid'];
}
#### Starting Browser Detect ####
function browser_detection( $which_test ) {
## initialize the variables ##
$browser = '';
$dom_browser = '';
## set to lower case to avoid errors ##
$navigator_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
if (stristr($navigator_user_agent, "opera")) {
$browser = 'opera';
$dom_browser = true;}
elseif (stristr($navigator_user_agent, "msie 4")) {
$browser = 'msie4';
$dom_browser = false;}
elseif (stristr($navigator_user_agent, "msie")) {
$browser = 'msie';
$dom_browser = true;}
## return the test result you want ##
if ( $which_test == 'browser' ){
return $browser;
}
}
## DATE WAS HERE Redundanted, sign lasts till 0.3 probit. ##
## encode text (so ' ect dont matter) ##
function encode_data($data)
{
global $dbc;
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
return mysql_real_escape_string($data, $dbc);
}
## Starting Index's Blog List ##
$next=$id-1;
$back=$id+1;
$bloglistl=($id*10);
$bloglist2=($id*10)+1;
$bloglist3=($id*10)+2;
$bloglist4=($id*10)+3;
$bloglist5=($id*10)+4;
$bloglist6=($id*10)+5;
$bloglist7=($id*10)+6;
$bloglist8=($id*10)+7;
$bloglist9=($id*10)+8;
$bloglist10=($id*10)+9;
$query = "SELECT * FROM blogentry ORDER BY blogdate DESC LIMIT 0, 10";
$result4 = mysql_query($query) or die("Index List Dead");
while($pro_bloglist=mysql_fetch_array($result4)){
## blog1 ##
if ($row == $bloglist1)
{
$blogtitle1=$pro_bloglist[1];
$blogtext1=$pro_bloglist[2];
$blogdate1=date("l \t\h\e iS \o\n F o \a\t H:i:s a", $pro_bloglist[3]);
$blogimag1=$pro_bloglist[0];
}
## blog2 ##
if ($row == $bloglist2)
{
$blogtitle2=$pro_bloglist[1];
$blogtext2=$pro_bloglist[2];
$blogdate2=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag2=$pro_bloglist[0];
}
## blog3 ##
if ($row == $bloglist3)
{
$blogtitle3=$pro_bloglist[1];
$blogtext3=$pro_bloglist[2];
$blogdate3=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag3=$pro_bloglist[0];
}
## blog4 ##
if ($row == $bloglist4)
{
$blogtitle4=$pro_bloglist[1];
$blogtext4=$pro_bloglist[2];
$blogdate4=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag4=$pro_bloglist[0];
}
## blog5 ##
if ($row == $bloglist5)
{
$blogtitle5=$pro_bloglist[1];
$blogtext5=$pro_bloglist[2];
$blogdate5=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag5=$pro_bloglist[0];
}
## blog6 ##
if ($row == $bloglist6)
{
$blogtitle6=$pro_bloglist[1];
$blogtext6=$pro_bloglist[2];
$blogdate6=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag6=$pro_bloglist[0];
}
## blog7 ##
if ($row == $bloglist7)
{
$blogtitle7=$pro_bloglist[1];
$blogtext7=$pro_bloglist[2];
$blogdate7=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag7=$pro_bloglist[0];
}
## blog8 ##
if ($row == $bloglist8)
{
$blogtitle8=$pro_bloglist[1];
$blogtext8=$pro_bloglist[2];
$blogdate8=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag8=$pro_bloglist[0];
}
## blog9 ##
if ($row == $bloglist9)
{
$blogtitle9=$pro_bloglist[1];
$blogtext9=$pro_bloglist[2];
$blogdate9=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag9=$pro_bloglist[0];
}
## blog10 ##
if ($row == $bloglist10)
{
$blogtitle10=$pro_bloglist[1];
$blogtext10=$pro_bloglist[2];
$blogdate10=date("l \t\h\e iS \o\n F o \a\t H:i a", $pro_bloglist[3]);
$blogimag10=$pro_bloglist[0];
}
$row += 1;
$row == 10;}
?>
(That is a really ugly file, but i'm not good enough yet to improve it.)