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