add.php 4.49 KB
Newer Older
majidbeigi's avatar
majidbeigi committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
<?php

	include_once('../../library/config.php');

    $logadmin = new ADMIN();

    if(!$logadmin->logincheck()){

        header('location:../../adminn/login/');

    }

    $err = null;

    if(isset($_POST['addbrand']))

    {

        $namef = $_POST['namef'];
        $namee = $_POST['namee'];
        $code = $_POST['code'];
        $price = $_POST['price'];
        $description = $_POST['description'];
        
        $tmp = new PRODUCT();

        if($tmp->addbrand($namef,$namee,$code,$price,$description))
        {
            $db = new DB();
            $db->connect();
            $where = "code='$code'";
            $res = $db->select("brand",$where);
            $id = $res[0]['id_brand'];
            header('location:../brand/edit.php?id='.$id);
        }
        else
        {
            $err = $tmp->error;
        }

        

    }

?>

<!DOCTYPE html>

<html>

<head>
        <?php
            include_once($_SERVER['DOCUMENT_ROOT'].SITE.'/library/head.php');               
        ?>
        <script type="text/javascript" src="js/jscripts/tiny_mce/tiny_mce.js"></script>

        <script>

        tinyMCE.init({
		// General options
                        language: 'fa',
                		mode : "exact",
                        elements : "description" ,
                		theme : "advanced",
                        forced_root_block : false,
                        directionality : "rtl",
                        height : 220,
    		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",

    		// Theme options
    		theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,|,tablecontrols",
    		theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,code,|,preview,|,forecolor,backcolor,hr,|,sub,sup,|,charmap,emotions,|,ltr,rtl",
	        theme_advanced_resizing : false,
            theme_advanced_font_sizes: "10px,12px,13px,14px,16px,18px,20px",
            font_size_style_values: "12px,13px,14px,16px,18px,20px",
       });
        </script>
</head>

<body>

<!-- Base Table -->

<table class="body" cellspacing="0" cellpadding="0" align="center">

    <!-- Head -->

    <?php

        include($_SERVER['DOCUMENT_ROOT'].SITE.'/library/header.php');

    ?>

<tr>

    <!-- Main -->

    <td align="center" >

    <div dir="rtl" id="main" align="center" class="ui-corner-all , ui-widget-content">

        <div align="left" style="padding: 5px;"> <a href="login/logout.php"> LOGOUT </a> </div>

        <?php

            echo $_SESSION['admin_name'];

        ?>

        پنل مدیریت آپشن استاندارد

        <hr />

    <!-- Top Menu -->

    <?php

        include($_SERVER['DOCUMENT_ROOT'].SITE.'/adminn/library/topmenu.php');

    ?>

    <div align="right">
    <form method="post" action="">
    <h2 style="font-weight: normal;margin-left: 20px;font-size: 17px;">
    فرم ایجاد آپشن استاندارد
    </h2>
    <table>
        <tr>
            <td style="width: 100px;">نام فارسی : </td><td><input type="text" name="namef" style="width: 300px;" />  </td>
        </tr>
        <tr>
            <td>نام انگلیسی : </td><td><input type="text" name="namee" style="width: 300px;" />  </td>
        </tr>
        <tr>
            <td>کد : </td><td><input type="text" name="code"  style="width: 170px;" /></td>
        </tr>
        <tr>
            <td>قیمت : </td><td><input type="text" name="price"  style="width: 170px;" /></td>
        </tr>
        <tr> 
            <td colspan="2">توضیحات :<br /><textarea name="description"></textarea></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="ثبت" name="addbrand" /></td></td>
        </tr>
    </table>
        
    </form>
    <?php
        if($err)
        {
            echo $err;
        }
    ?>
    </div>

    <div dir="ltr" class="holder"></div>

    </div>

    </td>

</tr>

<!-- Footer -->

        <?php

            include($_SERVER['DOCUMENT_ROOT'].SITE.'/library/footer.php');

        ?>

</table>

</body>

</html>