Jump to content

bubblegum.anarchy

Members
  • Posts

    526
  • Joined

  • Last visited

    Never

Posts posted by bubblegum.anarchy

  1. Consider this:

     

    $result = mysql_query($query = sprintf("
         INSERT INTO checkbook_users (id, name, email, password) 
         VALUES (NULL, '%s', '%s', md5('%s'))"
              , mysql_real_escape_string($register_name)
              , mysql_real_escape_string($register_email)
              , mysql_real_escape_string($register_pw))) or trigger_error(mysql_error()."<PRE>".$query."</PRE>", E_USER_ERROR);
    

  2. Try something like this:

     

    $query = "
    INSERT INTO`creature_template` 
    (
    	`entry`,
    	`modelid_m`,
    	`modelid_f`,
    	`name`,
    	`subname`,
    	`minlevel`,
    	`maxlevel`,
    	`minhealth`,
    	`maxhealth`,
    	`minmana`,
    	`maxmana`,
    	`armor`,
    	`faction`,
    	`npcflag`,
    	`speed`,
    	`rank`,
    	`mindmg`,
    	`maxdmg`,
    	`attackpower`,
    	`baseattacktime`,
    	`rangeattacktime`,
    	`flags`,
    	`dynamicflags`,
    	`size`,
    	`family`,
    	`bounding_radius`,
    	`trainer_type`,
    	`trainer_spell`,
    	`class`,
    	`race`,
    	`minrangedmg`,
    	`maxrangedmg`,
    	`rangedattackpower`,
    	`combat_reach`,
    	`type`,
    	`civilian`,
    	`flag1`,
    	`equipmodel1`,
    	`equipmodel2`,
    	`equipmodel3`,
    	`equipinfo1`,
    	`equipinfo2`,
    	`equipinfo3`,
    	`equipslot1`,
    	`equipslot2`,
    	`equipslot3`,
    	`lootid`,
    	`pickpocketloot`,
    	`skinloot`,
    	`resistance1`,
    	`resistance2`,
    	`resistance3`,
    	`resistance4`,
    	`resistance5`,
    	`resistance6`,
    	`spell1`,
    	`spell2`,
    	`spell3`,
    	`spell4`,
    	`mingold`,
    	`maxgold`,
    	`AIName`,
    	`MovementType`,
    	`InhabitType`,
    	`ScriptName`
    ) 
    VALUES 
    (
    	'".mysql_real_escape_string($_POST['txtEntry'])."',
    	'".mysql_real_escape_string($_POST['txtmodelid_m'])."',
    	'".mysql_real_escape_string($_POST['txtmodelid_f'])."',
    	'".mysql_real_escape_string($_POST['txtname'])."',
    	'".mysql_real_escape_string($_POST['txtsubname'])."',
    	'".mysql_real_escape_string($_POST['txtminlevel'])."',
    	'".mysql_real_escape_string($_POST['txtmaxlevel'])."',
    	'".mysql_real_escape_string($_POST['txtminhealth'])."',
    	'".mysql_real_escape_string($_POST['txtmaxhealth'])."',
    	'".mysql_real_escape_string($_POST['txtminmana'])."',
    	'".mysql_real_escape_string($_POST['txtmaxmana'])."',
    	'".mysql_real_escape_string($_POST['txtarmor'])."',
    	'".mysql_real_escape_string($_POST['txtfaction'])."',
    	'".mysql_real_escape_string($_POST['txtnpcflag'])."',
    	'".mysql_real_escape_string($_POST['txtspeed'])."',
    	'".mysql_real_escape_string($_POST['txtrank'])."',
    	'".mysql_real_escape_string($_POST['txtmindmg'])."',
    	'".mysql_real_escape_string($_POST['txtmaxdmg'])."',
    	'".mysql_real_escape_string($_POST['txtattackpower'])."',
    	'".mysql_real_escape_string($_POST['txtbaseattacktime'])."',
    	'".mysql_real_escape_string($_POST['txtrangeattacktime'])."',
    	'".mysql_real_escape_string($_POST['txtflags'])."',
    	'".mysql_real_escape_string($_POST['txtdynamicflags'])."',
    	'".mysql_real_escape_string($_POST['txtsize'])."',
    	'".mysql_real_escape_string($_POST['txtfamily'])."',
    	'".mysql_real_escape_string($_POST['txtbounding_radius'])."',
    	'".mysql_real_escape_string($_POST['txttrainer_type'])."',
    	'".mysql_real_escape_string($_POST['txttrainer_spell'])."',
    	'".mysql_real_escape_string($_POST['txtclass'])."',
    	'".mysql_real_escape_string($_POST['txtrace'])."',
    	'".mysql_real_escape_string($_POST['txtminrangedmg'])."',
    	'".mysql_real_escape_string($_POST['txtmaxrangedmg'])."',
    	'".mysql_real_escape_string($_POST['txtrangedattackpower'])."',
    	'".mysql_real_escape_string($_POST['txtcombat_reach'])."',
    	'".mysql_real_escape_string($_POST['txttype'])."',
    	'".mysql_real_escape_string($_POST['txtcivilian'])."',
    	'".mysql_real_escape_string($_POST['txtflag1'])."',
    	'".mysql_real_escape_string($_POST['txtequipmodel1'])."',
    	'".mysql_real_escape_string($_POST['txtequipmodel2'])."',
    	'".mysql_real_escape_string($_POST['txtequipmodel3'])."',
    	'".mysql_real_escape_string($_POST['txtequipinfo1'])."',
    	'".mysql_real_escape_string($_POST['txtequipinfo2'])."',
    	'".mysql_real_escape_string($_POST['txtequipinfo3'])."',
    	'".mysql_real_escape_string($_POST['txtequipslot1'])."',
    	'".mysql_real_escape_string($_POST['txtequipslot2'])."',
    	'".mysql_real_escape_string($_POST['txtequipslot3'])."',
    	'".mysql_real_escape_string($_POST['txtlootid'])."',
    	'".mysql_real_escape_string($_POST['txtpickpocketloot'])."',
    	'".mysql_real_escape_string($_POST['txtskinloot'])."',
    	'".mysql_real_escape_string($_POST['txtresistance1'])."',
    	'".mysql_real_escape_string($_POST['txtresistance2'])."',
    	'".mysql_real_escape_string($_POST['txtresistance3'])."',
    	'".mysql_real_escape_string($_POST['txtresistance4'])."',
    	'".mysql_real_escape_string($_POST['txtresistance5'])."',
    	'".mysql_real_escape_string($_POST['txtresistance6'])."',
    	'".mysql_real_escape_string($_POST['txtspell1'])."',
    	'".mysql_real_escape_string($_POST['txtspell2'])."',
    	'".mysql_real_escape_string($_POST['txtspell3'])."',
    	'".mysql_real_escape_string($_POST['txtspell4'])."',
    	'".mysql_real_escape_string($_POST['txtmingold'])."',
    	'".mysql_real_escape_string($_POST['txtmaxgold'])."',
    	'".mysql_real_escape_string($_POST['txtAIName'])."',
    	'".mysql_real_escape_string($_POST['txtMovementType'])."',
    	'".mysql_real_escape_string($_POST['txtInhabitType'])."',
    	'".mysql_real_escape_string($_POST['txtScriptName'])."'
    )";
    

  3. Define the id as an auto_increment

     

    CREATE TABLE repository (
         id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'unique record identifier',
         value TEXT NULL DEFAULT NULL COMMENT 'repository value',
         primary_key (id)
    );

  4. see this bit of code (the problem code):

     

    $action = $_GET['action'];
    
    switch($action) {
    case 'read' :
    $sql = "SELECT * FROM '$table' where titleID = '$titleID'";
    $allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
    $numallComments = mysql_num_rows($allComments);
    

     

    add this line:

     

    print '<PRE style="text-align:left;">'; print_r($sql); die("<P>Script Halted...</P>"); print '</PRE>';
    

     

    so your code looks like this:

     

    $action = $_GET['action'];
    
    switch($action) {
    case 'read' :
    $sql = "SELECT * FROM '$table' where titleID = '$titleID'";
    print '<PRE style="text-align:left;">'; print_r($sql); die("<P>Script Halted...</P>"); print '</PRE>';
    $allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
    $numallComments = mysql_num_rows($allComments);
    

     

    and post the string stored in $sql... this is my first reply request.

  5. Some tables have a date_created column defined as a timestamp or datetime - I suggest that you add a simliar column if one does not already exists to the table in question.

     

    Then you can check the current timestamp against the stored value when updating the record, the final fail safe query would look something like this:

     

    UPDATE repository
    SET item = {$value}
    WHERE id = {$id} 
         AND date_created > CURRENT_TIMESTAMP - INTERVAL 10 MINUTES
    

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