Jump to content

bloodgoat

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bloodgoat's Achievements

Member

Member (2/5)

0

Reputation

  1. Is this possible? The array format is like this: <?php $array = array(); ?> <?php $array[] = array("value 1"); ?> <?php $array[] = array("value 2"); ?> <?php $array[] = array("value 3"); ?> How would I, strictly with PHP and no databasing, sniff through the array to find, "value 2" for example, and use fwrite to abolish it?
  2. Have an input field to add IP addresses to ban list. I just need to know how to filter it to make sure that the syntax was correct (eg/ xxx.xx.xx.xxx).
  3. Umm. Try coding your template in table format and use cellpadding="0" and cellspacing="0".
  4. Example of how simple it can be: index.php <?php $content = file_get_contents("/path/to/main/directory/".$_GET['page'].".html"); $template = <<< html <html> <head> <title></title> </head> <body> <!-- your template up until the point the content table cell is created --> <!-- content table cell would start here --> $content <!-- content table cell would end here --> <!-- and the rest of your layout after the content table cell is closed --> </body> </html> html; echo $template; ?> Then pages would be along the lines of, index.php?page=whatever_the_filename_is Each content page would now only need to hold whatever content you wanted to be displayed. This is about as simple as it gets, imo.
  5. <?php foreach ($a_navi as $key => $value) { $value_keys = array_keys($value); echo $key . ': ' . implode(' | ', $value_keys); } ?> Literal copy and paste, this was the output: 0: General1: IP Log2: IP Bans I figured it out anyways. I had to put each key into it's own array, and then create an array for that key afterwards. Basically just changed this: <?php $a_navi = array( "General" => array( array("Configure", "config", "Modify your over-ride username, associated IP address, administrative panel password, date- and time-stamp formats, and paths to key files"), array("Clear Global Chat", "chat&do=clear", "Clear the global chat log") ) // as well as my other arrays, just using one for the example ); ?> To this: <?php $a_navi = array( array("General" => array( array("Configure", "config", "Modify your over-ride username, associated IP address, administrative panel password, date- and time-stamp formats, and paths to key files"), array("Clear Global Chat", "chat&do=clear", "Clear the global chat log") )) ); ?> And added a third loop. It displays just how I wanted it to, now.
  6. I keep getting numeric output from that. And I didn't even know about the array_keys() function, oh boy. I tried using that on the main page of the admin panel as sort of a test, with this code: <?php $title = "Main Panel"; $content .= "\n<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" width=\"900\" align=\"center\">"; foreach($a_navi as $a_key => $a_panel){ $a_key = array_keys($a_navi); $content .= "\n <tr>". "\n <td colspan=\"2\" class=\"f_head\">".$a_key."</td>". "\n </tr>"; foreach($a_panel as $a_pan){ $content .= "\n <tr>". "\n <td width=\"20%\" class=\"apleft\"><a href=\"?action=admin&est=".$a_pan[1]."\">".$a_pan[0]."</a></td>". "\n <td width=\"80%\" class=\"apright\">".$a_pan[2]."</td>". "\n </tr>"; } } $content .= "\n <tr>". "\n <td class=\"apfoot\" colspan=\"2\"> </td>". "\n </tr>". "\n</table>"; ?> And it just output this: http://i204.photobucket.com/albums/bb303/img0t/Untitled-2.png The horizontal navigation towards the top shows how it is pre-array_keys() and the actual table is post-array_keys().
  7. OHH, I think you're misconstruing how I want the output to be displayed. Here, I'll throw in some line breaks a little more symbol-work so you see how I want the output. Current: Desired: Like, each key is a header for it's own navigational segment, and the "|" separates each link in that segment. So both "Clear Global Chat" and "Configure" are under the "General" header. But disregarding all of this... I still can't get the keys to display themselves as themselves, not their numeric association. AHHHH
  8. Wouldn't this end up requiring an unnecessary amount of loops? And if I had enough configure options for it to be recognized as it's own category, I would, but as it stands, "config" is it's just own file with only a few variables that are going to be readily edited. Aside from that, would it at all fix my problem? Or would I still be getting numeric value displays?
  9. Pretty much. This code: <?php $a_navi = array( "General" => array( array("Configure", "config", "Modify your over-ride username, associated IP address, administrative panel password, date- and time-stamp formats, and paths to key files"), array("Clear Global Chat", "chat&do=clear", "Clear the global chat log") ), "IP Log" => array( array("View", "ip_log&do=view", "View the log of IP addresses associated with invalid administrative login attempts"), array("Clear", "ip_log&do=clear", "Clear the log of IP addresses associated with invalid administrative login attempts"), ), "IP Bans" => array( array("Clear", "ip_bans&do=clear", "Clear the current IP ban list"), array("View", "ip_bans&do=view", "View the current ban list"), array("Add", "ip_bans&do=add", "Add a new IP to the current ban list") ) ); sort($a_navi); foreach($a_navi as $a_key => $a_linkk){ $a_links .= $a_key; foreach($a_linkk as $a_link){ $a_links .= "<a href=\"?action=admin&est=".$a_link[1]."\">".$a_link[0]."</a> | "; } } $a_links = substr($a_links, 0, -3); ?> Outputs like this: When I want it to output with the actual key name instead of it's numeric value, like this:
  10. I wasn't even confident if the first way was a proper method until I tried it. All my values seemed to be returned fine. I was mostly just being lazy. Regardless, even trying the second way, I'm still getting numeric value returns, which I don't want. I'm trying to use the keys as classification headers for the navigation, and "0", "1", and "2" are terrible classifications at best.
  11. Is it at all possible this way? <?php $a_navi = array(); $a_navi["IP Bans"] = array("Add", "bans&do=add", "Add a new IP to the current ban list"); $a_navi["IP Bans"] = array("View", "bans&do=view", "View the current ban list"); $a_navi["IP Bans"] = array("Clear", "bans&do=clear", "Clear the current IP ban list"); $a_navi[] = array("Configure", "config", "Modify your over-ride username, associated IP address, administrative panel password, date- and time-stamp formats, and paths to key files"); $a_navi["IP Log"] = array("View", "ip_log&do=view", "View the log of IP addresses associated with invalid administrative login attempts"); $a_navi["IP Log"] = array("Clear", "ip_log&do=clear", "Clear the log of IP addresses associated with invalid administrative login attempts"); $a_navi[] = array("Clear Global Chat", "chat&do=clear", "Clear the global chat log"); sort($a_navi); ?> Or would I have to do it the other way? <?php $a_navi = array( "IP Log" => array( array("View", "ip_log&do=view", "etc etc"), array("Clear", "ip_log&do=clear", "etc etc"), ), "IP Bans" => array( array("Clear", "ip_bans&do=clear", "etc etc"), array("View", "ip_bans&do=view", "etc etc"), array("Add", "ip_bans&do=add", "etc etc") ) ); ?> And even doing it the second way, I keep getting integers instead of the actual value (IP Bans, IP Log, etc).
  12. Trying to make a function to create a file if it doesn't exist with a specified filename and specified array name in the function parameters. Here's my function as it is: <?php function create($file,$array){ $new = "<?php \$array = array(); ?>"; $h = fopen($file, "w+"); fwrite($h, $new); fclose($h); header("Location: ".$index); } ?> And when I call my function: <?php if(!file_exists($chat)){ create($chat, $post); } ?> But when I run it, it just creates the file with: <?php $array = array(); ?> Instead of (what I want): <?php $post = array(); ?>
  13. <?php // BBCode function function BBCode($post){ $post = htmlentities($post); $bbcodes = array(); $bbcodes[] = array("~@\d+~", "<a href=\"#post_$1\">@$1</a>"); $bbcodes[] = array("#\[b\](.*?)\[/b\]#is", "<b>$1</b>"); $bbcodes[] = array("#\[i\](.*?)\[/i\]#is", "<i>$1</i>"); $bbcodes[] = array("#\[url=(.*?)\](.*?)\[/url\]#i", "<a href=\"$1\" target=\"_blank\">$2</a>"); $bbcodes[] = array("#\[url\](.*?)\[/url\]#i", "<a href=\"$1\" target=\"_blank\">$1</a>"); $bbcodes[] = array("#\:as\:#i", "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/as.png\">"); $bbcodes[] = array("#\:a-boo\:#i", "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/boo_as.png\">"); $bbcodes[] = array("#\:a-link\:#i", "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/link_as.png\">"); $bbcodes[] = array("#\:a-snake\:#i", "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/snake_as.png\">"); foreach($bbcodes as $replace){ $post = preg_replace($replace[0], $replace[1], $post); } return $post; } // And when the posts are called for($i=0;$i<count($post);$i++){ $post[$i][3] = BBCode($post[$i][3]); } ?>
  14. I meant the id of the name="" value was the post number, not that it was using the actual id="" tag. But thanks, I'll try this Edit: Same thing is happening. It's only anchoring the # symbol in the actual href="" portion, but instead of displaying a linkable @ symbol as well as the originally posted number after it in-between the <a> and </a> tags, the numbers have vanished. Still kind of at square one.
×
×
  • 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.