Jump to content

Matpatnik

Members
  • Posts

    227
  • Joined

  • Last visited

Everything posted by Matpatnik

  1. Hi guys I got this error now: I think I know where the error come from, it's the (../) which it doesn't like. How do you set the path to go out of the folder?Like when you are in mysite.com/images/something/here.php and want to go back to mysite.com/.In html it's easy it's just ../ to go back to the root folder but how is it done with php (if it's the error)
  2. Matpatnik

    calcul error

    I do the same but I only do that for variable and function that might be reused in other page. All other variable and function stay in there own page.I'm still looking on how to set the structure of the site and I'm getting closer every time
  3. Matpatnik

    calcul error

    true it's define just after the validation, is there a way to bypass this or I will have to write the function that define the $a_maxsize in every page? because in that function $a_maxsize is a global variable.edited: I changed where the function was called and it seems to be ok now.Thank you
  4. Matpatnik

    calcul error

    You probably mean this: echo "<pre>";echo $i_size . "\n";var_dump($i_size);echo "\n" . $a_maxsize . "\n";var_dump($a_maxsize);echo "</pre>"; I figured that you did it very quickly :)there is the result Why $a_maxsize doesn't appear in the if statement and appear few line after?
  5. Matpatnik

    calcul error

    here this is from the server: $i_temp = $_FILES['image_filename']['name'];$i_size = round($_FILES['image_filename']['size'] / 1024); // make sure no one upload over the maximum sizeif (floatval($i_size) > floatval($a_maxsize)) { include "include/header.php"; echo "The " . $i_temp . " size is " . $i_size . " kb but the maximum upload size is " . $a_maxsize ." kb.<br>" . "Your image is too big by " . ($i_size - $a_maxsize) . " kb. Please reduce the size of that image and try again."; getfooter($connect);} else { It's the first statement after the users validation
  6. Matpatnik

    calcul error

    It doesn't do anthing special only the same message:
  7. Matpatnik

    calcul error

    now that's weird with this code: // make sure no one upload over the maximum sizeif ($i_size > $a_maxsize) { include "include/header.php"; echo "The " . $i_temp . " size is " . $i_size . " kb but the maximum upload size is " . $a_maxsize ." kb.<br>" . "Your image is too big by " . ($i_size - $a_maxsize) . " kb. Please reduce the size of that image and try again."; getfooter($ect); I got this output! I don't know what to think about this because it does the calculation now but doesn't respect the if statement!Both variable in the if statement are fine and work properly as it show in the output but it's not supose to echo that because it's smaller so it should skip that part. I don't know if the fact that $a_maxsize is comming from the database change something?Out of subject I got this error very often went going on your site
  8. Matpatnik

    calcul error

    it work fine I forget to change a variable :oops:
  9. I use this to redirect user header("Refresh: 5; URL=your_url"); echo "You are being redirected to the page...!<br>"; echo "(If your browser doesn't support this, " . "<a href=\"your_url\">click here</a>)"; die();
  10. Matpatnik

    calcul error

    Hi guys,I have this little variable that doesn't show up: $i_size = round($_FILES['image_filename']['size'] / 1024); I'm trying to echo the $i_size it doesn't work, I tried to echo $i_size without the round() nothing show up and when I echo $_FILES['image_filename']['size'] alone it work!it used to work to control the file size uploadedthank you
  11. I just realized something, I can't call a variable if the variable isn't define before being include so I change the way the files where include and it work perfectly now.Now mainpage.php include page2.php and page2.php include page1.php (page2.php and page3.php are now in the same page: page2.php)I'm shearing my discovery :)edited: the sesion_start() is there I just didn't show it in there.I find the solution thank you
  12. Hi guys,I got this code which is working fine in one part of the page on the other part it doesn't recognize me!in that page it can look like that:page1.php function adminRestriction() { global $a_maxsize, $a_master; $admin_sql = "SELECT * FROM administration"; $admin_result = mysql_query($admin_sql) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_array($admin_result); $a_maxsize = $row['admin_maxupload']; $a_master = $row['admin_master'];}// this is where I allow the $a_masterinclude "page2.php"; page2.php // only html code except the includeinclude "page3.php"; page3.php // only html code except this <?phpadminRestriction();if ($_SESSION['user_logged'] == $a_master) { echo $admin_master;} else { echo "<td>" . $a_master . "<td>";}// $a_master doesn't work?> And the page1.php get include in the mainpage.php everything called from the adminReatriction function in the mainpage.php work fine except in the page3.php it can't find it!I know that I include a lot of page, can it be the problem?Thank you for your helpMat
  13. Wow, I didnt know that you can use & in the url but probably every commune browser support & in the url.I have EI, Netscape, FF and Opera and never had problem with that. Maybe it's a good thing to start considering the & in the urlThank you justsomeguy
  14. Yup & open a special character in xhtml like $ open a variable for phpbut I think we are getting out of the subject here.what's the difference about & and ; in the urldo they do the exact same thing?can I use either one?
  15. I have a question that start bugging me, maybe it's a stupid question but hey! I'll survive What is the difference between "elseif" and "else if"?To me it does the same thing but I'm sure there is a difference between both of them. In few book of php they write "else if" and some other book (and in w3schools) they write "elseif"!Is one is newer or deprecated?What is the best one to stick with it?
  16. ok good thxedited: I moved the chmod() after the creation of the picture like you said and now it work perfectly imagejpeg($image_jpg, $newfilename); imagedestroy($image_old); imagedestroy($image_jpg); } chmod($newfilename, 0644);
  17. I'm gonna turn off the safe mode and see if the chmod() work* by the way did I insert the chmod() at the right place?I wont need your code right now but I will surely use it later on in my project Thank you
  18. yes safe mode is on, it's on by default. Do I need to turn it off because this will make my site more vulnerable isn't it?
  19. I'm not sure to understand about the folder permission. I rent the server (well I payed for few years), the folder test/images/ permission is set to 777, the test is set to 775 and the thumbs is set to 755. Is it what you've ask?
  20. I've insert the chmod($newfilename, 0644); in between the imagejpeg($image_jpg, $newfilename); and imagedestroy($image_old); and it doesn't work. Do I have to call the function before?edited: Do you think, because I rename the file it change the permission because my thumbnails are auto generated lower in this code and there permission are fine they are set to 644 like they are suppose to be. I'm trying to understand why it does this.
  21. That's interesting, I like that
  22. Hi guys,I have this issue now: With my testing server it was fine but it's an other thing with the website server. When a file is uploaded into the images/ folder it write the 600 permission automatically. What is the best way to set the permission to 644 within this code? // upload image and check for image type if (move_uploaded_file($_FILES['image_filename']['tmp_name'], $ImageName)) { // get info about the image being uploaded list($width, $height, $type, $attr) = getimagesize($ImageName); if ($type > 3) { echo "Sorry, but the file you uploaded was not a GIF, JPG, or PNG file.<br>"; echo "Please hit your browser's 'back' button and try again."; } else { // image is acceptable; ok proceed // insert info into image table $insert = "INSERT INTO images (images_caption, images_username, images_date) VALUES ('$image_caption', '$image_username', '$today')"; $insertresult = mysql_query($insert) or die(mysql_error()); // get the last mysql insert id $lastpicid = mysql_insert_id(); $newfilename = $ImageDir . $lastpicid . ".jpg"; if ($type == 2) { rename($ImageName, $newfilename); } else { if ($type == 1) { $image_old = imagecreatefromgif($ImageName); } elseif ($type == 3) { $image_old = imagecreatefrompng($ImageName); } // "convert" the image to .jpg $image_jpg = imagecreatetruecolor($width, $height); imagecopyresampled($image_jpg, $image_old, 0, 0, 0, 0, $width, $height, $width, $height); imagejpeg($image_jpg, $newfilename); chmod($newfilename, 0644); imagedestroy($image_old); imagedestroy($image_jpg); } Thank you for your helpmatpatnik
  23. Matpatnik

    MySQL error

    Oh I see,it work now thank you
  24. Matpatnik

    MySQL error

    Hi guys,Is there a way to do something like this or maybe I did a mistake: if ($action == "edit") { $actionsql = "WHERE type_id=" . $_GET['id']; } else { $actionsql = "ORDER BY type_id"; } $sql = "SELECT type_id, type_name " . "FROM type '" . $actionsql . "'"; $result = mysql_query($sql) or die("<font color=\"#FF0000\">Query Error</font>" . mysql_error()); while ($row = mysql_fetch_array($result)) { $type_name = $row['type_name'];?> It was just a test and it failed it give me this error message Thank you for your help
  25. Matpatnik

    Login script

    Cool thx andersmoen,Do I have to write only the <?php session_start(); ?> at the beginning of each page or I have to write all the way to the if statement?
×
×
  • Create New...