Raised This Month: $ Target: $400
 0% 

Changing a table's field


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 06-28-2010 , 18:13   Changing a table's field
Reply With Quote #1

Well im using SMF ( Simple Machine Forums) to change a specific field. I use a different page so they can change it, and it would automatically change that field in the database, but it won't work for some reason. Here is what I got so far (thanks to stewie )

PHP Code:
<?php
    $szSteamID 
$_POST["szSteamID"];
    
    if(
$szSteamID)
    {
        if(
preg_match("/^STEAM_0:[0-1]:[0-9]{1,9}$/"strtoupper($szSteamID)))
        {
            
mysql_connect("localhost""username""password");
            
mysql_select_db("databasename") or die(mysql_error());
            
     if(
mysql_query("UPDATE `smf_members` SET steam_id = '$szSteamID' WHERE member_name = '$szUser' AND passwd = '" base_encode($_POST["szPass"]) . "';"))
                echo 
"<p>Thanks. Your SteamID has been updated and you will now be able to play on our servers.</p>";
            else
                echo 
mysql_error();
        }
        else
            echo 
"<p>Please enter a valid SteamID.</p>";
    }
    else
    {
        echo 
"<form action='edit_steamid.php' method='post'>";
        echo 
"Name: <input name='szUser' type='text' value='username' /><br />";
        echo 
"Password: <input name='szPass' type='password' value='password' /><br />";
        echo 
"SteamID: <input name='szSteamID' type='text' value='SteamID' /><br />";
        echo 
"<input type='submit' value='Submit!' />";
        echo 
"</form>";
    }
?>
The required fields username, password, db name, are not shown for privacy reasons.

If anyone could help.

Edit: We also tried with md5, but it doesn't seem to work
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode