Jump to content

pmzq

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pmzq's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. No there is no error message my browser just tells me that it can not reach the page after a long time... The comments aren't very informative and the code isn't that hard it just does what it does upload the file and doesn't if the image is larger then $max...
  2. I tried it with a different picture now properties of this pic are: Width = 1280, Height = 1024 and it is 400 kb big it seams to work endlessly times ? And yes this is the code that is uploading the image
  3. I've got a photo uploading script to upload images to the webserver: $naam = $HTTP_POST_FILES['mijnbestand']['name']; $type = $HTTP_POST_FILES['mijnbestand']['type']; $size = $HTTP_POST_FILES['mijnbestand']['size']; if ($naam){ // we stellen de maximale omvang in op 100kb $max = 1000000; // Als de bestandsgrootte groter is dan de maximale grootte dan….. if ($HTTP_POST_FILES['mijnbestand']['size'] > $max) { // als ie dus groter is echo'en we een error echo "Het bestand is groter dan 1Mb !!"; } // anders gaan we het bestand uploaden else { //zoals je ziet doen we dat met de functie copy() move_uploaded_file($HTTP_POST_FILES['mijnbestand']['tmp_name'], $foto_plaats . $HTTP_POST_FILES['mijnbestand']['name']); //en we echo'en nog even een berichtje //dat het bestand is geupload // Content type header('Content-type: image/jpeg'); echo "<center>Je hebt net het bestand $naam met succes geupload</center>"; // zet de naam van het bestand in de database mysql_query("insert into foto set foto='$naam'"); if ($HTTP_POST_FILES['mijnbestand']['name']=="none" OR $HTTP_POST_FILES['mijnbestand']['name']="") { //no file uploaded echo "<center>Je hebt geen foto geselecteerd</center>"; } } } When I try to upload a picture with these properties: Width = 600px, Height = 400px and it's 80kb's. Then the first time it works fine very fast it uploads. Second time works aswell. But then the 3rd time it keeps trying untill I get the browser error that the page couldn't be reached ? Even when I shutdown my browser and try again it fails. Could it be something with the memory being full at the server or something ? Does anyone have a clue where the flaw may be ? at the server or at the script or at my pc ? Many thnx! pMzQ,
  4. Could it be something to do with the server ? is it likely ? Sometimes it works sometimes it doesn't ? I figured out that the max dimension to upload was a width of 3000 px when i made it 3001 it didn't work anymore I just resized a red box and figured it out! help help help ?
  5. Hy all I got the following code for upload foto's to my server: $user = $_COOKIE['Username']; $pass = $_COOKIE['Password']; $foto_plaats = "../hugo/foto/"; $db = mysql_pconnect ("localhost:3306", root) or die ("Could not connect to database"); mysql_select_db(foto,$db); $send = $_POST['send']; $foto = $_POST['foto']; $delete = $_POST['delete']; $ja = $_POST['ja']; $nee = $_POST['nee']; // check the user! require "auth.php"; pre_auth($user,$pass); $naam = $HTTP_POST_FILES['mijnbestand']['name']; $type = $HTTP_POST_FILES['mijnbestand']['type']; $size = $HTTP_POST_FILES['mijnbestand']['size']; if ($naam){ // we stellen de maximale omvang in op 100kb $max = 1000000; // Als de bestandsgrootte groter is dan de maximale grootte dan….. if ($HTTP_POST_FILES['mijnbestand']['size'] > $max) { // als ie dus groter is echo'en we een error echo "Het bestand is groter dan 1Mb !!"; } // anders gaan we het bestand uploaden else { //zoals je ziet doen we dat met de functie copy() move_uploaded_file($HTTP_POST_FILES['mijnbestand']['tmp_name'], $foto_plaats . $HTTP_POST_FILES['mijnbestand']['name']); //en we echo'en nog even een berichtje //dat het bestand is geupload // Content type header('Content-type: image/jpeg'); echo "<center>Je hebt net het bestand $naam met succes geupload</center>"; // zet de naam van het bestand in de database mysql_query("insert into foto set foto='$naam'"); if ($HTTP_POST_FILES['mijnbestand']['name']=="none" OR $HTTP_POST_FILES['mijnbestand']['name']="") { //no file uploaded echo "<center>Je hebt geen foto geselecteerd</center>"; } It will upload the photo file and it will insert it's name in a database. The problem I have is that when I upload a photo1 which properties are: Width = 2048px, Height = 1536px and is 623kb everything works fine. When I try to upload another picture photo2 which properties are: Width = 600, Height = 400px and is 173kb it doesnt work my browser times out after a certain time and the image is not uploaded ? Can someone please help me figure this problem out ? I contacted my hosting provider and the max upload file size is a couple MB's so that's not it also the memmory is set to 16MB for me! Pls I'm hanging on this for days Greetzz pMzQ,
  6. Ok I did the following: exec("nohup /wwwroot/htdocs/test/ticker/tick_test.sh",$output); echo "<pre>"; print_r($output); echo "</pre>"; I've putt this command in a php file and when I open the file it keeps on loading untill forever! When I go into ssh with putty and I kill the tick_test.sh file by typing kill $pid number i received with pgrep tick_test.sh then when I go to the page that exectuted the file it returns the following: Array (     [0] => *** wo jul 19 22:13:29 CEST 2006 ***     [1] => *sleeping     [2] => *** wo jul 19 22:13:29 CEST 2006 ***     [3] => *sleeping     [4] => *** wo jul 19 22:13:29 CEST 2006 ***     [5] => *sleeping     [6] => *** wo jul 19 22:13:29 CEST 2006 ***     [7] => *sleeping etc etc etc.. until [1166] => Quiting through clean_up     [1167] => Quiting through clean_up that's it ???? I set the permission for the ticker directory to 777 so don't think that has anything to do with it does it ? Hoppe to hear from ya soon thnx! pMzQ, p.s. I tried also something else: Here is the code of the tick_test.sh file: trap clean_up EXIT SIGTERM SIGKILL SIGABRT function clean_up() {   echo "Quiting through clean_up"   rm ./ticker.run   rm ./ticker.run.timer   rm ./ticker.end   trap EXIT   exit 0 } if [ $# -eq 1 ]; then   tick=$1 else   tick=30 fi if [ ! -f ticker.end ]; then   touch ./ticker.end fi touch ./ticker.run.timer while [ 1 ]; do   echo "*** "`date`" ***"   ./ticker mypa.cfg   echo "*sleeping $sleep"   ./tick_sleep $tick ./ticker.run.timer I did the following system("nohup /wwwroot/htdocs/test/ticker/tick.sh 2>&1 &",$output); echo "<pre>"; print_r($output); echo "</pre>"; then the output tells me this: touch: cannot touch `./ticker.end' access denied and also: *sleeping /wwwroot/htdocs/test/ticker/tick.sh: line 50 unknown file or directory. So aren't the privilidges ok ? thnx pMzQ,
  7. If I knew how to add such a output to my command ? Can you give me an example ? ( yes I am a noob :D ) pMzQ,
  8. Ok people here we go: I've been trying to  get a certain .php file to execute a .sh file on my server. When I'm on the server in a shell and I axecute the following command: nohup /wwwroot/htdocs/test/ticker/tick.sh Then the tick.sh file is executed and is running in the background which is what I want. Now my question is to run the same command, but I want to run it from a php file in on the server. Somewere in /wwwroot/htdocs/test I thought It would be easy to just do the following: exec("nohup /wwwroot/htdocs/test/ticker/tick_test.sh") ; Well yes it did NOT  :o I've read lots of articles about this isue but can't seem to find a sollution. Is there a problem with my server do I need to login on the server first with a PHP script in order to execute such a command ? Hope to hear something soon Greetzz pMzQ,
  9. that was the explanation I was looking for THNX :D That is exactly what it does :D now I can continue :)
  10. Ok thnx i'm getting it :) I think i get it now it just putts in a zero i'll try to code things with my code and try if it works! thnx again!! :) pMzQ,
  11. Ok I think I'm getting there, I think because "has_politics" is set to 1 in this code : $q = "UPDATE planet set has_politics = has_politics | 1 ". "WHERE x='$myrow[x]' AND y='$myrow[y]' AND id!='$Planetid'"; $result = mysql_query ($q, $db); Then the following code stes "has_politics" again : $q ="UPDATE planet SET has_politics=$myrow[has_politics] & 0xfe ". "WHERE id='$Planetid'"; $result = mysql_query ($q, $db); $myrow["has_politics"] = $myrow["has_politics"] & 0xfe; 0xfe means 254 and I think it adds this to 1 making 255 and then i think 255 is full or something meaning 0 ? Am i right about this ? ok so 0xfe is 0 you say i;ll try some stuff with the code to figure thigns out :) thnx!
  12. Ok I understand but still I don't know what to replace 0xfe with how do i calculate the decimal for this hexadecimal number ? I can calculate the binary of this which is i think 1111 1110 meaning f and e. But how do i translate this to a real number ? ok i think 0xfe means decimal 254. But then I'm still confused because when I look in my mysql database when this code is run: $q = "UPDATE planet set has_politics = has_politics | 1 ". "WHERE x='$myrow[x]' AND y='$myrow[y]' AND id!='$Planetid'"; $result = mysql_query ($q, $db); The "has_politics" row shows that it's value = 1 sofar i understand but then after this code is run: $q ="UPDATE planet SET has_politics=$myrow[has_politics] & 0xfe ". "WHERE id='$Planetid'"; $result = mysql_query ($q, $db); $myrow["has_politics"] = $myrow["has_politics"] & 0xfe; then the value of "has_politics" is set back to 0 so 0xfe is meaning something like -1 because the value was 1 and after the code is run it is 0. But i just calculated that fe means 254 :| ???????
  13. thnx for these answers so far :) But do you know if I can just replace them with normal numbers isntead of those heximal just put the real number in there so i don't have to look up all the time what it is meaning.. ?
  14. Hy all, I've got a code like this: $q ="UPDATE planet SET has_politics=$myrow[has_politics] & 0xfe ". "WHERE id='$Planetid'"; $result = mysql_query ($q, $db); IT tells the "has_politics" to become 0xfe but what does this mean is it some sort of haxdecimal code for a certain number ? In a earlier part of the code the "has_politics" is set like the following: $q = "UPDATE planet set has_politics = has_politics | 1 ". "WHERE x='$myrow[x]' AND y='$myrow[y]' AND id!='$Planetid'"; $result = mysql_query ($q, $db); So I think the code above sets the "has_politics" to 1 and 0xfe code sets it to 0 again or something ? Can anyone tell em what that part of code does? thnx again pMzQ,
  15. Thnx for that Ken :) But what do those Bits mean it isn't the same as typing has_politics == 1 I don't realy understand how bits work do you have any explaning tutorial some where i can look at or could you tell me how it works ? thnx pMzQ,
×
×
  • 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.