コード例 #1
0
function addData($name, $code, $price, $description)
{
    //print "Ready to add data";
    include "dbinfo.php";
    $picture = checkPicture();
    $sql = "INSERT INTO product2 VALUES (null,'7','{$picture}','{$name}','{$code}','{$price}','{$description}')";
    $result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
    if (true === $result) {
        printf("no error: %s\n", mysqli_error($conn));
    } else {
        echo 'done.';
    }
    include "header.php";
    print <<<HERE
\t\t\t<br><br><br><br><br>
\t<h1>The following has been added:</h1>
\t<ul>
\t<li>Picture: <img src='images/Accessories/{$picture}' /></li>
\t<li>Type: 7</li>
\t<li>Name: {$name}</li>
\t<li>Code: {$code}</li>
\t<li>Price: {$price}</li>
\t<li>Description: {$description}</li>
\t</ul>
HERE;
}
コード例 #2
0
function addData($type, $id)
{
    include "dbinfo.php";
    $picture = checkPicture();
    $sql = "INSERT INTO product3 VALUES ('{$type}','{$id}','{$picture}')";
    $result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
    if (true === $result) {
        printf("no error: %s\n", mysqli_error($conn));
    } else {
        echo 'done.';
    }
    include "header.php";
    print <<<HERE
\t\t<br><br><br><br><br>
\t<h1>The following has been added:</h1>
\t<ul>
\t<li>Picture: <img src='images/MakeupBrush/more/{$picture}' /></li>
\t\t<li>Type: {$type}</li>
\t\t<li>ID: {$id}</li>
\t</ul>
HERE;
}
コード例 #3
0
ファイル: admin.php プロジェクト: kktsvetkov/1double.com
function insertArticle()
{
    global $tbl_1d_article, $tbl_1d_pictures;
    global $SUBS, $PARAM, $MSG;
    global $SNIMKA, $SNIMKA_name;
    //file upload
    global $PHOTOS, $adminID;
    //from session
    if ($PARAM['Add'] == 1) {
        $SUBS['ID'] = $PARAM['ID'];
        //da ze zapische, ako e podadeno
        $SUBS['ERROR'] = '';
        if ($PARAM['SECTION'] == '0') {
            $SUBS['ERROR'] = $MSG[20070];
        } else {
            $SUBS['SECTION' . strToUpper($PARAM['SECTION'])] = ' SELECTED';
        }
        if ($PARAM['TITLE'] != '') {
            //zaglavie
            $SUBS['TITLE'] = htmlEncode($PARAM['TITLE']);
        } else {
            $SUBS['ERROR'] = $MSG[20069];
        }
        if ($PARAM['INFO'] != '') {
            $SUBS['INFO'] = htmlEncode($PARAM['INFO']);
        } else {
            if ($SUBS['ERROR'] == '') {
                $SUBS['ERROR'] = $MSG[20071];
            }
        }
        if ($SUBS['ERROR'] == '') {
            //wsichko e ok, zapiswane w DB
            if ($PARAM['ID'] != '') {
                $query = "UPDATE {$tbl_1d_article} SET\n\t\t\t\t\tTitle = " . dbQuote($PARAM['TITLE']) . ",\n\t\t\t\t\tCaption = " . dbQuote($PARAM['INFO']) . ",\n\t\t\t\t\ttsLast = " . dbQuote(time()) . "\n\t\t\t\t\tWHERE ID=" . $PARAM['ID'];
            } else {
                $query = "INSERT INTO {$tbl_1d_article}\n\t\t\t\t(Title, Caption, tsLast, tsWhen, adminID)\n\t\t\t\tVALUES\n\t\t\t\t(" . dbQuote($PARAM['TITLE']) . ",\n\t\t\t\t" . dbQuote($PARAM['INFO']) . ",\n\t\t\t\t" . dbQuote(time()) . ", " . dbQuote(getNextWeek()) . ", {$adminID} )";
            }
            $result = runQuery($query, 'insertArticle()', 'ADD_TEXT_ARTILE_INFO');
            if ($PARAM['ID'] == '') {
                $PARAM['ID'] = mysql_insert_id();
                //zaradi snimkite ot PHOTOs
                if (session_is_registered('PHOTOS') && is_array($PHOTOS)) {
                    for ($i = 0; $i < count($PHOTOS[session_id()]); $i++) {
                        if ($INFO = checkPicture($PHOTOS[session_id()][$i])) {
                            fixPicture($PHOTOS[session_id()][$i], 'article', $PARAM['ID'], $INFO);
                        }
                    }
                }
                unset($PHOTOS[session_id()]);
            }
            //prezarejdane
            if ($PARAM['Photo'] != 1) {
                $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20018&ID=" . $PARAM['ID'];
                printPage('_admin_done.htmlt');
                return;
            }
        } else {
            $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
        }
    }
    if ($PARAM['Photo'] == 1) {
        //dobawi snimka
        if (!session_is_registered('PHOTOS')) {
            //izpolzwa se ako nyama oschte registrirano ID
            session_register('PHOTOS');
            $PHOTOS = array();
        }
        $SUBS['ERROR'] = '';
        if ($SNIMKA == 'none') {
            $SUBS['ERROR'] = $MSG[20019];
        }
        if (!($INFO = checkPicture($SNIMKA))) {
            //pass INFO as parameter to fixPicture
            $SUBS['ERROR'] = $MSG[20020];
        }
        if ($SUBS['ERROR'] != '') {
            $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
        } else {
            //do tha job
            if ($PARAM['ID'] == '') {
                $where = getAdmSetting('TEMPORARY_DIR') . session_id() . md5($INFO[0] + $INFO[1]) . $SNIMKA_name;
                if (@copy($SNIMKA, $where)) {
                    if (!@in_array($where, $PHOTOS[session_id()])) {
                        if (!is_array($PHOTOS[session_id()])) {
                            $PHOTOS[session_id()] = array();
                        }
                        $PHOTOS[session_id()][] = $where;
                    }
                } else {
                    setLogAndStatus("Writing", $SNIMKA, 0, "insertArticle()", 'WRITE_SESSION_PICS');
                }
            } else {
                fixPicture($SNIMKA, 'article', $PARAM['ID'], $INFO);
                //prezarejdane
                $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20022&ID=" . $PARAM['ID'];
                printPage('_admin_done.htmlt');
                return;
            }
        }
    }
    if ($PARAM['Delete'] != '') {
        //iztrij snimka
        if ($PARAM['ID'] != '') {
            //get thumbnail
            $query = "SELECT\tURL, ID\n\t\t\t\tFROM {$tbl_1d_pictures}\n\t\t\t\tWHERE RefID = " . dbQuote($PARAM['Delete']) . "\n\t\t\t\t\tAND RefType= 'thumb' ";
            $result = runQuery($query, 'insetFilm()', 'GET_THUMBS');
            if ($row = db_fetch_row($result)) {
                if (!@unlink(getAdmSetting('UPLOAD_DIR') . $row[0])) {
                    setLogAndStatus("Erasing", getAdmSetting('UPLOAD_DIR') . $row[0], 0, "insertArticle()", 'DEL_THUMBS');
                }
                //erase thumbnail
                $query = "DELETE FROM {$tbl_1d_pictures}\n\t\t\t\t\tWHERE ID = {$row['1']}";
                $result = runQuery($query, 'insertArticle()', 'DEL_THUMBS_DB');
            }
            $query = "SELECT\tURL, ID\n\t\t\t\tFROM {$tbl_1d_pictures}\n\t\t\t\tWHERE ID = " . dbQuote($PARAM['Delete']);
            $result = runQuery($query, 'insertArticle()', 'GET_PIC');
            if ($row = db_fetch_row($result)) {
                if (!@unlink(getAdmSetting('UPLOAD_DIR') . $row[0])) {
                    setLogAndStatus("Erasing", getAdmSetting('UPLOAD_DIR') . $row[0], 0, "insertArticle()", 'DEL_PICS');
                }
                //erase pic
                $query = "DELETE FROM {$tbl_1d_pictures}\n\t\t\t\t\tWHERE ID = {$row['1']}";
                $result = runQuery($query, 'insertArticle()', 'DEL_PICS');
            }
        } else {
            if (!@unlink(getAdmSetting('UPLOAD_DIR') . $PHOTOS[session_id()][$PARAM['Delete']])) {
                //from session
                setLogAndStatus("Erasing", getAdmSetting('UPLOAD_DIR') . $PHOTOS[session_id()][$PARAM['Delete']], 0, "insertArticle()", 'DEL_SESSIONS');
            }
            unset($PHOTOS[session_id()][$PARAM['Delete']]);
        }
    }
    //display
    $SUBS['SECTION' . strToUpper($PARAM['w'])] = ' SELECTED';
    if ($PARAM['Add'] != 1) {
        //podgotowka za pokazwane
        $query = "SELECT\tTitle,\n\t\t\t\tType,\n\t\t\t\tCaption\n\t\t\tFROM {$tbl_1d_article}\n\t\t\tWHERE ID = " . dbQuote($PARAM['ID']);
        $result = runQuery($query, 'insertArticle()', 'GET_TEXT_ARTICLE_INFO');
        if ($row = db_fetch_row($result)) {
            $SUBS['TITLE'] = htmlEncode($row[0]);
            $SUBS['SECTION' . strToUpper($row[1])] = ' SELECTED';
            $SUBS['INFO'] = htmlEncode($row[2]);
        } else {
            if ($PARAM['ID'] != '' && $SUBS['ERROR'] == '') {
                $SUBS['ERROR'] = $MSG[20081];
                $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
            }
            $PARAM['ID'] = '';
        }
    }
    //pokaji snimkite
    if ($PARAM['ID'] == '') {
        for ($i = 0; $i < count($PHOTOS[session_id()]); $i++) {
            $SUBS['URL'] = $PHOTOS[session_id()][$i];
            $SUBS['IND'] = $i;
            $SUBS['THUMB'] = " &nbsp; " . $MSG[20024] . " " . ($i + 1);
            $SUBS['SNIMKAS'] .= fileParse('_admin_edit_film_snimka.htmlt');
        }
    } else {
        $query = "SELECT\tURL,\n\t\t\t\tWidth,\n\t\t\t\tHeight,\n\t\t\t\tID\n\t\t\tFROM {$tbl_1d_pictures}\n\t\t\tWHERE (RefID LIKE " . dbQuote($PARAM['ID']) . ")\n\t\t\t\tAND RefType = 'article' ";
        $result = runQuery($query, 'insertArticle()', 'GET_PICS_ARTICLE_INFO');
        $upload = getAdmSetting('UPLOAD_DIR');
        $SUBS['UPLOAD'] = $upload;
        while ($row = db_fetch_row($result)) {
            $query = "SELECT\tURL,\n\t\t\t\t\tWidth,\n\t\t\t\t\tHeight\n\t\t\t\tFROM {$tbl_1d_pictures}\n\t\t\t\tWHERE (RefID = {$row['3']}) AND RefType = 'thumb' ";
            $res = runQuery($query, 'insertArtcile()', 'GET_ARTICLE_THUMB');
            $thumb = db_fetch_row($res);
            $SUBS['URL'] = $row[0];
            $SUBS['IND'] = $row[3];
            $SUBS['THUMB'] = "<img border=\"0\" width=\"{$thumb['1']}\" height=\"{$thumb['2']}\" src=\"{$upload}{$thumb['0']}\">";
            $SUBS['SNIMKAS'] .= fileParse('_admin_edit_article_snimka.htmlt');
        }
    }
    ////----[Mrasnika's] Edition 13.10.2002
    $SUBS['FILM_NAV'] = fileParse('_admin_edit_article2.htmlt');
    $SUBS['ID'] = $PARAM['ID'];
    if ($PARAM['err'] != '' && $SUBS['ERROR'] == '') {
        $SUBS['ERROR'] = $MSG[$PARAM['err']];
        $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
    }
    printPage('_admin_edit_article.htmlt');
}
コード例 #4
0
" alt="shop" width="178" height="209" border="0" alt="" class="gap2"/>
	       		<?php 
        }
        ?>
		    </div>
		    <!-- ================== END OF PIC USER ================== -->
		    
		    <!-- ================== PIC STUFF ================== -->
		    <div class="pict-zhouts">
		    	<?php 
        if ($row_zhout->barang) {
            if ($stuff_pic[$row_zhout->barang] != false) {
                foreach ($stuff_pic[$row_zhout->barang] as $key => $stuff_zhout) {
                    ?>
					   		<img src="<?php 
                    echo checkPicture(base_url() . 'assets/zhopie/userfiles/' . $row_zhout->id_member . '/zhops/' . $row_zhout->zhopie_shop . '/stuff/' . $row_zhout->barang . '/primary/' . $stuff_zhout);
                    ?>
">
				<?php 
                }
            }
        }
        ?>
		    </div>
		    <!-- ================== END OF PIC STUFF ================== -->
		    
		    <div class="desc-zhout">
		    	<!-- ================== NAME ================== -->
		        <a href="#">
		        	<?php 
        $name = "";
