Jump to content

bigjoe11a

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Posts posted by bigjoe11a

  1. In my project. I wanted an option that was going to give me more control over what my users can and could not do. I fount a ACL Sample and well the guy that made this must have been drunk. Any way I been working with it and putting it together so that it will work. The problem is that when I view the users current permissions it doesn't seem to display then right. Blow is the code i have in a switch that I use to manage each users permissions. The $_GET['uid'] gets the users id from the URL in the admin section.

     

    case "manage":
        
        	//$userACL = new ACL($_GET['uid']);
            $userACL = new ACL($_GET['uid']);
        	echo '<h2>Managing '.$userACL->getUsername($_GET['uid']).'</h2>';
            echo '... Some form to edit user info ...';
            echo '<h5>Roles for user:   (<a href="users.php?action=roles&uid='.$_GET['uid'].'">Manage Roles</a>)</h5>';
            echo '<ul>';
            $roles = $userACL->getUserRoles($_GET['uid']);
    	foreach ($roles as $k => $v)
    	{
    		echo "<li>" . $userACL->getRoleNameFromID($v) . "</li>";
    	}
    
            echo '</ul>';
            echo '<h6>Permissions for user:   (<a href="users.php?action=perms&uid='.$_GET['uid'].'">Manage Permissions</a>)</h6>';
            echo '<ul>';
            
            //$uparms = $userACL->getAllPerms($_GET['uid']);
            //$uPerms = $userACL->getUserPerms($_GET['uid']);
            //$aPerms = $userACL->getAllPerms('full');
            $aPerms = $userACL->perms;
    	//foreach ($perms as $k => $v)
            foreach($aPerms as $k => $v)
    	{		  
    	    //echo 'fdfdsfsd :'. $v['value'];
    		//if ($v['value'] == false) { continue; }
                if($v['value']) { // if (!$v['value']) { continue; }
    		echo "<li>" . $v['Name'] . ' : Allowed </li>';
    		//if ($v['inheritted']) { echo "  (inheritted)"; }
    
                } else {
                echo "<li>" . $v['Name'] . ' : Deny </li>';
                }            
                
               	echo "</li>";
    	}		
            echo '</ul>';       
       
    break;
        
    

     

    If any one needs any extra info. Please let me know.

     

     

  2. Ignoring the fact that this isn't a good idea in the first place, the issue is likely quoting.  You need mysql_real_escape_string().

     

    Explain. Why won't it be a good idea. Since there are CMS in PHP that use this option. and can you give me a sample of how to use mysql_real_escape_string().

     

  3. What I'm trying to do is insert a HTML page into a mysql database and with no luck. Can some one show me how to do this.

     

    insert  into 'templates'('name','template') values ('header','
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <script language="javascript" src="click.js"></script>
    <link href="styles.css" rel="stylesheet" type="text/css">
    
    <title>{SITE_TITLE}</title>
    
    </head>
    <body>
    
    <table width="99%" align="center" height="82" border="0" cellpadding="0" cellspacing="0" class="header">
    <tr>
      <td align="center"><h1>{SITE_NAME}</h1></td>
    </tr>
    </table>
    ');
    
    

     

  4. 1) No I don't expect any one to do any thing

    2) This forum section is a joke

    3) This forum section is being added to my blacklist

    4) Just delete or remove my account. Since no one is wanting to even try and help

     

     

  5. We aren't here to provide people with fully tested, guaranteed-to-be-working code on demand. If you want that, I'd suggest you pay someone to write it for you.

     

    Right, and that's a joke. The idea of having a forums section is to help people. Not charge them for what they may or may not need. If that's the case, Your joke is in poor taste.

     

     

     

  6. Thanks Night, Your not getting the idea. I'm looking into adding template system to the project that I'm working on how.

     

    See a Template can not be a PHP page. Ok, A template is all nothing but HTML with some CSS. Like using front page.  You would use front page to create a form. Or a HTML page. Then you would insert that into a mysql database. and Then you would display that form when you needed it. This option is added in all types of forums Like XMB, SMF and many others too.

     

    I'm sorry there is no other way to explain this so you can under stand.

     

    If your run a forums section. In the Admin Section. There should be an option to create, edit and delete Templates. Try looking at that if you have that option

     

    Joe

     

  7. Thanks, Night, How ever untested code never works and well your doesn't work. I don't see any since in making some thing that's unsetted and you should all ways test your code before posting it. I was getting all kinds of errors. I never done any thing like this before so I have no idea on how to  fix your code or my code.

     

    See the idea is that I have 3 settings in a mysql database. The idea is too turn thoses 3 settings on or off on the setting.php page, With not having to edit the page it self.

     

    if($settings['banner'] == 'off') {

    echo 'This are is closed';

    exit;

    }

     

    if($settings['banner'] == 'on') {

    echo '<a href="banner.php">Banner</a>';

    }

     

     

    any way get the idea.

     

    and one more question, ehy does this edit jump all over the place. I can't even be sure of what I'm typing

     

    Joe

     

     

  8. 1) You should be developing with error_reporting set to -1 and display_errors set to On

    2) $temp1 and $temp3 are undefined.

    3) This query string has syntax errors, attempts to set the same field to a different value 3 times and probably needs a WHERE clause:

    $db->query("'UPDATE '".SETTINGS_TABLE."' SET option='".$temp1."', option='".$temp2."', option='".$temp3."''");

     

    1) I don't know how to do that

     

    At the top of your script, put:

     

    <?php
    error_reporting(-1);
    ini_set("display_errors", 1);
    ?>

     

    Also, Google and the PHP manual are your friends.  If you don't know something, always search there.

     

    2) Yes I know that. That's why I'm asking for help.

    3) I know, that. The vars come form the form it self. Just above that line I added 3 $temp? = $_POST['name'];

     

    You seem to be very confused about what your form contains and how to pass that info along to the db.  You should probably show us the form itself so we can see exactly what your db query should be.

     

    Also, since you're using a DbConnector object, you most likely don't have to write:

     

    $db->DbConnector();

     

    An object's constructor is called automatically when one asks for a new object (e.g. $db = new DbConnector(); ).

     

    The form your asking for is all ready included with that PHP script above.

    I added the form to the PHP and then just have the script call the same script.

     

    and I'll try and add that error option to the top of my script and see what happens. It's like I said I never done this in PHP before and it all new to me. I been coding PHP for 4 years and I think it's about time I learn how to do more advance PHP.

     

  9. 1) You should be developing with error_reporting set to -1 and display_errors set to On

    2) $temp1 and $temp3 are undefined.

    3) This query string has syntax errors, attempts to set the same field to a different value 3 times and probably needs a WHERE clause:

    $db->query("'UPDATE '".SETTINGS_TABLE."' SET option='".$temp1."', option='".$temp2."', option='".$temp3."''");

     

    1) I don't know how to do that

    2) Yes I know that. That's why I'm asking for help.

    3) I know, that. The vars come form the form it self. Just above that line I added 3 $temp? = $_POST['name'];

     

     

  10. I add that in the code. I psted my new code below, and it passes nothing, Nothing at all

     

    <link href="mainframe.css" rel="stylesheet" type="text/css">
    
    <?php
    require_once '../config.php';
    
    $db = new DbConnector();
    $db->DbConnector();
    
    if(isset($_POST['Submit'])) {
    
    print_r($_POST);
    exit;
    
    $temp2 = $_POST['name'];
    
    $db->query("'UPDATE '".SETTINGS_TABLE."' SET option='".$temp1."', option='".$temp2."', option='".$temp3."''");	
      echo 'Process complete';	
    }
    
    $result = $db->query('SELECT * FROM '.SETTINGS_TABLE);
    
    echo '<table border="2">';
    echo '<tr>';
    
    echo '<form action="settings.php" methed="post">';
    
    while($row = $db->fetchArray($result))
      {
       
      echo '<tr>';
      echo '<td>'.$row['setname'].'</td><td><select size="1" name="'.$row['setname'].'">';
      
      if($row['option'] == 'on') {  
      echo '<option value="on" selected>on</option>';
      } else {
     echo '<option value="on">on</option>'; 
      }   
      if($row['option'] == 'off') {
      echo '<option value="off" selected>off</option>';
      }  else {
     echo '<option value="off">off</option>'; 
      }
      echo '</select>';
      echo '</td>';  
      echo "</tr>";
      }
      echo '<td><input type="submit" value="Submit" name="Submit">';
      echo '</td>';
    
    echo "</tr>";
    echo "</form>";
    echo "</table>";
    
    /*
    */
    
    ?>
    
    <h2>Settings</h2>
    
    <a href = "admin.php">Admin Panel</a>
    
    
    

     

  11. for starters you're posting the form variables and trying to retrieve them with $_GET

    if(isset($_GET['submit'])) {
    //this line should be
    if(isset($_POST['Submit'])) {
    

     

    Ok, that's one thing fixed. I hope. can you help me with the rest of it.

     

  12. what I'm trying to do is to setup a page called settings.php that the admin runs to order to turn option in the web site on or off. I don't know how to do this since I never done this before. My code is below.

     

    <link href="mainframe.css" rel="stylesheet" type="text/css">
    
    <?php
    require_once '../config.php';
    
    $db = new DbConnector();
    $db->DbConnector();
    
    
    if(isset($_GET['submit'])) {
    
    $db->query('UPDATE '.SETTING_TABLE.' SET option='.$_POST['banner'].' WHERE setname=''');
    
      echo 'Process complete';	
    }
    
    $result = $db->query('SELECT * FROM '.SETTINGS_TABLE);
    
    echo '<table border="1">';
    echo '<tr>';
    
    echo '<form action="settings.php" methed="post">';
    
    while($row = $db->fetchArray($result))
      {
       
      echo '<tr>';
      echo '<td>'.$row['setname'].'</td><td><select size="1" name="'.$row['setname']'">';
      echo '<option value="on">on</option>';
      echo '<option value="off">off</option>';
      echo '</td>';  
      echo "</tr>";
      }
      echo '<td><input type="submit" value="Submit" name="submit">';
      echo '</td>';
    
    echo "</tr>";
    echo "</form>";
    echo "</table>";
    
    /*
    */
    
    ?>
    
    <h2>Settings</h2>
    
    <a href = "admin.php">Admin Panel</a>
    
    
    

     

  13. You have me all so lost. Let me show you some thing, Ok. I have 2 web sites and both of then use templates from a mysql database. In my forums section. I was reading threw some of the code. and well it doesn't match what you have or any where near it.

     

    The function below is what loads the templates. Ok. keep reading.

    function loadtemplates() {
        global $db, $table_templates;
    
        $num = func_num_args();
        if ($num < 1) {
            echo 'Not enough arguments given to loadtemplates() on line: '.__LINE__;
            return false;
        } else {
            $namesarray = array_unique(array_merge(func_get_args(), array('header', 'css', 'error', 'footer', 'footer_querynum', 'footer_phpsql', 'footer_totaltime', 'footer_load')));
            $sql = "'".implode("', '", $namesarray)."'";
            $query = $db->query("SELECT name, template FROM $table_templates WHERE name IN ($sql)");
            while ($template = $db->fetch_array($query)) {
                templatecache(X_CACHE_PUT, $template['name'], $template['template']);
            }
        }
    }
    

     

    Now the code below gets added to the page you need to use the templates on. So lets say if I have an index.php and I needed the templates for the index.php it would look some thing like this

     

    loadtemplates(
    'template_header',
    'template_navbar',
    'template_rightcolumn',
    'template_content',
    'template_footer'
    );
    

     

    This I hope will give you a better idea then it has with me. I just don't under stand any of this. Then again I been a PHP coder for over 4 years and I think it's about I learn this.

     

    Now in a folder called include. there will be a file called header.php. This is used for ?, I don't know. That I don't get, I'm still studying it.

     

    I think it loads the CCS and any thing else. that may be required. Like I said I still trying to under stand it and that's not easy.

     

    Joe

     

     

  14. So where are you stuck, exactly? Post your current code and a description of the problems you're having, along with any errors that are being returned when the code executes.

     

    Ok, That's where I'm stuck at, getting started. See the page I have set up doesn't have any thing like this. That's why I wanted to add it. So I can add options and disable and enable things right from the admin page.

     

    As for doing the settings. I think I can do that. As for the template setup. I'm all so lost.

    I do know that I have to make a table in the mysql database

     

    DB Name : mapnet

    Table Name : templates

    -->ID

    -->template_name

    -->text

     

    The template name will hold the name of the template to load.

    The text is what holds the template as HTML code.

     

    sample

    template_name : header

    text:

    <table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="$THEME[bordercolor]">

    <tr>

    <td>

    <table border="0" cellspacing="0" cellpadding="0" width="100%">

    <tr class="category">

    <td><strong><font color="yellow">HEADER</font></strong></td>

    </tr>

    <tr>

    <td bgcolor="black">

    <font>HEADER</font>

    </td>

    </tr>

    </table>

    </td>

    </tr>

    </table>

     

    The above HTML using a HTML Table is just a sample.

     

    Now the problem is. Is how to load this in so that it can be displayed.

     

     

     

     

  15. Yes, That's the idea. It's called a template system in PHP. This forum is in PHP and it has templates that are added to the mysql database that it reads and then displays that page.

     

    This text box is a template too. It reads it from a mysql database and then displays it so you can type in the text box. A template is bothing but HTML or PHP.

     

     

     

  16. I tried posting in your PHP forums and no one knew what I was talking about. It areas of PHP scripting and so on. I would like to see an forum section related to more advance sections for PHP, HTML, CSS and so on.

     

    When I said some thing about templates and mysql database, No one knew what I was talking about. So I think an area for Advance scripting would be a great idea.

     

    Joe

     

  17. This is the best PHP site that I've found. If you're not getting your answer, then maybe you're not asking the right question.

     

    You're not going to find help by insulting the forum.

     

    Denno

     

    Denno, If I wanted to insult the forums section I never would have registered. The problem is that you should all ready know what a template is and what a mysql database is.

     

    The templates are loaded from the database and then display on the page. There's no other way to explain this.

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