HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/molen.komma.pro/wwwroot/kms/categorie_wijzigen.php
<?php
include("ckeditor/ckeditor.php");

$categorie_id = $_GET['categorie_id'];

$categorie_id = checkData($categorie_id);
	
if(!isset($_POST['verzenden'])){
	
	$q_cases = sprintf("SELECT kms_categories.categorie_name, kms_categories.introduction, kms_categories.description FROM kms_categories WHERE categorie_id='%s'", $categorie_id);
	$r_cases = mysql_query($q_cases);
	$rec_cases = mysql_fetch_assoc($r_cases);
	
	$naam = $rec_cases['categorie_name'];
	$introductie = $rec_cases['introduction'];
	$omschrijving = $rec_cases['description'];
	
	$naam = html_entity_decode($naam);
	$introductie = html_entity_decode($introductie); 
	$omschrijving = html_entity_decode($omschrijving); 
}
if(isset($_POST['verzenden'])){
	$verzenden = true;
}
if(isset($_POST['naam'])){
	$naam = $_POST['naam'];
	$naam = trim($naam);
	$lengte_naam = strlen($naam);
	if(($lengte_naam > 1) && ($lengte_naam < 100)){
		$valid_naam = true;
		$te_lang_naam = false;
	}else{
		$valid_naam = false;
		if($lengte_naam != 0){
			$te_lang_naam = true;
		}
	}
}else{
	$valid_naam = false;
}

if($verzenden && $valid_naam){
	
	$test_url = friendlyURL($naam);
	
	$q_cases = sprintf("SELECT kms_categories.url FROM kms_categories WHERE url='%s'", $test_url);
	$r_cases = mysql_query($q_cases);
	$rec_cases = mysql_fetch_assoc($r_cases);
	
	$uitkomst = $rec_cases['url'];
		
	if($test_url == $uitkomst){
		$bestaat_niet = false;	
	}else{
		$bestaat_niet = true;		
	}	
	
	$q_cases2 = sprintf("SELECT kms_categories.url FROM kms_categories WHERE categorie_id='%s'", $categorie_id);
	$r_cases2= mysql_query($q_cases2);
	$rec_cases2 = mysql_fetch_assoc($r_cases2);
	$org_name = $rec_cases2['url'];
	
	if($test_url == $org_name){
		$bestaat_niet = true;
	}

}
//check if al bestaat
if(isset($_POST['introductie'])){
	$introductie = $_POST['introductie'];
	$introductie = trim($introductie);
	$lengte_introductie = strlen($introductie);
	if(($lengte_introductie > 1)){
		$valid_introductie = true;
	}else{
		$valid_introductie = false;
	}
}else{
	$valid_introductie = false;
}

if(isset($_POST['omschrijving'])){
	$omschrijving = $_POST['omschrijving'];
	$omschrijving = trim($omschrijving);
	$lengte_omschrijving = strlen($omschrijving);
	if(($lengte_omschrijving > 1)){
		$valid_omschrijving = true;
	}else{
		$valid_omschrijving = false;
	}
}else{
	$valid_omschrijving = false;
}

if($verzenden && $valid_naam && $bestaat_niet && $valid_introductie && $valid_omschrijving){
	
	$url = friendlyURL($naam);
	
	$naam = utf8_decode($naam);
	$naam = htmlentities($naam);
	
	$naam = checkData( $naam ) ;
	$introductie = checkData($_POST['introductie']);
	$omschrijving = checkData($_POST['omschrijving']);
	
	$q_account = sprintf("UPDATE kms_categories SET categorie_name = '%s', introduction = '%s', description = '%s', url = '%s' WHERE kms_categories.categorie_id='%s'", 
	$naam,
	$introductie,
	$omschrijving,
	$url,
	$categorie_id);
	
	$r_account = mysql_query($q_account);
	
	if($r_account){	
	
		echo("Categorie succesvol gewijzigd!<br /><br />");
		echo("<a href=\"index.php?p=categorie_overzicht\" title=\"Terug naar het overzicht\">Terug naar het overzicht</a>");
		
	}else{
		echo("Er is iets fout gegaan.");
	}
	
}else{
?>

<h1>Categorie wijzigen</h1>
<p>Vul onderstaande gegevens in om een categorie te wijzigen.</p>
<span class="label">* = verplicht</span><br /><br />
<form action="<?php $_SERVER['PHP_SELF']; ?>" id="aanmelden" name="aanmelden" method="post">
    	    
	<div>
        <label>Categorie naam*</label>
		<input name="naam" value="<?php echo($naam) ?>" />
        <?php if(!$valid_naam && $verzenden){ print("<span class=\"error\"> (foutieve invoer)</span>"); }?>
        <?php if(!$valid_naam && $verzenden && $te_lang_naam){ print("<span class=\"error\"><br />(invoer te lang)</span>"); }?>
        <?php if($valid_naam && $verzenden && !$bestaat_niet){ print("<span class=\"error\"><br />(de categorie bestaat al)</span>"); }?><br />
              
  <br />
        
		<label>Introductie* <?php if(!$valid_introductie && $verzenden){ echo("<span class=\"error\"> (foutieve invoer)</span>"); }?></label><br /><br />
<?php
// Create class instance.
$CKEditor_intro = new CKEditor();

// Do not print the code directly to the browser, return it instead
$CKEditor_intro->returnOutput = true;

// Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
//   $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor_intro->basePath = 'ckeditor/';

// Set global configuration (will be used by all instances of CKEditor).
$CKEditor_intro->config['width'] = 400;
$CKEditor_intro->config['toolbar'] = 'Basic';

// Change default textarea attributes
$CKEditor_intro->textareaAttributes = array("cols" => 80, "rows" => 10);

// The initial value to be displayed in the editor.
$initialValue_intro = $introductie;


// Create first instance.
$code_intro = $CKEditor_intro->editor("introductie", $initialValue_intro);

echo $code_intro;
			?>
            
        <br />
        
        <p style="width:560px;"><em><strong>Opmerkingen:</strong> Door in de editor op "enter" te drukken wordt een nieuwe paragraaf gestart.
        Wanneer u een "normale enter" wilt zetten kan dit via de combinatie "shift" + "enter".</em></p>
        
        <br />
            
        <label>Omschrijving* <?php if(!$valid_omschrijving && $verzenden){ echo("<span class=\"error\"> (foutieve invoer)</span>"); }?></label><br /><br />
<?php
// Create class instance.
$CKEditor = new CKEditor();

// Do not print the code directly to the browser, return it instead
$CKEditor->returnOutput = true;

// Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
//   $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = 'ckeditor/';

// Set global configuration (will be used by all instances of CKEditor).
$CKEditor->config['width'] = 600;
$CKEditor->config['toolbar'] = 'Basic';

// Change default textarea attributes
$CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);

// The initial value to be displayed in the editor.
$initialValue = $omschrijving;


// Create first instance.
$code = $CKEditor->editor("omschrijving", $initialValue);

echo $code;
			?>
            
        <br />
        
        <p style="width:560px;"><em><strong>Opmerkingen:</strong> Door in de editor op "enter" te drukken wordt een nieuwe paragraaf gestart.
        Wanneer u een "normale enter" wilt zetten kan dit via de combinatie "shift" + "enter".</em></p>
        
        <br />
      
       <br /><br />
           
        <input name="verzenden" type="submit" value="Wijzigen" class="submit" />
        <a class="submit_annuleren" href="index.php?p=categorie_overzicht" title="Annuleren">Annuleren</a>
	</div>
</form>

<?php
}
?>