コード例 #5
0
            default:
                print "A system error occurred.";
                break;
        }
        print "</strong></p>";
    }
    return $picture;
}
require "admin_login.php";
include "dbinfo.php";
if (isset($_POST['submit'])) {
    $id = $_POST['id'];
    $name = $_POST['name'];
    $code = $_POST['code'];
    $price = $_POST['price'];
    $description = $_POST['description'];
    $picture = checkPicture();
    $sql = "UPDATE product2 SET\nPicture='{$picture}',\nName='{$name}',\nCode='{$code}',\nPrice='{$price}',\nDescription='{$description}'\nwhere id='{$id}'";
    $result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
    print "<br/><br/><br/><br/>";
    print "<html><head><title>Update Results</title></head><body>";
    include "header.php";
    print <<<HERE
<h1>The new record looks like this: </h1>
Picture: <img src='images/{$product}/{$picture}' /><br/>
<p><strong>Name:</strong>{$name}</p>
<p><strong>Code:</strong>{$code}</p>
<p><strong>Price:</strong>{$price}</p>
<p><strong>Description:</strong>{$description}</p>
HERE;
}
コード例 #6
0
        <div class="comment_product_wrap">
        	<div class="pict_comment">
			<?php 
        if ($commentpict[$row->id_member] != false) {
            foreach ($commentpict[$row->id_member] as $key => $row_pic) {
                ?>
	           			<img src="<?php 
                echo checkPicture(base_url() . 'assets/zhopie/userfiles/' . $row->id_member . '/profile_picture/' . $row_pic);
                ?>
">
	        <?php 
            }
        } else {
            ?>
	       	  		<img src="<?php 
            echo checkPicture(null);
            ?>
" alt="friend" />
	       	<?php 
        }
        ?>
	
            </div>
            <div class="desc_comment">
                <h2><?php 
        echo $row->first_name;
        ?>
