Jump to content

NONAME_2

Members
  • Posts

    39
  • Joined

  • Last visited

About NONAME_2

  • Birthday 08/19/1985

Profile Information

  • Gender
    Male
  • Age
    27

NONAME_2's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi Muddy_Funster, sorry about link, i hope this works for you: http://rooyeshco.ir/adine/test.zip in line 96 and 102{test/report/StatisticallyReport.php}, i use two simple query to get value of rooms was delivered. but my results are different from phpMyAdmin or MySqlBrowser results until i drop and re-built my table(here is => eskan). there is some Insert and Update Codes in other .php file like below: if(isset($_POST["Delivery"])){ $RecID = $_POST["Delivery"]; $mysql->Prepare("SELECT delivery From $t6 WHERE RecID=? and delivery=1"); $res = $mysql->ExecuteStatement(array($RecID)); if($res->rowCount() == 0){ $TodayDate = date("Y/m/d"); $mysql->Prepare("UPDATE $t6 SET delivery=1, DateIn=? WHERE RecID=?"); $res = $mysql->ExecuteStatement(array($TodayDate,$RecID)); $Message = "<font color='green' size=4>Delivered</font>"; $mysql->audit("A Delivery to StudentNum " . $RecID); } else $Message = "<font color='#ff0000'>Already has been Delivered;</font>"; } i'm not persisting on my code, because of Fine works on the other machines and now same problems on the other tables;tnx.
  2. Hi, i upload my files here. main file:test/report/StatisticallyReport.php. by the way, it seem it is not relevanted so much to my code; so these codes works on my virtual machine fine! my db stracture was sent. i'm biginner ,but i guess there is a problem in cache or permission db like this link or this one and etc...-DB- tnx a lot(^!^)
  3. thank you very much
  4. Hello, i have this error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/../session/form/formOne.php on line 26 and this is my code: <?php include("../header.inc.php"); require_once inc_dataAccess; require_once '../classes/public.class.php'; require_once '../classes/FirstInterview.class.php'; $RegID = $_REQUEST["RegID"]; $StNo = $_REQUEST["StNo"]; $query = "SELECT concat(PFName,' ',PLName) as FullName,total_avg(StudentSpecs.StNo) as avg, total_passed_units(StudentSpecs.StNo) as pssunit,StudentSpecs.StNo,BirthLoc,BirthDate,NID,DadName, persons.PersonID,concat(rel," ",subRel) as Religion,MarStatus, Address2,PhoneNo,mobile, PEduSecName,PFldName,ShiftName FROM FirstInterview left join StudentSpecs using(StNo) left join persons on(StudentSpecs.PersonID=persons.PersonID) left join EducationalSections using(EduSecCode) left join StudyFields using(FldCode) left join StudyStatus using(StatusID) left join (select DomainValue,description as Rel from domains where DomainName='RELIGION') tmp1 on(tmp1.DomainValue=persons.Religion) left join (select DomainValue,description as subRel from domains where DomainName='SUB_RELIGION') tmp2 on(tmp2.DomainValue=persons.SubReligion) left join (select DomainValue,description as MarStatus from domains where DomainName='MARITAL_STATUS') tmp3 on (tmp3.DomainValue=persons.MaritalStatus) left join (select DomainValue,description as ShiftName from domains where DomainName='SHIFT') tmp4 on(tmp4.DomainValue=StudentSpecs.shift) where StudentSpecs.StNo =". $StNo ." and FirstInterview.RegID =" . $RegID ; $temp = dataAccess::RUNQUERY($query)->GetRows(); $tbl_content = ""; bytheway, total_passed_units and total_avg are tow routins in mysql; tnx.
  5. hello, i have same prob. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/../form/formOne.php on line 26 <?php include("../header.inc.php"); require_once inc_dataAccess; require_once '../classes/public.class.php'; require_once '../classes/First.class.php'; $RegID = $_REQUEST["RegID"]; $StNo = $_REQUEST["StNo"]; $query = "SELECT concat(PFName,' ',PLName) as FullName,StudentSpecs.StNo,BirthLoc,BirthDate,NID,DadName, persons.PersonID,concat(rel," ",subRel) as Religion,MarStatus, Address2,PhoneNo,mobile, PEduSecName,PFldName,ShiftName FROM FirstInterview left join StudentSpecs using(StNo) left join persons on(StudentSpecs.PersonID=persons.PersonID) left join EducationalSections using(EduSecCode) left join StudyFields using(FldCode) left join StudyStatus using(StatusID) left join (select DomainValue,description as Rel from domains where DomainName='RELIGION') tmp1 on(tmp1.DomainValue=persons.Religion) left join (select DomainValue,description as subRel from domains where DomainName='SUB_RELIGION') tmp2 on(tmp2.DomainValue=persons.SubReligion) left join (select DomainValue,description as MarStatus from domains where DomainName='MARITAL_STATUS') tmp3 on (tmp3.DomainValue=persons.MaritalStatus) left join (select DomainValue,description as ShiftName from domains where DomainName='SHIFT') tmp4 on(tmp4.DomainValue=StudentSpecs.shift) where StudentSpecs.StNo =". $StNo ." and FirstInterview.RegID =" . $RegID ; $temp = dataAccess::RUNQUERY($query)->GetRows(); $tbl_content = ""; there is a place in $query
  6. tnx for your attention. point caller: $mysql = pdodb::getInstance(); sample: $stmt = $mysql->Prepare(CreateSelect());
  7. hi all, i have some tables that users can insert-into-, update-on-,etc-..- them. but if users select from those table,it doesnot show what has modified till i drop and re-build it, so i should restore data with load data; then it works fine. -but when i use for example:MySqlQueryBrowser, with same query that's correct and fine-. i eye for db connection way. but this code on the other server is good. tnx a lot!
  8. Hi , Thanks for Coffee, i had a news with 3 images_PAST_,_NOW_ i like to replace an image with older one ,and i gonna to delete older one('s) depend on its index.
  9. Hi all, i want delete old updated images with considering its index in array. <?php global $oldimg; $oldimg = array(); //action: edit news if (isset($_GET['id'])) { $NewsID = (int)$_GET['id']; if ($NewsID == 0) { $rdir = '<META HTTP-EQUIV="Refresh" CONTENT="1.4;URL=panel-news.php">'; die($rdir);} //get user from the database and put data into $_POST variables. //Include database connection details require_once('../config.php'); //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } $rs = mysql_query("SELECT newsimg1, newsimg2, ". " newsimg3 FROM news WHERE id = $NewsID"); if (mysql_num_rows($rs) == 0) die('no such a newsID!'); $row = mysql_fetch_assoc($rs); $oldimg[0] = $row['newsimg1']; $oldimg[1] = $row['newsimg2']; $oldimg[2] = $row['newsimg3']; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data"> <input type=file name="file[]" size=20 accept="image/jpg,image/jpeg,image/png"> <input type=file name="file[]" size=20 accept="image/jpg,image/jpeg,image/png"> <input type=file name="file[]" size=20 accept="image/jpg,image/jpeg,image/png"> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input type="hidden" name="NewsID" value='<?php echo (isset($NewsID))?$NewsID:"0";?>'> <input type="submit" value="edit" id="save" name="save"/> </form> <?php if (isset($_POST['save']) && isset($_POST['NewsID'])){ $NewsID = (int)$_POST['NewsID']; //Include database connection details require_once('../config.php'); //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //max fle size value $max_file_size = 2097152; //Global newsimg global $newsimg;global $ctr; $ctr = 0; //timestamp to make files unique names $timestamp = time(); //destination folder path $destpath = "../Dir/Newsimg/"; //looping each file or image from the form while(list($key,$value) = @each($_FILES["file"]["name"])) { //check if any empty or errors if(!empty($value)){ if ($_FILES["file"]["error"][$key] > 0) { $edir ='<div id="fail" class="info_div">'; $edir .='<span class="ico_cancel"><strong>'; $edir .="err : ". $_FILES["file"]["error"][$key] .'</strong></span></div>'; echo($edir); } else { //add the timestamp to filename $file_name = $timestamp.$_FILES['file']['name']; //temp name from upload form, key of each is set $source = $_FILES["file"]["tmp_name"][$key] ; //getting the file type $file_type = $_FILES["file"]["type"][$key]; //placing each file name into a variable $filename1 = $_FILES["file"]["name"][$key]; //lowering the file names $filename = strtolower($filename1); //adding timestamp to front of file name $filename = "$timestamp$filename"; ++$timestamp; if ($file_type != "image/jpeg" && $file_type != "image/png" && $file_type != "image/jpg") { die(" <div id='fail' class='info_div'> <span class='ico_cancel'><strong> Invalid Format!</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } //moving the file to be saved from the temp location to the destination path move_uploaded_file($source, $destpath . $filename); //the actual final location with timestamped name $final_file_location = "$destpath$filename"; if (file_exists($final_file_location)) { if (isset($oldimg[$ctr])) { chdir('../Dir/Newsimg/'); echo $oldimg[$ctr]; unlink($oldimg[$ctr]);} $newsimg[$ctr] = $filename; $ctr++; ?> TNX.
  10. Thank you blueskyIS, my solution was in var like $ctr that not initialized.TNX.
  11. it isn't a good idea , any answer freinds?
  12. Hi all, i want upload 3 images .they upload in definded path complete but my first value in array newsimg[0] in insert, is empty: my code: $query = "INSERT INTO news SET postdate=NOW(),". "ttl='$title', newstxt='$description', ". "isprv='$isprv',authr='$login' "; if (isset($newsimg[0])) $query .=",newsimg1='$newsimg[0]'" ; if (isset($newsimg[1])) $query .=",newsimg2='$newsimg[1]'" ; if (isset($newsimg[2])) $query .=",newsimg3='$newsimg[2]'" ; if (mysql_query($query)) { echo "<pre>"; print_r($newsimg); echo "</pre>"; } Sample Result: Array ( [] => 1297148403tulips 04.jpg [1] => 1297148404tulips 03.jpg [2] => 1297148405tulips 02.jpg ) Can i use `0` instead of 0 for my value('s) array. TNX.
  13. I did some changes below:
  14. Hi , i have a form that contains news material ;it has 2 problem: 1- there is a logo image that i wanna to store it as BLOB but it stores an empty 5KByte; i guess i can use fopen,fread. 2- i upload my other 3 image and it uploaded in definded path but in insert: Notice: Undefined offset: 0 in C:\wamp\www Notice: Undefined offset: 1 in C:\wamp\www Notice: Undefined offset: 2 in C:\wamp\www and it doesn't store. All of Above: $query = "INSERT INTO news SET ..". --> if (!empty($_FILES['logo'])) $query .= ", preimage='".$_FILES['logo']."' "; --> if (isset($newsimg[0])) $query .=",newsimg1='$newsimg[0]'" ; --> if (isset($newsimg[1])) $query .=",newsimg2='$newsimg[1]'" ; --> if (isset($newsimg[2])) $query .=",newsimg3='$newsimg[2]'" ; . . --> chdir('../Dir/Newsimg/'); --> if (isset($newsimg[0])) unlink($newsimg[0]); --> if (isset($newsimg[1])) unlink($newsimg[1]); --> if (isset($newsimg[2])) unlink($newsimg[2]); My Form: <div id="postedit" class="clearfix"> <h2 class="ico_mug">ADD NEWS</h2> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data"> <div> <input id="post_title" type="text" size="30" tabindex="1" name="post_title" value="Title" /> </div> <div id="form_middle_cont" class="clearfix"> <div class="left"> <textarea id="markItUp" cols="80" rows="10" tabindex="2" name="markItUp"></textarea> </div> <div class="left form_sidebar"> <h3>Is A Member?</h3> <ul> <li> <label><input type="checkbox" class="noborder" name="chbox" />Yes</label></li> </ul><BR/> <ul> <h4>News Pictures:</h4> <li><input type=file name="logo" size=20 accept="image/png"> </li> <li><input type=file name="file[]" size=20 accept="image/jpg,image/jpeg,image/png"> </li> <li><input type=file name="file[]" size=20 accept="image/jpg,image/jpeg,image/png"> </li> <li><input type=file name="file[]" size=20 accept="image/jpg,image/jpeg,image/png"> </li> </ul> <p> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> <input type="submit" value="Store" id="save" name="save"/> </p> </div> </div> </form> <?php if (isset($_POST['save'])) { //Check that we have a logo file if((!empty($_FILES["logo"])) && ($_FILES['logo']['error'] == 0)) { //Check if the file is JPEG or PNG image and it's size is less than 5Kb $filename = basename($_FILES['logo']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); $extnm = $_FILES["logo"]["type"]; $extsiz = $_FILES["logo"]["size"]; $src = $_FILES["logo"]["tmp_name"]; $lgdim = GetImageSize($src); if (!($ext == "png" && $extnm == "image/png")) { die(" <div id='fail' class='info_div' align='center' dir='rtl'> <span class='ico_cancel'><strong> Just PNG</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } if ($extsiz > 5120 ) { die(" <div id='fail' class='info_div' align='center' dir='rtl'> <span class='ico_cancel'><strong> Size less than 5KByte </strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } if ($lgdim[0] != 103 || $lgdim[1] != 103 ) { die(" <div id='fail' class='info_div' align='center' dir='rtl'> <span class='ico_cancel'><strong> 103*103 Pixel </strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); }} $title = mysql_real_escape_string(trim($_POST["post_title"])); if ($title == '' || $title == 'Title'){ die(" <div id='fail' class='info_div' align='center' dir='rtl'> <span class='ico_cancel'><strong> Insert Title,Please</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } $description = ( mysql_real_escape_string(trim($_POST["markItUp"]))); if ($description == ''){ die(" <div id='fail' class='info_div' align='center' dir='rtl'> <span class='ico_cancel'><strong> Insert News_body,Please</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } if (isset($_POST['chbox'])) $isprv = 'true'; else $isprv = 'false'; //max fle size value $max_file_size = 2097152; //Global newsimg global $newsimg;global $ctr; //timestamp to make files unique names $timestamp = time(); //destination folder path $destpath = "../Dir/Newsimg/"; //looping each file or image from the form while(list($key,$value) = @each($_FILES["file"]["name"])) { //check if any empty or errors if(!empty($value)){ if ($_FILES["file"]["error"][$key] > 0) { $edir ='<div id="fail" class="info_div">'; $edir .='<span class="ico_cancel"><strong>'; $edir .="ERR : ". $_FILES["file"]["error"][$key] .'</strong></span></div>'; echo($edir); } else { //add the timestamp to filename $file_name = $timestamp.$_FILES['file']['name']; //temp name from upload form, key of each is set $source = $_FILES["file"]["tmp_name"][$key] ; //getting the file type $file_type = $_FILES["file"]["type"][$key]; //getting the file size $file_size = $_FILES["file"]["size"][$key]; //getting the file width $file_width = GetImageSize($source); //placing each file name into a variable $filename1 = $_FILES["file"]["name"][$key]; //lowering the file names $filename = strtolower($filename1); //adding timestamp to front of file name $filename = "$timestamp$filename"; ++$timestamp; if ($file_type != "image/jpeg" && $file_type != "image/png" && $file_type != "image/jpg") { die(" <div id='fail' class='info_div'> <span class='ico_cancel'><strong> Invalid Format</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } if($file_width[0] > 650) { die(" <div id='fail' class='info_div'> <span class='ico_cancel'><strong> Width less than 650 Pixel!</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } if($file_size > 51200) { die(" <div id='fail' class='info_div'> <span class='ico_cancel'><strong> Size less than 50KByte!</strong></span><br /> <a href=\"javascript: history.go(-1)\">Retry</a> </div>"); } //moving the file to be saved from the temp location to the destination path move_uploaded_file($source, $destpath . $filename); //the actual final location with timestamped name $final_file_location = "$destpath$filename"; //echo $final_file_location."<br />"; if (file_exists($final_file_location)) { $newsimg[$ctr] = $filename; $ctr++; ?> <div id="success" class="info_div"><span class="ico_success"><strong> <a href="<?php echo $final_file_location; ?>" target="_blank"><?php echo $filename; ?></a> </strong></span></div><br /> <?php }}}} $ctr=0; //Include database connection details require_once('../config.php'); //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } $login = $_SESSION['SESS_LOG_IN']; $query = "INSERT INTO news SET postdate=NOW(),". "ttl='$title', newstxt='$description', ". "isprv='$isprv',authr='$login' "; if (!empty($_FILES['logo'])) $query .= ", preimage='".$_FILES['logo']."' "; if (isset($newsimg[0])) $query .=",newsimg1='$newsimg[0]'" ; if (isset($newsimg[1])) $query .=",newsimg2='$newsimg[1]'" ; if (isset($newsimg[2])) $query .=",newsimg3='$newsimg[2]'" ; if (mysql_query($query)) { echo '<div id="success" class="info_div">'; echo'<span class="ico_success"><strong>'; echo 'SuccessFul! </strong></span></div>'; } else { echo'<div id="warning" class="info_div">'; echo'<span class="ico_error"><strong>'; echo "ERR in Insert NEWS : ".mysql_error()."</strong></span></div>"; chdir('../Dir/Newsimg/'); if (isset($newsimg[0])) unlink($newsimg[0]); if (isset($newsimg[1])) unlink($newsimg[1]); if (isset($newsimg[2])) unlink($newsimg[2]); } } ?> </div><!-- end #postedit --> TNX.
×
×
  • 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.