views:

67

answers:

3

https://docs.google.com/document/edit?id=1dL_Q2dAo4DuyaS9rVGM5tVPXW8vWZYOvrcfSbnOD-uk&hl=en

$num = $_GET['p'];
echo "Number: ".$num."  Other: ".$Other; ?>

How to insert ".$num." into

mysql_query("UPDATE `grass` SET `$num`='{$_POST['c2']}' "); }
A: 

please change :

<?php if(isset($_POST['c2'])){    
mysql_query("UPDATE `grass` SET `".addslashes(striptags($num))."`='".addslashes(strip_tags($_POST['c2']))."'"); }
     if(isset($_POST['kill2'])){
     mysql_query("UPDATE `grass` SET `".addslashes(strip_tags($num))."`='0'"); } ?>
john misoskian
Hmmm, its not updating data :( Why?
Nation
Sql ingection is a thing to be avoided.
Col. Shrapnel
Doesn't work and security issue.
Chouchenos
Even worst now.
Col. Shrapnel
:) if code writer know security add addslashes and striptags function. Sorry commenters , i can't think this guy newbie. :)... or using htmllawed xss framework and and and etc.
john misoskian
At this moment Im not thinking about security. At first I need to make script work for me. And I cant insert That fu.... $num into db
Nation
I can't say for this guy, but you know nothing of security
Col. Shrapnel
@Nation please paste your database structure.
john misoskian
Okey, I dont. And striptags is a function or something like that? What is under striptags?
Nation
http://tr.php.net/manual/en/function.strip-tags.php
john misoskian
oh yeah. it's a function. **and it has absolutely nothing to do here**. Because your advisor has absolutely no clue
Col. Shrapnel
Please try to See. However, this function is not using the exploit, the more you give some exploitable vulnerability. I am a having daily visitor 22,000,000 to the portal developer . and believe that we need to use it here.
john misoskian
@john: it's not an answer to his question...
iKid
A: 

I take it that $num is a column. Once the value is actually a column in grass then the query syntax looks fine in terms of inserting the value. However you really should have a where clause in your statement or every row will be changed. Maybe that is what you want but I doubt it.

Belinda
Nation
What output are you getting? Is it an error or is the table not being updated. What do you expect $_POST['c2'] to be?
Belinda
$_POST['c2'] = <input type="radio" value="1" name="c2" />
Nation
@Nation as a matter of fact your database design is terrible. You have to change it as soon as possible
Col. Shrapnel
Col. Shrapnel :D Okey, maybe you can show better way. :)
Nation
@Nation I did it already. Post your question here, not on the site that asks me to register.
Col. Shrapnel
Where it is?...
Nation
@Nation **the link you posted in your question asks me to register to see the contents**. Am I clear enough?
Col. Shrapnel
Okey, I changed it. Now you can work with it.
Nation
A: 

Tnx for all :) Problem was in: form action="" method="post">

Nation