Jump to content

robert_gsfame

Members
  • Posts

    876
  • Joined

  • Last visited

Everything posted by robert_gsfame

  1. disabled can not be inserted into database so i think it's better to use "readonly"; ;D ;D ;D
  2. or just do it with OFFSET which will tell the number of records
  3. Which space I only remove your "., which seems to be incorrect in mysql they always recognize the value inside ' so the correct one is ('yourvalue') so if you put the code like this ('" . $id . "', '" . $sid . "') <===then it will look like ('".yourvalue."') hope could help
  4. if i don't put $disabled then it will return $value which is what i want either although $disabled was written down
  5. <?php $db = sqlite_open('includes/product.db'); function productInsert ($db, $id) { $sid = session_id(); $insert = "INSERT INTO shopping_cart (itemNo, orderNo) VALUES ('$id', ' $sid')"; $result = sqlite_query($data, $insert); } ?> Try code above
  6. i have a form and wish to disable users to change their username if they've posted something on the site let say news still being posted on the screen This is my code in short $array=mysql_fetch_array($mysql); <-- i don't put all code this just the connection of database and get data in array using mysql_fetch_array $value=$array['username'];<--let assume that username is the column name taken from the database $newsstatus=$array['newsstatus'];<--let assume that newsstatus is the column name taken from the database, and what value could be inserted is only yes or no...yes means active while no means no news yet if($newsstatus==yes){ $disable="disabled";}else{ $disable=" ";} <input type = "text" name=textbox1 value=<?php echo $value;?> <?php echo $disable;?> > Then let say once submit then it will update the newsstatus....the problem is that it always return NULL value, what is the problem with echo $disable???
  7. i got what is the source of this problem........what Madtechie has just said was right, i have to restrict 3 types at the same time jpeg, pjpeg and jpg but i still check it....
  8. that code is what i can only at last as several problems occured when i made it more simple so i break it and make more stupid complicated
  9. $limit_size=60000; $filesize1=$HTTP_POST_FILES['ufile']['size'][0]; $filetype1=$HTTP_POST_FILES['ufile']['type'][0]; $filenamexx=$HTTP_POST_FILES['ufile']['name'][0]; $filename1= substr($fileNamex, strrpos($fileNamex, '.') + 1); if(($filesize1 > $limit_size)&&($filetype1=='image/jpeg')&&(!(file_exists("upload/".$filename1)))){ echo "Your file size is over limit, 60 Kb is the max size allowed"; }else if(($filesize1 < $limit_size)&&($filetype1!='image/jpeg')&&(!(file_exists("upload/".$filename1)))){ echo "Image must be in JPEG format";}else if(($filesize1 < $limit_size)&&($filetype1=='image/jpeg')&&(file_exists("upload/".$filename1))){ echo "File is already exists";}else if(($filesize1 > $limit_size)&&($filetype1!='image/jpeg')&&(!(file_exists("upload/".$filename1)))){ echo "Size is over limit, image must be in JPEG format";}else if(($filesize1 < $limit_size)&&($filetype1!='image/jpeg')&&(!(file_exists("upload/".$filename1)))){echo "Image must be in JPEG format, file name already exists";}else if(($filesize1 > $limit_size)&&($filetype1=='image/jpeg')&&(file_exists("upload/".$filename1))){echo "Size is over limit, file name already exists";}else if(($filesize1 > $limit_size)&&($filetype1!='image/jpeg')&&(file_exists("upload/".$filename1))){echo "60 Kb file in JPEG format and name shouldn't be existed";}else{ $path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0]; if( copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1)){ echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>"; }else{ if ($info['upload']!=""){ echo $info['upload']; Which part is wrong please help as all format can be submitted although i have restricted this
  10. yeah i know but it doesn't work in IE and MOZILLA after i put what you've said Mime Type
  11. know what...it makes all of my script messed up now both IE and MOZILLA don't restrict that only jpeg format could be submitted Please help me more
  12. but another problem occured.........how come when i upload the file with psd extention and it still read as jpeg???
  13. hey i've tried yours and it works GREAT...you're such a genius!!!!! can you help me explaining this?? $str = substr($fileName, strrpos($fileName, '.') + 1); what this is for
  14. one more thing...i've tried both with jpg and jpeg, n i got the same feedback....it seems like IE 6.0 cannot read image/jpg and image/jpeg then what should i write then
  15. but it works well without any problems in mozilla............this error only occured in IE 6.0
  16. okay actually i almost solve the problem i try one by one like this $limit_size=60000; $filesize1=$HTTP_POST_FILES['ufile']['size'][0]; $filetype1=$HTTP_POST_FILES['ufile']['type'][0]; $filename1=$HTTP_POST_FILES['ufile']['name'][0]; if(($filesize1 > $limit_size)&&($filetype1=='image/jpeg')&&(!(file_exists("upload/".$filename1)))){ echo "Your file size is over limit, 60 Kb is the max size allowed"; }else if(($filesize1 < $limit_size)&&($filetype1!='image/jpeg')&&(!(file_exists("upload/".$filename1)))){ echo "Image must be in JPEG format";}else if(($filesize1 < $limit_size)&&($filetype1=='image/jpeg')&&(file_exists("upload/".$filename1))){ echo "File is already exists";}else if(($filesize1 > $limit_size)&&($filetype1!='image/jpeg')&&(!(file_exists("upload/".$filename1)))){ echo "Size is over limit, image must be in JPEG format";}else if(($filesize1 < $limit_size)&&($filetype1!='image/jpeg')&&(!(file_exists("upload/".$filename1)))){echo "Image must be in JPEG format, file name already exists";}else if(($filesize1 > $limit_size)&&($filetype1=='image/jpeg')&&(file_exists("upload/".$filename1))){echo "Size is over limit, file name already exists";}else if(($filesize1 > $limit_size)&&($filetype1!='image/jpeg')&&(file_exists("upload/".$filename1))){echo "60 Kb file in JPEG format and name shouldn't be existed";}else{ $path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0]; if( copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1)){ echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>"; }else{ if ($info['upload']!=""){ echo $info['upload']; * But it works correctly in Mozilla but not in IE 6.0 WHAT HAPPENED??? all files which is in JPEG format is counted as another format......PLEASE HELP :'(
  17. let say $uploader is my record retrieved from my table and $filename1 is my HTTP_POST[filename][name] if((!empty($uploader))&&($filename1!=$uploader)){ unlink("folder/".$uploader);} how come it didn't work??
  18. i think the problem is with the file_exists but how to restrict that the file name cannot be the same
  19. yeah thanks i am familiar with fdir.....Just want to make sure whether there is another method of removing uploaded file
  20. see i have my code shown below require_once('config.php'); $query = mysql_query("SELECT * FROM table"); $find = mysql_fetch_array($query); $limit_size=10000; $filesize1=$HTTP_POST_FILES['file']['size']; $filetype1=$HTTP_POST_FILES['type']['type']; $filename1=$HTTP_POST_FILES['file']['name']; if(($filesize1 >= $limit_size)||($filetype1!= 'image/jpeg')||(file_exists("upload/" . $filename1)){ echo "Max 10 Kb in JPG format and must not exists yet"; }else{ $path1= "upload/".$filename1; if(copy($HTTP_POST_FILES['file']['tmp_name'], $path1)){ echo "File Name :".$HTTP_POST_FILES['file']['name']."<BR/>"; }else{ $find=mysql_fetch_array(' if ($find['upload']!=""){ echo $find['upload']; echo "<td><font face=arial size=2><a href=page2.php>delete</a></font></td>"; }else{ echo "<font face=arial size=2>No image uploaded yet!</font>"; } } } } Okay that's it...the problem is that when user has already uploaded their file go to index.php and assume they want to update their image, why the $find['upload'] doesn't appear ?? i get this "Max 10 Kb in JPG format and must not exists yet" some part might be wrong but which one????? thanks a lot in advance
×
×
  • 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.