Bug in script, but can't find it :s

Discussion in 'PHP' started by webmasterplace, Feb 13, 2008.

  1. #1
    Hi,

    There is a bug in my script, but I can't find it. When I test my first version of the script, it works fine, but when I test the second version (which has many other features), it doesn't work anymore.

    It's a project system where people can submit their own project with description , picture etc.
    The problem is in the edit page. Everything else works fine (the add page, the show page ...).

    I hope someone can help me to find the bug in the script.

    This is the version that works:
    <?php
    session_start(); 
    include ('functions.php');
    include ('config.inc.php');
    opentable($locale['xxx204']);
    if (iMEMBER != 1)
    {
    	echo $locale['xxx311'].": ".$locale['xxx312'];
    }
    else
    {
     	if(isset($_POST['project']) and $_POST['project'] != "")
     	{
    	  $id = $_POST['project'];
    	  $_SESSION['id'] = $id;
    	}
    	elseif(isset($_GET['id']) and $_GET['id'] != "")
    	{
    		$id = $_GET['id'];
    		$_SESSION['id'] = $id;
    	}
    	elseif(isset($_SESSION['id']) and $_SESSION['id'] != "")
    	{
    		$id = $_SESSION['id'];
    	}
    	if (isset($id) and preg_match("/^\d+$/",$id)){
     	$query ="SELECT *,
    	YEAR(af) AS jaar,
     	MONTH(af) AS maand,
     	DAYOFMONTH(af) AS dag  FROM ".$db_prefix."projecten WHERE id ='".$id."'AND geb_naam='".$userdata['user_name']."'";
    	$result = mysql_query($query) or die(mysql_error());
    	while($r2 = mysql_fetch_array($result))
    	{
    		$r["id"] = $r2["id"];
    	   	$r["geb_naam"] = $r2["geb_naam"];
    		$r["geb_id"] = $r2["geb_id"];
    		$r["cat_id"] = $r2["cat_id"];
    	    $r['naam'] = $r2['naam'];
       		$r["beschrijving"] = $r2["beschrijving"];
    		$r["afbeelding"] = $r2["afbeelding"];
    		$r["thumb"] = $r2["thumb"];
       		$r["progres"] = $r2["progres"];
        	$r["start"] = $r2["start"];
        	$r["gewijzigd"] = $r2["gewijzigd"];
    		$r["dag"] = $r2["dag"];
    		$r["maand"] = $r2["maand"];
    		$r["jaar"] = $r2["jaar"];
        	$r["site"] = $r2["site"];
        	$r["site_url"] = $r2["site_url"];
    		$comments = ($r2["allow_comments"] == "1" ? " checked" : "");
    		$ratings = ($r2["allow_ratings"] == "1" ? " checked" : "");
        
    		$query2 ="SELECT * FROM ".$db_prefix."project_cat WHERE id =".$r["cat_id"]."";;
    		$result2 = mysql_query($query2) or die(mysql_error());
    		while($cat2 = mysql_fetch_array($result2))
    		{
    			$cat = $cat2['naam'];
    		}
    	}
    if (isset($_POST['voltooid']))
    {
    if (isset($_FILES['bestand'])) {
    	$naam = $_POST['naam'];
        $maxsize = 358400; 
        $file_name = "$naam-"; 
        $map = "images/";
    	$thumbmap = "images/thumbs/"; 
        if ($_FILES['bestand']['type'] > $maxsize){
            exit("Je bestand is " . $_FILES['bestand']['size'] . " bytes groot, het maximum toegelaten is " . $maxsize . " bytes.<br>Probeer met een andere afbeelding.");
        } 
        if($_FILES['bestand']['type'] == "image/jpeg") {
            $x = strtolower(substr($_FILES['bestand']['name'], -3));
            $n = 0;
            while (file_exists($map . $file_name . $n . '.' . $x)) 
            { 
                $n = $n + 1; 
            } 
            $file_name = $file_name . $n; 
            move_uploaded_file($_FILES['bestand']['tmp_name'],$map . $file_name . '.' . $x);
            chmod ($map . $file_name . '.' . $x, 0777);
        
            $width = 120; 
            $thumb = $thumbmap . $file_name . '.' . $x; 
            $orig = $map . $file_name . '.' . $x;
            $b = imagecreatefromjpeg($map . $file_name . '.' . $x) or die ("Jpg probleempje");
            $bx = imagesx($b); 
            $by = imagesy($b); 
            $lm = $b;
            $temp=$bx/$width;
            $height=$by/$temp;
            $lm1 = imagecreate($width ,$height) or die ("Probleem tijdens maken van plaatje");
            imagecopyresampled($lm1, $lm, 0, 0, 0, 0, $width, $height, $bx, $by);
            Imagejpeg($lm1,$thumb,90);
            imageDestroy($lm1);
            imageDestroy($lm);
        } 
    } 
     	if (isset($_POST['delete']) and $_POST['delete'] == "on") 
    	 {
    	  	$sql2 = "DELETE FROM ".$db_prefix."projecten WHERE id = '".$r["id"]."'";
    	  	mysql_query($sql2) or die(mysql_error());
    		echo $locale['xxx319'];
    		$_SESSION['id'] = "";
    		$thumb2 = $r["thumb"];
    		$afbeelding2 = $r["afbeelding"];
    		if (file_exists($afbeelding2)) { unlink ($afbeelding2); } 
    		if (file_exists($thumb2)) { unlink ($thumb2); } 
    	 }
    	elseif (isset($_POST['delete_afbeelding']) and $_POST['delete_afbeelding'] == "on") 
    	 {
    	  	$sql2 = "UPDATE ".$db_prefix."projecten SET afbeelding = '', thumb = ''  WHERE id = '".$r["id"]."'";
    	  	mysql_query($sql2) or die(mysql_error());
    		echo $locale['xxx320'];
    		$_SESSION['id'] = "";
    		$thumb2 = $r["thumb"];
    		$afbeelding2 = $r["afbeelding"];
    		if (file_exists($afbeelding2)) { unlink ($afbeelding2); } 
    		if (file_exists($thumb2)) { unlink ($thumb2); }
    	 }
    	elseif (isset($_POST['naam']) and $_POST['naam'] != "" and isset($_POST['beschrijving']) and $_POST['beschrijving'] != "")//als er niet op delite is geklikt kijken of de verplichte velden zijn ingevult zo niet een error weer geven
    	{
    	 	$user = $userdata['user_name'];
    		$cat = $_POST['cat'];
    		$beschrijving = $_POST['beschrijving'];
    		$voltooid = $_POST['voltooid'];
    		$af = $_POST['jaar']."-".$_POST['maand']."-".$_POST['dag'];
    		$site_naam = $_POST['site_naam'];
    		$site_url = $_POST['site_url'];
    		
    			$sql2 = "UPDATE ".$db_prefix."projecten SET 
    			cat_id = '".$cat."',
    			naam = '".mysql_real_escape_string($naam)."',
    			beschrijving = '".mysql_real_escape_string($beschrijving)."',
    			afbeelding = '".$orig."',
    			thumb = '".$thumb."',
    			progres = '".$voltooid."',
    			gewijzigd = NOW(),
    			af = '".$af."',
    			site = '".mysql_real_escape_string($site_naam)."',
    			site_url = '".mysql_real_escape_string($site_url)."'
    			WHERE id = '".$r["id"]."'";
    			mysql_query($sql2) or die(mysql_error());
    			$_SESSION['id'] = "";	 
    			echo $locale['xxx316'];
    	}
    	else
    	{
    		echo $locale['xxx313'];
    	}	
    } else {
    	echo "<form action=\"".$_SERVER["PHP_SELF"]."\" enctype=\"multipart/form-data\" method=\"POST\">";
    	echo "<br><fieldset><legend><b>".$locale['xxx300'].":</b></legend><br>";
    	echo "<input type=\"text\" style=\"width:200px;\" class=\"textbox\" maxlength=\"30\" name=\"naam\" lang=\"".$settings['locale']."\" value=\"".$r["naam"]."\"/></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx301'].":</b></legend><br>";
    	echo "<textarea id=\"beschrijving\" name=\"beschrijving\" rows=\"20\" cols=\"80\" lang=\"".$settings['locale']."\">".$r["beschrijving"]."</textarea><br></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx314'].":</b></legend><br>";
    	echo cat_option($db_prefix,$r["cat_id"])."</fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx302'].":</b></legend><br>";
    	echo combobox_voltooid($r["progres"])."</fieldset><br>";
    	if ($r['afbeelding'] != ""){
    	echo "<fieldset><legend><b>".$locale['xxx309']."</b></legend><br>";
    	echo "<table border='0' ><tr>";
    	echo "<td><a href=\"".$r["afbeelding"]."\" target=\"_blank\"><img src=\"".$r["thumb"]."\" border=\"0\" alt=\"".$r["naam"]."\"></a></td>";
    	echo "<td><input type=\"checkbox\" name=\"delete_afbeelding\" />";
    	echo "Verwijder deze afbeelding<br></td></tr></table></fieldset>";
    	} else {
    	echo "<fieldset><legend><b>".$locale['xxx309']."</b></legend><br>";
    	echo "<input type=\"file\" class=\"textbox\" name=\"bestand\" /><br>";
    	echo "<i>Enkel <b>jpg/jpeg</b> afbeeldingen. Andere soorten afbeeldingen zullen <b>niet</b> toegevoegd worden!</i></fieldset><br>";
    	}
    	echo "<fieldset><legend><b>".$locale['xxx303'].":</b></legend><br>";
    	echo $locale['xxx304'].": "; echo combobox_dag($r["dag"])." ".$locale['xxx305'].": "; echo combobox_maand($r["maand"])." ".$locale['xxx306'].": "; echo combobox_jaar($r["jaar"])."</fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx307'].":</b></legend><br>";
    	echo "<input type=\"text\" style=\"width:200px;\" class=\"textbox\" maxlength=\"100\" name=\"site_naam\" lang=\"".$settings['locale']."\ value=\"".$r["site_naam"]."\"/></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx308'].":</b></legend><br>";
    	echo "<input type=\"text\" style=\"width:200px;\" class=\"textbox\" maxlength=\"150\" value=\"".$r["site_url"]."\" name=\"site_url\" lang=\"".$settings['locale']."\"/></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx321']."</b></legend>";
    	echo "<input type=\"checkbox\" name=\"delete\" /> ";
    	echo "".$locale['xxx318'].". <b><br>Dit kan NIET ongedaan gemaakt worden!</b></fieldset><br>";
    	echo "<input type=\"submit\" class=\"button\" value=\"".$locale['xxx310']."\" lang=\"".$settings['locale']."\" />";
    	echo "</form>";
    }
    } else {
    	echo "<center>";
    	echo "Selecteer een project en klik op Wijzigen:<br><br>";
    	echo "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
    	user_projecten($db_prefix, $userdata['user_name']);
    	echo "&nbsp;&nbsp;<input type=\"submit\"  value=\"Wijzigen\" name=\"Wijzigen\" class=\"button\" />";
    	echo "</form>";
    	echo "</center><br>";
    }
    }
    closetable();
    ?>
    PHP:
    This is the new version that doesn't work:
    <?php
    session_start(); 
    include ('functions.php');
    include ('config.inc.php');
    if(!iADMIN) {
    fallback('fout.php');
    }
    opentable($locale['xxx204']);
    if (iMEMBER != 1)
    {
    	echo $locale['xxx311'].": ".$locale['xxx312'];
    }
    else
    {
     	if(isset($_POST['project']) and $_POST['project'] != "")
     	{
    	  $id = $_POST['project'];
    	  $_SESSION['id'] = $id;
    	}
    	elseif(isset($_GET['id']) and $_GET['id'] != "")
    	{
    		$id = $_GET['id'];
    		$_SESSION['id'] = $id;
    	}
    	elseif(isset($_SESSION['id']) and $_SESSION['id'] != "")
    	{
    		$id = $_SESSION['id'];
    	}
    	if (isset($id) and preg_match("/^\d+$/",$id)){
     	$query ="SELECT *,
    	YEAR(af) AS jaar,
     	MONTH(af) AS maand,
     	DAYOFMONTH(af) AS dag  FROM ".$db_prefix."projecten WHERE id ='".$id."' AND geb_naam='".$userdata['user_name']."'";
    	$result = mysql_query($query) or die(mysql_error());
    	while($r2 = mysql_fetch_array($result))
    	{
    		$r["id"] = $r2["id"];
    	   	$r["geb_naam"] = $r2["geb_naam"];
    		$r["geb_id"] = $r2["geb_id"];
    		$r["geb_email"] = $r2["geb_email"];
    		$r["cat_id"] = $r2["cat_id"];
    	    $r['naam'] = $r2['naam'];
       		$r["beschrijving"] = $r2["beschrijving"];
    		$r["afbeelding"] = $r2["afbeelding"];
    		$r["thumb"] = $r2["thumb"];
       		$r["progres"] = $r2["progres"];
        	$r["start"] = $r2["start"];
        	$r["gewijzigd"] = $r2["gewijzigd"];
    		$r["dag"] = $r2["dag"];
    		$r["maand"] = $r2["maand"];
    		$r["jaar"] = $r2["jaar"];
        	$r["site"] = $r2["site"];
        	$r["site_url"] = $r2["site_url"];
    		$comments = ($r2["allow_comments"] == "1" ? " checked" : "");
    		$ratings = ($r2["allow_ratings"] == "1" ? " checked" : "");
        
    		$query2 ="SELECT * FROM ".$db_prefix."project_cat WHERE id =".$r["cat_id"]."";;
    		$result2 = mysql_query($query2) or die(mysql_error());
    		while($cat2 = mysql_fetch_array($result2))
    		{
    			$cat = $cat2['naam'];
    		}
    	}
    if (isset($_POST['voltooid']))
    {
    if (isset($_FILES['bestand'])) {
        $maxsize = 358400; 
        $file_name = random(8,1) . '-'; 
        $map = "images/"; 
    	$thumbmap = "images/thumbs/"; 
        if ($_FILES['bestand']['type'] > $maxsize){
            exit("Je bestand is " . $_FILES['bestand']['size'] . " bytes groot, het maximum toegelaten is " . $maxsize . " bytes.<br>Probeer met een andere afbeelding.");
        } 
        if($_FILES['bestand']['type'] == "image/jpeg") {
            $x = strtolower(substr($_FILES['bestand']['name'], -3));
            $n = 0;
            while (file_exists($map . $file_name . $n . '.' . $x)) 
            { 
                $n = $n + 1; 
            } 
            $file_name = $file_name . $n; 
            move_uploaded_file($_FILES['bestand']['tmp_name'],$map . $file_name . '.' . $x);
            chmod ($map . $file_name . '.' . $x, 0777);
    		$orig = $map . $file_name . '.' . $x;
    		thumb($orig);
    		$thumb = $thumbmap . $file_name . '_th' . '.' . $x;
    	if (isset($_POST['naam']) and $_POST['naam'] != "" and isset($_POST['beschrijving']) and $_POST['beschrijving'] != "")//als er niet op delete is geklikt kijken of de verplichte velden zijn ingevult zo niet een error weer geven
    	{
    	 	$user = $userdata['user_name'];
    		$user_email = $userdata['user_email'];
    		$user_id = $userdata['user_id'];
    		$cat = $_POST['cat'];
    		$beschrijving = stripslashes($_POST['beschrijving']);
    		$voltooid = $_POST['voltooid'];
    		$af = $_POST['jaar']."-".$_POST['maand']."-".$_POST['dag'];
    		$site_naam = $_POST['site_naam'];
    		$site_url = $_POST['site_url'];
    		$comments = isset($_POST['project_comments']) ? "1" : "0";
    		$ratings = isset($_POST['project_ratings']) ? "1" : "0";
    		
    			$sql2 = "UPDATE ".$db_prefix."projecten SET 
    			geb_naam = '".$user.",
    			geb_id = '".$user_id.",
    			geb_email = '".$user_email."',
    			cat_id = '".$cat."',
    			naam = '".mysql_real_escape_string($naam)."',
    			beschrijving = '".mysql_real_escape_string($beschrijving)."',
    			afbeelding = '".$orig."',
                thumb = '".$thumb."', 
    			progres = '".$voltooid."',
    			gewijzigd = NOW(),
    			af = '".$af."',
    			site = '".mysql_real_escape_string($site_naam)."',
    			site_url = '".mysql_real_escape_string($site_url)."',
    			allow_comments = '".$comments."',
    			allow_ratings = '".$ratings."',
    			WHERE id = '".$r["id"]."'";
    
    			mysql_query($sql2) or die(mysql_error());
    			$_SESSION['id'] = "";	 
    			echo $locale['xxx325'];			
    			
    	}
    	else
    	{
    		echo $locale['xxx313'];
    	}
    		
     }
    } else {
    	if (isset($_POST['naam']) and $_POST['naam'] != "" and isset($_POST['beschrijving']) and $_POST['beschrijving'] != "")//als er niet op delete is geklikt kijken of de verplichte velden zijn ingevult zo niet een error weer geven
    	{
    	 	$user = $userdata['user_name'];
    		$user_email = $userdata['user_email'];
    		$user_id = $userdata['user_id'];
    		$cat = $_POST['cat'];
    		$beschrijving = stripslashes($_POST['beschrijving']);
    		$voltooid = $_POST['voltooid'];
    		$af = $_POST['jaar']."-".$_POST['maand']."-".$_POST['dag'];
    		$site_naam = $_POST['site_naam'];
    		$site_url = $_POST['site_url'];
    		$comments = isset($_POST['project_comments']) ? "1" : "0";
    		$ratings = isset($_POST['project_ratings']) ? "1" : "0";
    			
    			$sql2 = "UPDATE ".$db_prefix."projecten SET 
    			geb_naam = '".$user.",
    			geb_id = '".$user_id.",
    			geb_email = '".$user_email."',
    			cat_id = '".$cat."',
    			naam = '".mysql_real_escape_string($naam)."',
    			beschrijving = '".mysql_real_escape_string($beschrijving)."',
    			progres = '".$voltooid."',
    			gewijzigd = NOW(),
    			af = '".$af."',
    			site = '".mysql_real_escape_string($site_naam)."',
    			site_url = '".mysql_real_escape_string($site_url)."',
    			allow_comments = '".$comments."',
    			allow_ratings = '".$ratings."',
    			WHERE id = '".$r["id"]."'";
    
    			mysql_query($sql2) or die(mysql_error());
    			$_SESSION['id'] = "";	 
    			echo $locale['xxx325'];
    			
    	}
    	else
    	{
    		echo $locale['xxx313'];
    	}
    }
    	if (isset($_POST['delete']) and $_POST['delete'] == "on") 
    	{	
    	  	$sql2 = "DELETE FROM ".$db_prefix."projecten WHERE id = '".$r["id"]."'";
    	  	mysql_query($sql2) or die(mysql_error());
    		echo $locale['xxx319'];
    		$_SESSION['id'] = "";
    		$thumb2 = $r["thumb"];
    		$afbeelding2 = $r["afbeelding"];
    		if (file_exists($afbeelding2)) { unlink($afbeelding2); } 
    		if (file_exists($thumb2)) { unlink($thumb2); } 
    		$del_comments = "DELETE FROM ".$db_prefix."comments WHERE comment_item_id='".$r["id"]."' AND comment_type='U'";
    		mysql_query($del_comments) or die(mysql_error());
    		$del_ratings = "DELETE FROM ".$db_prefix."ratings WHERE rating_item_id='".$r["id"]."' AND rating_type='U'";
    		mysql_query($del_ratings) or die(mysql_error());
    		
    	}
    	elseif (isset($_POST['delete_afbeelding']) and $_POST['delete_afbeelding'] == "on") 
    	{	
    	  	$sql2 = "UPDATE ".$db_prefix."projecten SET afbeelding = '', thumb = ''  WHERE id = '".$r["id"]."'";
    	  	mysql_query($sql2) or die(mysql_error());
    		echo $locale['xxx320'];
    		$_SESSION['id'] = "";
    		$thumb2 = $r["thumb"];
    		$afbeelding2 = $r["afbeelding"];
    		if (file_exists($afbeelding2)) { unlink ($afbeelding2); } 
    		if (file_exists($thumb2)) { unlink ($thumb2); } 
    	}		
    } else {
    	echo "<form action=\"".$_SERVER["PHP_SELF"]."\" enctype=\"multipart/form-data\" method=\"POST\">";
    	echo "<br><fieldset><legend><b>".$locale['xxx300']." <small>*</small></b></legend><br>";
    	echo "<input type=\"text\" style=\"width:200px;\" class=\"textbox\" maxlength=\"30\" name=\"naam\" lang=\"".$settings['locale']."\" value=\"".$r["naam"]."\"/></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx301']." <small>*</small></b></legend><br>";
    	echo "<textarea id=\"beschrijving\" name=\"beschrijving\" rows=\"20\" cols=\"80\" lang=\"".$settings['locale']."\">".$r["beschrijving"]."</textarea><br></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx314']."</b></legend><br>";
    	echo cat_option($db_prefix,$r["cat_id"])."</fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx302']."</b></legend><br>";
    	echo combobox_voltooid($r["progres"])."</fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx303']."</b></legend><br>";
    	echo $locale['xxx304'].": "; echo combobox_dag($r["dag"])." ".$locale['xxx305'].": "; echo combobox_maand($r["maand"])." ".$locale['xxx306'].": "; echo combobox_jaar($r["jaar"])."</fieldset><br>";
    	if ($r['afbeelding'] != ""){
    	echo "<fieldset><legend><b>".$locale['xxx309']."</b></legend><br>";
    	echo "<table border='0' ><tr>";
    	echo "<td><a href=\"".$r["afbeelding"]."\" target=\"_blank\"><img src=\"".$r["thumb"]."\" border=\"0\" alt=\"".$r["naam"]."\"></a></td>";
    	echo "<td><input type=\"checkbox\" name=\"delete_afbeelding\" />";
    	echo "Verwijder deze afbeelding<br></td></tr></table></fieldset><br>";
    	} else {
    	echo "<fieldset><legend><b>".$locale['xxx309']."</b></legend><br>";
    	echo "<input type=\"file\" class=\"textbox\" name=\"bestand\" /><br>";
    	echo "<i>Enkel <b>jpg/jpeg</b> afbeeldingen. Andere soorten afbeeldingen zullen <b>niet</b> toegevoegd worden!</i></fieldset><br>";
    	}
    	echo "<fieldset><legend><b>".$locale['xxx307']."</b></legend><br>";
    	echo "<input type=\"text\" style=\"width:200px;\" class=\"textbox\" maxlength=\"100\" name=\"site_naam\" lang=\"".$settings['locale']."\ value=\"".$r["site_naam"]."\"/></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx308']."</b></legend><br>";
    	echo "<input type=\"text\" style=\"width:200px;\" class=\"textbox\" maxlength=\"150\" value=\"".$r["site_url"]."\" name=\"site_url\" lang=\"".$settings['locale']."\"/></fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx322']."</b></legend>";
    	echo "<input type='checkbox' name='project_comments' value='yes'$comments> ".$locale['xxx323']."<br>";
    	echo "<input type='checkbox' name='project_ratings' value='yes'$ratings> ".$locale['xxx324']."</fieldset><br>";
    	echo "<fieldset><legend><b>".$locale['xxx321']."</b></legend>";
    	echo "<input type=\"checkbox\" name=\"delete\" /> ";
    	echo "".$locale['xxx318'].". <b><br>Dit kan NIET ongedaan gemaakt worden!</b></fieldset><br>";
    	echo "<input type=\"submit\" class=\"button\" value=\"".$locale['xxx310']."\" lang=\"".$settings['locale']."\" />";
    	echo "</form>";
    }
    } else {
    	echo "<center>";
    	echo "Selecteer een project en klik op Wijzigen:<br><br>";
    	echo "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
    	user_projecten($db_prefix, $userdata['user_name']);
    	echo "&nbsp;&nbsp;<input type=\"submit\"  value=\"Wijzigen\" name=\"Wijzigen\" class=\"button\" />";
    	echo "</form>";
    	echo "</center><br>";
    }
    }
    closetable();
    echo "<script type='text/javascript'>
    function DeleteProject() {
    	return confirm('Ben je zeker dat je dit project wilt verwijderen?');
    }
    </script>\n";
    ?>
    PHP:
    Thanks for the help!!!
     
    webmasterplace, Feb 13, 2008 IP
  2. DarkMindZ

    DarkMindZ Guest

    Messages:
    175
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hey, I am looking into it atm, but if you can please give me the error that it gives you? that will help alot
     
    DarkMindZ, Feb 13, 2008 IP
  3. webmasterplace

    webmasterplace Peon

    Messages:
    802
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The problem is that I don't get any errors. It just doesn't work. When I Click the save button to save the project, there is nothing changed (the new info isn't added into the database) and the session is still not ended.
     
    webmasterplace, Feb 13, 2008 IP
  4. DarkMindZ

    DarkMindZ Guest

    Messages:
    175
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok, for quick debuging, find the UPDATE querys, and make it ECHO them instead of querying them, and you will find the mistake there hopefully.
     
    DarkMindZ, Feb 13, 2008 IP
  5. kreoton

    kreoton Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There are many code here and, many function call so it is hard to guess what causes an error, if you show error you get it would be easier to find it :)
     
    kreoton, Feb 13, 2008 IP
  6. webmasterplace

    webmasterplace Peon

    Messages:
    802
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Like I said before, I don't get any errors. The script just doesn't work. It doesn't update the database information and the session is not over. I just come to the page where it says: "You project has been updated", but it isn't updated :s

    If you need the functions file, just tell me.
     
    webmasterplace, Feb 13, 2008 IP
  7. stoli

    stoli Peon

    Messages:
    69
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Looking at lines 101 to 104:
    $sql2 = "UPDATE ".$db_prefix."projecten SET
                geb_naam = '".$user.",
                geb_id = '".$user_id.",
                geb_email = '".$user_email."',
    PHP:
    You have missed closing single quotes on lines 102 and 103. It should look like:
    $sql2 = "UPDATE ".$db_prefix."projecten SET
                geb_naam = '".$user."',
                geb_id = '".$user_id."',
                geb_email = '".$user_email."',
    PHP:
    The same error is repeated on lines 146 and 147.

    There may be other errors but this would prevent the database from being updated as you say.
     
    stoli, Feb 13, 2008 IP
  8. webmasterplace

    webmasterplace Peon

    Messages:
    802
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I have fixed those quotes, but it still doesn't work :s
    Maybe it has something to do with the session?
     
    webmasterplace, Feb 13, 2008 IP
  9. stoli

    stoli Peon

    Messages:
    69
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You have a comma that shouldn't be there at the end of lines 116 and 158.

    allow_ratings = '".$ratings."',
                WHERE id = '".$r["id"]."'";
    PHP:
    should be

    allow_ratings = '".$ratings."'
                WHERE id = '".$r["id"]."'";
    PHP:
     
    stoli, Feb 13, 2008 IP
  10. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #10
    Change your error reporting.

    
    error_reporting(E_ALL);
    
    PHP:
     
    jayshah, Feb 13, 2008 IP
  11. webmasterplace

    webmasterplace Peon

    Messages:
    802
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Done, but nothing is changed :s

    Did that, but I don't get any errors:s

    Any other suggestions??
     
    webmasterplace, Feb 16, 2008 IP