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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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