Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Suggestions and Feature Requests

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 09-05-2011, 01:01 PM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 7,385
Chibi_Chicken is on a distinguished road
Default

So I started making the code changes to allow passwords then I went to the dentist and had a tooth pulled. After I have been under pain pills hallucinating about evil
ducks taking over the world. Just not a state of mind to code in. ^.^;;

I am feeling better now so here is what I came up with. As for the allowing the Mys admin to set the password, I will see how much work it will take to edit those pages.

As with any Mod remember to Back Up Your Site And Database!

first sql command add a place for the password.
Code:
ALTER TABLE `adopts_content` ADD `content_password` VARCHAR( 32 ) NOT NULL
then open inc/functions.php find
PHP Code:
function getsitecontent($page) {

    
$query "SELECT * FROM ".$GLOBALS['prefix']."content WHERE page = '$page'";

    
$result = @runquery($query);

    
$num = @mysql_num_rows($result);

        
$title=@mysql_result($result,0,"title");

        
$content=@mysql_result($result,0,"content");

        
$title stripslashes($title);

        
$content stripslashes($content);

    
$value[content] = $content;

    
$value[title] = $title;

    return 
$value;


replace it with
PHP Code:
function getsitecontent($page) {
  
    
$query "SELECT * FROM ".$GLOBALS['prefix']."content WHERE page = '$page'";

    
$result = @runquery($query);

    
$num = @mysql_num_rows($result);
    
//first check if their is any results if yes then pull the data
    
if($num>0){
        
$title=@mysql_result($result,0,"title");

        
$content=@mysql_result($result,0,"content");
        
$password=@mysql_result($result,0,"content_password");

        
$title stripslashes($title);

        
$content stripslashes($content);

    
$value['content'] = $content;

    
$value['title'] = $title;
    
$value['password'] = $password;
    return 
$value;
    }
    else{
    return 
FALSE;
    }


then replace your pages.php with this
PHP Code:
<?php

include("inc/functions.php");
include(
"inc/bbcode.php");

//***************//
//  START SCRIPT //
//***************//

// Grab the page from the get parameter
if (isset($_GET['page'])){
$page $_GET['page'];
}
else{
$page '';
}

//get the password if it has been sent
if (isset($_GET['password'])){
    
$password $_GET['password'];
    
$password secure($password); //secure has all ready ran on all of the get variables but I want to make sure it was called.
    
}
else{
$password '';
}
    
//check if their was sent a page if no then just set pagecontent to false
if($page !=''){    
    
$pagecontent getsitecontent($page);
}
else{
    
$pagecontent FALSE;
}

if(
$pagecontent != FALSE){
    
    
//now check if a password has been set for the page
    
if ($pagecontent['password'] == ''){
        
$article_title $pagecontent['title'];
        
$article_content $pagecontent['content'];

        
$article_content bbconvert($article_content); // BBCODE conversion

        
$article_content nl2br($article_content); // New line breaks
    
}
    else if (
$pagecontent['password'] != '' && $password !=''){
    
//their is both a password set and a password sumited check if they match
        
if($password == $pagecontent['password']){
            
//display content
            
$article_title $pagecontent['title'];
            
$article_content $pagecontent['content'];

            
$article_content bbconvert($article_content); // BBCODE conversion

            
$article_content nl2br($article_content); // New line breaks
        
}
        else{
            
$article_title "Password incorrect";
            
$article_content "The password you have submitted is incorrect.";
            }
    }
    else{
        
//their is a password set
        
$article_title "Password required";
        
$article_content '<form name="form" method="get" action="'.$_SERVER['PHP_SELF'].'">
        <input name="page" type="hidden"    id="page" value="'
.$page.'">
        <p><label for="password">Password:</label>
        <br /><input type="password" title="Enter your password" name="password" /></p>
        <p><input type="submit" name="Submit" value="Login" /></p>
        </form>'
;

    }
}
else{

    
// Page does not exist...

    
$article_title "404 Page Not Found";
    
$article_content "The page you are looking for cannot be found on this site.  
    It is possible that it never existed or that the site admin deleted it."
;

}

//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title$article_content'');//this page is not using the date so I removed it to stop Notice

?>
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forgotten password? Aasixx Questions and Supports 14 05-03-2012 05:46 PM
Password Reset keliptis Questions and Supports 4 02-10-2012 08:39 AM
[Bug] Admin Password as plaintext Inf3rnal Questions and Supports 6 09-15-2011 04:40 PM
Register with no password? Slix Questions and Supports 6 08-01-2011 12:26 PM


All times are GMT -5. The time now is 08:45 PM.

Currently Active Users: 3349 (0 members and 3349 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636