Jump to content

Recommended Posts

I am trying to create an admin..

 

I have already my tables and backend working but i need to make a php admin like apanel so i can easily add and edit text without going to phpmyadmin to do it everytime.

 

Can anyone help me? Wil i need to show some code here of how my tables are in MYSQL or PHP Docs?

Link to comment
https://forums.phpfreaks.com/topic/52929-help-with-admin-phpmysql/
Share on other sites

certainly set yourself an interesting task  ;D

 

go here http://wiz.homelinux.net/php.php and download Wiz MySQL Admin , and have a look at the coding of it, its similar to PHPmyAdmin but with less files, and I personally think it is better. you could do alot of copy and pasting from it for your admin control panel. That should be a nice head start for you.

 

Regards ACE

No, I want to stick with phpadmin, but what i want is to design or code an admin so the client can log in and add and edit as they wish..

 

What will I need to add to this code to have 3 categories which sit as tables in phpadmin? At the monet the code i have created only displays the edit option.

 

1. News (contain : date, title and description)

2. Events (contain : date, title , description and images)

3. Information (contain : date, title and description)

 

<?php

session_start();

?>

<html>



<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>News System - Edit News</title>

<style type="text/css">

<!--

select, textarea, input {

border: #808080 1px solid;

color: #000000;

font-size: 11px;

font-family: Verdana; BACKGROUND-COLOR: #ffffff }



input[type=submit]:hover, input[type=button]:hover{

background-color:#EBEBEB !important;

}



a:active,a:visited,a:link {color: #446488; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}

a:hover {color: #00004F; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; }



a.nav { padding-top:10px; padding-bottom:10px; padding:9px;}

a.nav:active, a.nav:visited,  a.nav:link { color: #000000; font-size : 10px; font-weight: bold; font-family: verdana; text-decoration: none;}

a.nav:hover { font-size : 10px; font-weight: bold; color: black; font-family: verdana; text-decoration: underline; }



.header { font-size : 16px; font-weight: bold; color: #808080; font-family: verdana; text-decoration: none;  }

.bborder        { background-color: #FFFFFF; border: 1px #A7A6B4 solid; }

.panel                {-moz-border-radius: .3em .3em .3em .3em; border: 1px solid silver; background-color: #F7F6F4;}



BODY, TD, TR {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; cursor: default;}

-->

</style>

</head>



<body>

<?php

$admin_username = "admin";

$admin_password = "password";



$act = $_GET['act'];

if ($act == "logout") {

session_destroy();

    echo "You have successfully logout";

    exit();

    }



if ($_SESSION['login'] != "" || $_SESSION['loginpass'] != "") {

$already_login = "TRUE";

    }

if ($already_login == "TRUE") {

} else {

if (!isset($_POST['login_box'])) {

?>



   <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

    <div>

      Username:   <input type="text" name="username" value="" style="width:120px; height:18px; font-family:Tahoma; font-size:11px "><br>

      Password:   <input type="password" name="password" value="" style="width:120px; height:18px; font-family:Tahoma; font-size:11px "><br>

      <input type="submit" name="login_box" value="Submit">

    </div>

   </form>



<?php

} else {

$username = $_POST['username'];

    $password = $_POST['password'];

    	if ($username == "" || $password == "") {

        	echo "Please fill up the blank.";

            } elseif ($username != $admin_username || md5($password) != md5($admin_password)) {

            	echo "Sorry, you don't have the privileges to access.";

                } else {

                	// Save them in session

                    $_SESSION['loginid'] = $username;

                    $_SESSION['loginpass'] = md5($password);

                    echo "Permission granted.";

                    echo "<META HTTP-EQUIV='Refresh' CONTENT='1'>";

                    }

  }

  	}

    ?>



<?php

    	if ($already_login != "TRUE") {

        exit();

        }

    require_once('config.php');

    if ($_GET['id'] != "") {

    $id = $_GET['id'];

    $query = "SELECT * FROM news WHERE id ='$id'";

    $result = mysql_query($query) or die("There's some problem editing the news, please report it to $support_email");

    $row = mysql_fetch_assoc($result);



    if (!$row) {

    	echo "The news doesn't exists.";

        exit();

        }



    if (!isset($_POST['submit'])) {

    ?>

        <form action="<?php echo $_SERVER['PHP_SELF'] . "?id=$id"; ?>" method="post">

        <table border=0 cellpading=0 cellspacing=0 width="654" >



    <tr>

        <td width="75">

        Title

        <td width="575" colspan="2">

        <input type=text size="55" name="title" value="<?php echo $row['title']; ?>">



        </tr>

    <tr>

    <tr>

        <td width="75">

        Date

        <td width="575" colspan="2">

        <input type=text size="55" name="date" value="<?php echo $row['date']; ?>">



        </tr>

    <tr>

        <td width="75" valign="top">

        <br />Content

        <td>

     <textarea rows="12" cols="74" id="content" name="content"><?php echo $row['content']; ?></textarea>



        <td width="108" valign="top">

        <p align="center"><br />

        <a href="add.php?act=help" target="_blank">[README]</a><br>

        <a href="?act=logout">[Logout]</a>

    </tr>



        </table>

        <table border=0 cellpading=0 cellspacing=0 width="654" >



        <tr>

        <td width="75">



        <td>



     <table border=0 cellspacing=0 cellpadding=0 width=100%>



      <tr>

       <td width=50%>

        <input type=submit style='font-weight:bold' title="Edit the New Article" value="Edit News" name="submit">

       </td>

       <td width=50% align=right> 

        

       </td>

      </tr>



    </table>



        </tr>



        </table>

        </form>

        <?php

        } else {

        $title = $_POST['title'];

        $content = $_POST['content'];

        $date = $_POST['date'];



        	if ($title == "" || $content == "") {

            	echo "Please fill up all the blanks.";

                } else {

                	mysql_query("UPDATE `news` SET title='$title', date='$date', content='$content' WHERE id='$id'") or die ("There's some problem editing this news, please report it to $support_name.");

                    echo "You have successfully edited your news.";

                    }

        }

    }

        ?>



</body>



</html>

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.