View Single Post
  #6  
Old 04-15-2008, 04:37 AM
shanni's Avatar
shanni shanni is offline
Corporal
 
Join Date: Feb 2008
Location: DownUnder Australia
Posts: 17
Default Re: I need a peice of code to let users display graphics

Okay, I was originally thinking that, but then I saw that code and thought, Maybe it was it....

Here is the script from the myself.php file, this is the file where Users will place their Data.

PHP Code:
/* Check Structure Availability */
    
if (!defined("CORE_STRAP")) die("Out of structure call");
    
    
    
$tpl = new template;
    
$tpl -> Load("myself");
    
$tpl -> GetObjects();
    
    
    if (
me("id")) {
        
        
$tpl -> Zone("main""enabled");
        
        
/* Load the questionaires list */
        
$uDat unpk(me("profile_data"));
        if (
$handle opendir("system/cache/questionnaires")) {
            
$i=0;
            while ((
$file readdir($handle)) !== false) {
                if (
$file != "." && $file != "..") {
                    
$qName base64_decode(str_replace(".dat"""$file));
                    
$questionaires[$i]["questionaire"] = $qName;
                    
$questionaires[$i]["id"] = str_replace(".dat"""$file);
                    
$questionaires[$i]["filled"] = (isset($uDat[$qName])?$GLOBALS["OBJ"]["filled"]:$GLOBALS["OBJ"]["unfilled"]);
                    
$i++;
                }
            }
            
closedir($handle);
            
$tpl -> Loop("questionaires"$questionaires);
       }
       
       
        
/* 
            Handle the submitted user data
        */
        
if (isset($_POST["submitUserData"])) {
            
            
$previousZipcode me("zipcode");
        
$bdArray me("birthdate");
        
$bdArray explode("/"$bdArray);
        
myQ("
                UPDATE `[x]users` SET
                    `quote`='{$_POST["quote"]}',
                    `header`='"
.strip_tags($_POST["header"])."',
                    `city`='{$_POST["city"]}',
                    `state`='{$_POST["state"]}',
                    `country`='{$_POST["country"]}',
                    `zipcode`='{$_POST["zipcode"]}',
                    `gender`='{$_POST["gender"]}',
                    `birthdate`='{$_POST["bmonth"]}/{$_POST["bday"]}/{$_POST["byear"]}',
                    `astrologic_sign`='',
                    `age`='"
._fnc("age""{$_POST["bmonth"]}/{$_POST["bday"]}/{$_POST["byear"]}")."' WHERE `id`='".me("id")."'
"
).
            
            
            
me("flush");
            
            if (
$previousZipcode != $_POST["zipcode"] && $CONF["GEOLOC_STRAPON_ZIPCHANGE"]) _fnc("geoLocalize"me("id"));
        }
        

        
/* find out the user's astrologic sign */
        
switch ($bdArray[0]) {
            case(
1):
                
$sign = ($bdArray[1] <= 19?"capricorn":"aquarius");
            break;
            case(
2):
                
$sign = ($bdArray[1] <= 19?"aquarius":"pisces");
            break;
            case(
3):
                
$sign = ($bdArray[1] <= 20?"pisces":"aries");
            break;
            case(
4):
                
$sign = ($bdArray[1] <= 20?"aires":"taurus");
            break;
            case(
5):
                
$sign = ($bdArray[1] <= 21?"taurus":"gemini");
            break;
            case(
6):
                
$sign = ($bdArray[1] <= 22?"gemini":"cancer");
            break;
            case(
7):
                
$sign = ($bdArray[1] <= 23?"cancer":"leo");
            break;
            case(
8):
                
$sign = ($bdArray[1] <= 23?"leo":"virgo");
            break;
            case(
9):
                
$sign = ($bdArray[1] <= 23?"virgo":"libra");
            break;
            case(
10):
                
$sign = ($bdArray[1] <= 24?"libra":"scorpio");
            break;
            case(
11):
                
$sign = ($bdArray[1] <= 22?"scorpio":"sagittarius");
            break;
            case(
12):
                
$sign = ($bdArray[1] <= 22?"sagittarius":"capricorn");
            break;
        }
    
        
myQ("UPDATE `[x]users` SET `astrologic_sign`='{$sign}' WHERE `id`='".me('id')."'");


        
        
/*
            Handle a password change post.
        */
        
if (isset($_POST["changePassword"])) {
            
            
/*
                Does the ACTUAL password matches the password
                we have in the database? (We want to prevent 
                "floating" (open sessions) users to change the
                password of another user with that function.
            */
            
if (md5($_POST["actualPassword"]) == me("password")) {
    
                
/*
                    Is the password len longer than the minimum
                    allowed len?
                */        
                
if (strlen($_POST["newPassword"]) > $CONF["USERS_PASSWORD_MIN_LEN"]) {
                    
                    
/*
                        Is there any SPACE characters in the password?
                    */            
                    
if (!strpos($_POST["newPassword"], " ")) {
                    
                        
/*
                            Do both the password and password verification
                            fields value the same?
                        */
                        
if ($_POST["newPassword"] == $_POST["confirmPassword"]) {
                            
                            
/*
                                Everything is confirmed. Let's update the password
                                entry for that user
                            */
                            
myQ("UPDATE `[x]users` SET `password`='".md5($_POST["newPassword"])."' WHERE `id`='".me("id")."'");
    
                            
$tpl->Zone("passChangeMessage""success");
    
                        } else 
$tpl->Zone("passChangeMessage""noMatch");
    
                    } else 
$tpl->Zone("passChangeMessage""badFormat");
    
                } else 
$tpl->Zone("passChangeMessage""tooShort");
    
            } else 
$tpl->Zone("passChangeMessage""wrongPass");
        }
        
///////////////////////////// Age, Sex hack by Thunder /////////////////////////////////////
    
$genders explode(","$CONF["USERS_GENDERS"]);

    
$selectedGender me("gender");

    
$i=0;
    foreach (
$genders as $genderType) {

        if (
$genderType == $selectedGender){$genderReplacementArray[$i]["gender.option"] = "<option SELECTED value='$genderType'>$genderType</option>";$newGender=$genderType;}
        else 
$genderReplacementArray[$i]["gender.option"] = "<option  value='$genderType'>$genderType</option>";
        
$i++;
    }
    
$tpl -> Loop("genderOptionDropdown"$genderReplacementArray);


    
$bdArray me("birthdate");
    
$bdArray explode("/"$bdArray);
    
$tpl -> AssignArray(array(
    
"birth.month"=>$GLOBALS["OBJ"]["month_{$bdArray[0]}"],
    
"bmonth" => $bdArray[0],
    
"bday" => "<option SELECTED value='{$bdArray[1]}'>{$bdArray[1]}</option>",
    
"byear" => "<option SELECTED value='{$bdArray[2]}'>{$bdArray[2]}</option>"
    
));

///////////////////////////// Age, Sex hack by Thunder /////////////////////////////////////        
$tpl -> AssignArray(array(
            
"me.quote" => me("quote"), 
            
"me.header" => me("header")
        ));
        
        
$tpl -> ConvertSelf();
    
    }
    
    else {
        
$tpl -> Zone("main""guest");
        
_fnc("reload"3"?L");
    }
        
    
$tpl-> CleanZones();
    
$tpl -> Flush();
    
?> 
Am I wrong?
__________________
Social/business Networking
www.yapidi.com



Get YOUR Teeth into something new!!!!
Reply With Quote