Jump to content

strange link !


lofaifa

Recommended Posts

i have a form here that redirect to : "proc/edit.php?edit=<?php echo urlencode($function_name);?>"

 

<?php require_once("includes/functions.php");?>
<?php
session_start();
if (isset($_SESSION["user_name"])) { 
require_once("includes/connection.php");
if(isset($_GET['functions'])){
$function_name=$_GET['functions'];
$function_type=$_GET['type'];
$query = "SELECT * 
          FROM functions
          WHERE  function_name = '{$function_name}'
          ";
$result = mysql_query($query,$connection);
if($result){
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$function_description=$row['function_description']; ?>
<html>
<head>
<title>Edit Your function</title>
</head>
<body>
<form name="edit_function_n" action="proc/edit.php?edit=<?php echo urlencode($function_name);?>" method="get">
Edit Your function name : <input type="text" name="new_function_name"/><br/><br/>
Edit Your description here :<br/><br/> <textarea name="new_function_description" rows="10" cols="30"></textarea><br/><br/>
<input type="submit" value="Change" /><br/><br/>
</form>
</body>
</html>

<?php 
}
elseif(!$result){ redirect("errors/error_db.html");}
}
}
else {
redirect("main.php?error=log");
}
//close connection!
mysql_close($connection);
?>

 

 

AND i have a proc php file that UPDATE the database with the new form variables and then redirect to show.php

 

<?php require_once("../includes/functions.php");?>
<?php
session_start();
if (isset($_SESSION["user_name"])) { 
require_once("../includes/connection.php");
//ignore this , this is for deleting!
if(isset($_GET['delete'])){
	//warning : using urldecode here is wrong cuz $_GET[var]; is already decoded!
	$function_to_delete=$_GET['delete'];
	$function_type=$_GET['functions'];
	$query="DELETE FROM functions
		WHERE function_name='{$function_to_delete}'
		";
	$result = mysql_query($query, $connection);
	if(!$result){redirect("../errors/error_db.html");}
elseif($result){
redirect("../show.php?functions={$function_type}&delete=suc");
}}

//the place for edit ! 
    elseif(isset($_GET['edit'])){
    $old_function_name=$_GET['edit'];
  	$new_function_name=$_POST['new_function_name'];
  	$new_function_description=$_POST['new_function_description'];
  	$query="UPDATE functions
            SET function_name='{$new_function_name}', 
            function_description='{$new_function_description}'
		WHERE function_name='{$old_function_name}'
		";
  $result = mysql_query($query, $connection);
	if(!$result){redirect("../errors/error_db.html");}
elseif($result){redirect("../show.php?functions='{$function_type}'&edit=suc");}
}


}
else {
redirect("../main.php?error=log");
}
?>
<?php //close connection!
mysql_close($connection);
?>

 

 

The problem is i get redirect to a strange link that never existed and i never pointed to :

 

/proc/edit.php?new_function_name=($new_function_name)&new_function_description=($new_function_description)

 

with the variables replaces with their values and with no database update whatsoever!

 

 

 

I tried a lot with it with no result could someone help me out here!

Link to comment
https://forums.phpfreaks.com/topic/252719-strange-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.