&nbsp;<?php 
        echo $row->last_name;
        ?>
</h2>
コード例 #7
0
ファイル: zhout_lib.php プロジェクト: rustama1211/zhout
 /** Show zhout with single zhout posting
  * @param int $_id_zhout
  * @return object html
  * Description : Only return view zhout posting
  */
 function get_post_zhout($_id_zhout)
 {
     $_data_zhout = $this->CI->model_zhout->get_zhout_by_id_zhout($_id_zhout);
     //image must set with directory helper;
     $_image_profile = directory_map(getcwd() . '/assets/zhopie/userfiles/' . $_data_zhout['id_member'] . '/profile_picture');
     $_image_url['profil_picture_url'] = checkPicture($_out = count($_image_profile) == 1 ? base_url() . '/assets/zhopie/userfiles/' . $_data_zhout['id_member'] . '/profile_picture/' . $_image_profile[0] : 'NULL');
     $_data_inserted = array_merge($_data_zhout, $_image_url);
     //set appropriate attribute
     $_data_inserted['_comment_button'] = call_user_func(array($this, 'get_attribute_by_type'), 'comment_status', $_data_zhout['id_member'], FALSE, $_data_zhout['id_zhout'], array(), NULL);
     return $this->CI->load->view('zhout/zhout_post_single', $_data_inserted, TRUE);
 }
コード例 #8
0
                $_timespent = $hours . " hours ago";
            } elseif ($days == 0 && $hours == 0 && $minutes > 0) {
                $_timespent = $minutes . ' minutes ago';
            } else {
                $_timespent = "few seconds ago";
            }
            //End Process Time Spent
            ?>
                 <div class="people_comment">
                    <div class="pict_people">
                    	<?php 
            //GET default image profile
            $_image_name = directory_map(getcwd() . '/assets/zhopie/userfiles/' . $_comment_value['id_member'] . '/profile_picture');
            ?>
                        <img src="<?php 
            echo checkPicture(isset($_image_name[0]) ? base_url() . '/assets/zhopie/userfiles/' . $_comment_value['id_member'] . '/profile_picture/' . $_image_name[0] : 'NULL');
            ?>
">
                    </div>
                    <div class="desc_people">
                        <h2><?php 
            echo $_comment_value['first_name'] . ' ' . $_comment_value['middle_name'] . ' ' . $_comment_value['last_name'];
            ?>
</h2>
                        <p><?php 
            echo $_comment_value['comment_content'];
            ?>
</p>
                        <p><?php 
            echo $_timespent;
            ?>