Skip to content

Commit

Permalink
Noticed glaring bug in insert semantics.. needs to be fixed
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@20 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Dec 5, 2000
1 parent 25b1552 commit 75e66c4
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions report_add.php3
Expand Up @@ -28,17 +28,25 @@

### required fields ok, proceeding
if ( !$check_failed ) {
$query = "SELECT *
### Get user id
$query = "SELECT id
FROM $g_mantis_user_table
WHERE cookie_string='$g_string_cookie_val'";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v" );
$result = db_mysql_query( $query );
$u_id = mysql_result( $result, 0 );

### Make strings safe for database
$f_summary = string_safe( $f_summary );
$f_description = string_safe( $f_description );
$f_additional_info = string_safe( $f_additional_info );
$f_steps_to_reproduce = string_safe( $f_steps_to_reproduce );
$f_os = string_safe( $f_os );
$f_osbuild = string_safe( $f_osbuild );
$f_platform = string_safe( $f_platform );
$f_version = string_safe( $f_version );
$f_build = string_safe( $f_build );

### Insert text information
$query = "INSERT
INTO $g_mantis_bug_text_table
( id, description, steps_to_reproduce, additional_information )
Expand All @@ -47,24 +55,27 @@
'$f_additional_info' )";
$result = mysql_query( $query );

### MAJOR BUG!!! WHAT IF MULTIPLE REPORTS AT SAME TIMES?!?!?
### FIX ME### FIX ME### FIX ME### FIX ME### FIX ME### FIX ME
### Get the id of the text information we just inserted
$query = "SELECT id
FROM $g_mantis_bug_text_table
ORDER BY id DESC
LIMIT 1";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
$id = $row["id"];
$t_id = mysql_result( $result, 0 );

### Insert the rest of the data
$query = "INSERT
INTO $g_mantis_bug_table
( id, reporter_id, handler_id, duplicate_id, priority, severity,
reproducibility, status, resolution, projection, category,
date_submitted, last_updated, eta, bug_text_id, os, os_build,
platform, version, build, votes, summary )
VALUES
( null, '$v_id', '0000000', '0000000', 'normal', '$f_severity',
( null, '$u_id', '0000000', '0000000', 'normal', '$f_severity',
'$f_reproducibility', 'new', 'open', 'minor fix', '$f_category',
NOW(), NOW(), NOW(), '$id', '$f_os', '$f_osbuild',
NOW(), NOW(), NOW(), '$t_id', '$f_os', '$f_osbuild',
'$f_platform', '$f_version', '$f_build',
1, '$f_summary' )";
$result = mysql_query( $query );
Expand Down

0 comments on commit 75e66c4

Please sign in to comment.