View Single Post
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