Jump to content

plasmagames

Members
  • Posts

    63
  • Joined

  • Last visited

    Never

Posts posted by plasmagames

  1. then tell me why when i post in that thread it doesn't post it. I ahve posted twice there and they didn't show so i started a knew thread for it. I want to get this problem solved so i can get started on my next project. Getting this fixed will allow me to get my site going

     

  2. Quote: Maq

    First post I noticed that you're using an operator to compare the $admin variable.  You have:

     

    if ($admin = '2');

     

    and needs to be

     

    if ($admin == 2) {

     

    There are a couple other basic mistakes...

     

    Anyway, you need to have a session that stores the user's ID.  That way when you can check if they're admin on any page.

     

    Is uMemberGroup a field in your database?

     

    to answer your question. in the config.php file(included with all pages) there are some renaming of $logged variables

    $uId = $logged['id'];
    $uName = $logged['username'];
    $uEmail = $logged['email'];
    $uMsn = $logged['msn'];
    $uIp = $logged['ip'];
    $uSignup = $logged['signup'];
    $uLevel = $logged['level'];
    $uGtalk = $logged['gtalk'];
    $uMsn = $logged['msn'];
    $uAim = $logged['aim'];
    $uLocation = $logged['location'];
    $uBio = $logged['bio'];
    $uGroup = $logged['gid'];
    $uMembergroup = $logged['membergroup'];
    

     

    $uMembergroup = $logged['membergroup'];

    and membergroup is the field in the database as are location, id etc. so yes it is in the database so to speak

  3. Hi

     

    BTW, $uName is no where in that code either.  How do you "carry" it from page to page?  There are sessions or post variables at all.

     

    Hello!!!???

     

    i know that.

     

    heres the code

    that has it

    <?php
    ob_start();
    //Allows us to use cookies on all of the pages
    
    //Get some additional functions
    include ('functions.php');
    include ('defs.php');
    //*********************************************//
    //Length Of Time Cookie Lasts - 1 week default
    $cookieTime = time() + 7 * 86400;
    //***********************************************//
    
    //Path to index.php file , no following slash
    //Eg, if the index file were located at http://iscripting.net/isus/index.php - you would enter http://iscripting.net/isus
    $siteurl = SITE_PATH;
    
    //Your Website name, not the <title>
    $sitename = SITE_NAME;
    
    //The default membergroup when someone registers.
    $defaultmembergroup = "user";
    
    //**********************************************//
    
    //Connect to the database
    $connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    
    if (!$connect)
        echo 'There was an error connecting to the database';
    
    mysql_select_db(DB_NAME);
    
    
    // Get and authenticate their cookie information.
    $u1 = secure($_COOKIE['username']);
    $p1 = secure($_COOKIE['password']);
    
    //Check theyre logged in.
    $logged = mysql_query("SELECT * FROM `users` WHERE username = '$u1' AND password = '$p1'");
    
    $logged = mysql_fetch_array($logged, MYSQL_ASSOC);
    
    //Rename some of the $logged['variables'] with easier names.
    $uId = $logged['id'];
    $uName = $logged['username'];
    $uEmail = $logged['email'];
    $uMsn = $logged['msn'];
    $uIp = $logged['ip'];
    $uSignup = $logged['signup'];
    $uLevel = $logged['level'];
    $uGtalk = $logged['gtalk'];
    $uMsn = $logged['msn'];
    $uAim = $logged['aim'];
    $uLocation = $logged['location'];
    $uBio = $logged['bio'];
    $uGroup = $logged['gid'];
    $uMembergroup = $logged['membergroup'];
    
    //If the user isn't logged in, we'll set their name to guest and membergroup to guest as well so they don't screw anything up
    if (!$uName) {
    
        $uName = guest;
        $uMembergroup = guest;
    
    }
    //Get the permissions sorted out.
    $permquery1 = mysql_query("SELECT * FROM `permissions` WHERE mg_name = '$uMembergroup' ");
    $uCan = mysql_fetch_assoc($permquery1);
    
    $action = secure($_GET['action']);
    $sa = secure($_GET['sa']);
    $ssa = secure($_GET['ssa']);
    
    ?>

     

    which btw is included with all pages

  4. ok heres the files

     

    login.php

    <BR><STRONG><img src="theme/<?php echo $theme;?>/i/key.png"> Login</STRONG>
    <?php
    
    ob_start();
    session_start();
    if ($uId) {
    
        //If they are logged in, they don't need to be here
        header("Location: " . SITE_PATH . "/index.php");
    
    } else {
    
    
        if (!isset($_POST['login'])) {
    
            //If the post hasn't been submitted, then show the forms
    
            echo '<BR><p><form method="post" action="index.php?action=login">
    
    <b>Username:</b><input class="field" type="text" name="username"><br />
    <br />
    <b>Password:</b><input class="field" type="password" name="password"><br />
    
    <input class="submit" type="submit" name="login" value="Login"><p>
    </form>
    <br>
    <a href="index.php?action=forgot">Forgot Password?</a> | <a href="index.php?action=register">Register</a>';
    
        } else {
    
    
            //secure the input
            $username = secure($_POST['username']);
            $password = secure($_POST['password']);
    
            //make sure the fields arn't empty
            if (!$username | !$password) {
    
                echo 'You left a field empty';
    
            } else {
    
                //make sure the user exists
                $user = mysql_query("SELECT * FROM `users` WHERE username = '$username'");
    
                if (($usez = mysql_num_rows($user)) == 0) {
                    echo 'user doesnt exist';
                } else {
                    //Encrypt the password to check with the encrypted one currently in the database
                    $encpass = md5($password . SALT);
    
                    //Find the user
                    $superquery = mysql_query("SELECT * FROM `users` WHERE username = '$username' AND password = '$encpass'");
    
    
                    if (mysql_num_rows($superquery) == 1) {
    
                        //If the user is found, set the cookies
    
                        setcookie("username", $username, $cookieTime);
                        setcookie("password", $encpass, $cookieTime);
    
    
                        echo 'Success, you are now logged in.';
                           header("Location: " . SITE_PATH . "/index.php");
    
                    } else {
    
                        echo 'Failure';
    
                    }
                }
            }
        }
    }
    ?>
    

     

    nav.php

    <?php
    
    if ($uId) {
        if ($uCan)
            echo "Hey! <STRONG>$uName</STRONG>"; // hello member!
        	echo '<p>';
    	echo '<strong>User Menu</strong>';
    	echo '<br>';
    	echo '<br>';
       		echo "<a href=\"index.php?action=editprofile\">Edit Profile</a> <br>";
        	echo "<a href=\"index.php?action=memberlist\">View Members</a> <br>";
        	echo "<a href=\"index.php?action=logout\">Logout</a> <br>";
        	echo '</p>';
        	echo "<BR>";
    		if($_SESSION["admin"]==1)   // Checks for Admin
               {
    			print '<strong>Admin</strong>';
    			print '<br />';
    			print '<br />';
    			print '<a href="index.php?action=theme">Change Theme</a> <br>';
    			print '<a href="index.php?action=news">Edit News</a> <br>';
    			print '<a href="index.php?action=general">General Settings</a> <br>';
               }  
    
    } else { // if this isn't a member then
    echo "<br>";
    include ('login.php');
        echo "Welcome, <STRONG>$uName</STRONG>!";
        echo '<p>';
        echo "<br>";
        echo "<a href=\"index.php?action=login\">Login</a>";
        echo "<br>";
        echo "<a href=\"index.php?action=register\">Sign up</a>";
        echo '</p>';
    }
    
    echo "<BR>"; //break
    echo "<BR>"; // break
    echo '<img src="theme/'.$theme.'/i/blah.png" alt=\"Bubble\"><STRONG>Partners</STRONG>';
    // to enable please remvoe the comments //
    
    include('partners.php');
    
    include('other.php');
    ?>

  5. First, yes i use sessions

     

    and second

     

    the page that i put the source code for is nav.php which is included in index.php along with some others. and all pages load within a switch statement.

     

    and you create a admin user when your install the script just like smf and all the others. the variable for the membergroup is $uMembergroup and i tried $uMembergroup = "admin" and that didn't work

  6. I am using a script that has became "obsolete" and there is no support for it.

     

    So i'm asking here how to get the script to check for an admin. heres the page i want to check for admin status

    <?php
    
    if ($uId) {
        if ($uCan)
            echo "Hey! <STRONG>$uName</STRONG>"; // hello member!
        	echo '<p>';
    	echo '<strong>User Menu</strong>';
    	echo '<br>';
    	echo '<br>';
       		echo "<a href=\"index.php?action=editprofile\">Edit Profile</a> <br>";
        	echo "<a href=\"index.php?action=memberlist\">View Members</a> <br>";
        	echo "<a href=\"index.php?action=logout\">Logout</a> <br>";
        	echo '</p>';
        	echo "<BR>";
    		if ($admin = '2'); 
    			echo '<strong>Admin</strong>';
    			echo '<br />';
    			echo '<br />';
    			echo '<a href="index.php?action=theme">Change Theme</a> <br>';
    			echo '<a href="index.php?action=news">Edit News</a> <br>';
    			echo '<a href="index.php?action=general">General Settings</a> <br>';
    } else { // if this isn't a member then
    echo "<br>";
    include ('login.php');
        echo "Welcome, <STRONG>$uName</STRONG>!";
        echo '<p>';
        echo "<br>";
        echo "<a href=\"index.php?action=login\">Login</a>";
        echo "<br>";
        echo "<a href=\"index.php?action=register\">Sign up</a>";
        echo '</p>';
    }
    
    echo "<BR>"; //break
    echo "<BR>"; // break
    echo '<img src="theme/'.$theme.'/i/blah.png" alt=\"Bubble\"><STRONG>Partners</STRONG>';
    // to enable please remvoe the comments //
    
    include('partners.php');
    
    include('other.php');
    ?>
    

  7. wildteen88 that would work but i want it to change with the theme.

     

     

    see the index.php file is set to use the css fiel thats int he theme directory in this case theme/default

  8. ok what i was trying to do was get the link to target the parent window which in this case is the window the user is browsing in and load it in that but try using _blank instead of _parent

     

    <a href="http://newsite.knightsofkarbala.com/index.php?page=forum" target="_blank" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Forums','','template/warfare/nav_bar/nav_bar_over/images/nav_bar_over_07.gif',1)">

  9. ya i know that. heres my index.php code that shows it all I use the switch statment and all pages show up in one page so $uName is carried through the entire site from register.php i will also say that this is a pre made script hat i have modified

     

    <?php
    // Get the configuration file
    
    
    $filename = 'defs.php';
    $setup = 'install/index.php';
    
    if (!file_exists($filename)) {
        die("Please install Isus beafore usage! <a href=\"install/\">Click here</A>");
    }
    if (file_exists($setup)) {
        die("Please remove the install folder beafore usage. It can be harmful to your site if it exists and someone uses it!");
    }
    
    
    include ('config.php');
    
    // get the theme
    $result = mysql_query("SELECT theme FROM theme WHERE id=1");
    $theme = mysql_result($result, 0);
    
    //Set the navigation up, secure it's input.
    $nav = $_GET['action'];
    secure($nav);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    <html>
    <head>
        <meta name="generator" content="HTML Tidy for Linux (vers 1 September 2005), see www.w3.org">
    
        <title><?php echo SITE_NAME; ?></title>
        <link rel="stylesheet" type="text/css" href="theme/<?php echo $theme;?>/visus.css">
        <style type="text/css">
        div.c1 {text-align: center}
        </style>
    </head>
    
    <body bgcolor="#FFFFFF" background="theme/<?php echo $theme;?>/images/logo.png">
    <p>
        <div class="c1" valign = "top">
            <div class="logo">
                <img src="theme/<?php echo $theme;?>/images/logo.png" height="250" width = "800">
            </div>
    
            <div class="pages">
                <?php include ("navbar.php"); ?>
            </div>
    
            <div class="Container" style=" background-image:url(images/cbg.png);">
                <div class="content" style="width:580">
                    <?php
                    //Use a switch statement to go through the URLS.
                    switch ($nav) {
                        case "login":
                            include ('login.php');
                            break;
    
                        case "logout":
                            include ('logout.php');
                            break;
    
                        case "editprofile":
                            include ('editprofile.php');
                            break;
    
                        case "memberlist":
                            include ('memberlist.php');
                            break;
    
                        case "register":
                            include ('register.php');
                            break;
    
                        case "viewterms";
                            include ('terms.php');
                            break;
    
                        case "forgot";
                            include ('reset_pw.php');
                            break;
    
                        case "profile";
                            include ('profile.php');
                            break;
    
                        case "admin";
                            include ('admin/index.php');
                            break;
    
    				case "theme";
                            include ('admin/theme.php');
                            break;
    
    				case "news";
                            include ('admin/news.php');
                            break;
    
    				case "general";
                            include ('admin/general.php');
                            break;
    
    				case "download";
                            include ('download.php');
                            break;
    
    				case "game";
                            include ('game.php');
                            break;
    
    				case "tutorial";
                            include ('tutorial.php');
                            break;
    
    				case "contact";
                            include ('contact.php');
                            break;
    
                        default:
                            include ('default.php');
                            break;
    
    
                    }
    
                    ?>
                </div>
    
                <div  class="sidebar" align="right">
                    <?php include ('nav.php'); ?>
                </div>
            </div>
            <div align="center" class="footer">
                <?php include ('footer.php'); ?>
            </div>   
        </div>
        </p>
    </body>
    </html>
    

  10. replace this

    <a href="http://newsite.knightsofkarbala.com/index.php?page=forum" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Forums','','template/warfare/nav_bar/nav_bar_over/images/nav_bar_over_07.gif',1)">

     

    with

    <a href="http://newsite.knightsofkarbala.com/index.php?page=forum" target="_parent" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Forums','','template/warfare/nav_bar/nav_bar_over/images/nav_bar_over_07.gif',1)">

     

    that should work

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