Jump to content

The NavBar System


plasmagames

Recommended Posts

OK i'm starting a new project and here's the break down of what it is going to do.

it is supposed to change the navabr alt="blah" text and what image it is and the admin can only have a max of 6 links unless they mod the code themselves. it will be the same structure as the theme system. so here is what i have down to the code so far

 

<?php

/*
iSuS User System Theme Mod
Developed by: plasmagames(http://plasmasteelgames.net)
member of iScripting(http://iscripting.net/smf)
DO NOT REMOVE THIS
*/
//If the form hasn't been submitted, show it!
if (!$_POST['submit'])
{

    echo "<div class=\"reg\"><div class=\"point\"><img src=\"i/to.png\" alt=\"arrow\"><STRONG>Themes<STRONG></div>
<form action='index.php?action=theme' method='POST'>
<p><strong>Theme:</strong><input class=\"field\" type='text' style width='300' height='500' name='theme' /></p>
<input class='submit' type='submit' name='submit' value='Change Theme' />
</form></div> 
<br />
<br />
<br />
<strong>NavBar Settings</strong>
<br />
<br />
<form action='index.php?action=theme' method='POST'>
<p>
<strong>Link 1:</strong><input class=\"field\" type='text' style width='300' height='500' name='link1' />
Path to Image:><input class=\"field\" type='text' style width='300' height='500' name='image1' />

<strong>Link 2:</strong><input class=\"field\" type='text' style width='300' height='500' name='link2' />
Path to Image:><input class=\"field\" type='text' style width='300' height='500' name='image2' />

<strong>Link 3:</strong><input class=\"field\" type='text' style width='300' height='500' name='link3' />
Path to Image:><input class=\"field\" type='text' style width='300' height='500' name='image3' />

<strong>Link 4:</strong><input class=\"field\" type='text' style width='300' height='500' name='link4' />
Path to Image:><input class=\"field\" type='text' style width='300' height='500' name='image4' />

<strong>Link 5:</strong><input class=\"field\" type='text' style width='300' height='500' name='link5' />
Path to Image:><input class=\"field\" type='text' style width='300' height='500' name='image5' />

<strong>Link 6:</strong><input class=\"field\" type='text' style width='300' height='500' name='link6' />
Path to Image:><input class=\"field\" type='text' style width='300' height='500' name='image6' />
</p>
<input class='submit' type='submit' name='submit' value='Change Theme' />
</form>
";
}
else
{
    //Or else it has.. Secure all the inputs
    $theme = secure($_POST['theme']);
$theme = secure($_POST['link1']);
$theme = secure($_POST['image1']);
$theme = secure($_POST['link2']);
$theme = secure($_POST['image2']);
$theme = secure($_POST['link3']);
$theme = secure($_POST['image3']);
$theme = secure($_POST['link4']);
$theme = secure($_POST['image4']);
$theme = secure($_POST['link5']);
$theme = secure($_POST['image5']);
$theme = secure($_POST['link6']);
$theme = secure($_POST['image6']);

    //find the navbar:
    $select = mysql_query("SELECT * FROM navbar WHERE id=1");
    //u need a WHERE clause or it won't work and it has to be valid.
    $row = mysql_fetch_array($select) or die(mysql_error());
    //call it $oldtheme
    $oldtheme = $row['theme'];

    $theme_dir = '/home/a5880517/public_html/isus/theme';


    if(file_exists($theme_dir . "/$oldtheme"))
    {
        //Insert the user information into the database
        $update = "UPDATE theme SET theme = '$theme' WHERE id = 1"; //u need a WHERE clause or it won't work and it has to be valid.
        $rename = rename("$theme_dir/$oldtheme", "$theme_dir/$theme");

        //If the update and rename went ok...
        if (mysql_query($update) && $rename==true)
        {
            //Tell them the good news
            echo "The theme directory was changed to <br /> <strong>$theme</strong><br />";
        }
        else
        {
            echo "Error, the theme directory wasn't changed.";
        }
    }
    else
    {
        echo "The '$oldtheme' does not exist in $theme_dir";
    }
}
?>

 

and this is what i want to make sure i do right

/find the navbar:
    $select = mysql_query("SELECT * FROM navbar WHERE id=1");
    //u need a WHERE clause or it won't work and it has to be valid.
    $row = mysql_fetch_array($select) or die(mysql_error());
    //call it $oldtheme
    $oldtheme = $row['theme'];

    $theme_dir = '/home/a5880517/public_html/isus/theme';


    if(file_exists($theme_dir . "/$oldtheme"))
    {
        //Insert the user information into the database
        $update = "UPDATE theme SET theme = '$theme' WHERE id = 1"; //u need a WHERE clause or it won't work and it has to be valid.
        $rename = rename("$theme_dir/$oldtheme", "$theme_dir/$theme");

        //If the update and rename went ok...
        if (mysql_query($update) && $rename==true)
        {
            //Tell them the good news
            echo "The theme directory was changed to <br /> <strong>$theme</strong><br />";
        }
        else
        {
            echo "Error, the theme directory wasn't changed.";
        }
    }
    else
    {
        echo "The '$oldtheme' does not exist in $theme_dir";
    }
}

 

i i'm not sure what i would have to modify to make this thing work so if you can please post here

Link to comment
https://forums.phpfreaks.com/topic/128115-the-navbar-system/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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