Jump to content

Phenomena

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by Phenomena

  1. I found the solution, the rank was being stored as a string instead of an integer. >.< So I just used strcmp()
  2. I'm trying to sort a multidimensional array, but... its not working lol. It's rearranging the array but not in the order I want. I can't even tell what it's being sorted by. >_> My custom strcmp function to compare integers. function cmpi($a, $b) { if ($a["rank"] > $b["rank"]) return 1; elseif ($a["rank"] < $b["rank"]) return -1; else return 0; } building the array: $i=0; foreach($xml_guild_data->guildInfo->guild->members->character as $char) { $member[$i]["name"] = $char["name"]; $member[$i]["level"] = $char["level"]; $member[$i]["rank"] = $char["rank"]; $member[$i]["class"] = $char["classId"]; $i++; } and finally, sorting/generating html table usort($member, 'cmpi'); foreach($member as $mem) { ?> <tr> <td><? echo $mem["level"]; ?></td> <td><? echo $mem["name"]; ?></td> <td><? echo $mem["rank"]; ?></td> </tr> <? } ?> It should be sorting it be the members rank, which is assigned as an integer.
  3. thanks so much i got it working the only problem is that it also creates a link to the directory itself and to the sites homepage.
  4. Ok so what I'm trying to do is set up a directory that will contain a bunch of different web pages and have any web page in that one directory linked on the nav.php automatically. Lets say I have 3 files in my stuff/ directory, named file1.php, file2.php and file3.php. In the nav.php I want a script that will generate this html for every page <a href="/stuff/$file">$name</a> where $file is the file name in the directory, and $name is a variable defined within the file its self.
  5. I already have that setup, but i cant figure out how to detect if a word posted is in the db. anyways could I also get some C&C on my code, I would like to start coding a site but I want to make sure my code doesn't have too many secruity holes
  6. So I'm working on my first real php project. I'm still learning but I think im off to good a start. I started to create a simple chat room for learning purpose. (http://modhalotrial.com/php_stuff/chat_room) I just need help with a few things how do i create censored words (using the mysql db with the tables id, before, after) and an auto refresh for the chat because right now new posts only show up when you post or refresh heres my code (remember im still new at this so dont tear it shreds ) <?php require ('config.php'); mysql_connect ($server,$user,$pass) or die("Could not connect to server."); @mysql_select_db ($database); $user = $_POST['user2']; $post = $_POST['text']; $date = date("H:i:s"); $query = "INSERT INTO chat VALUES ('','$post','$date','$user')"; mysql_query($query); ?> <table border="2" cellpadding="5" width="650" height="600"> <tr> <td align="left" ><font size="2"> <?php $query2 = "SELECT * FROM chat"; $result = mysql_query($query2); $num = mysql_numrows($result); $i = 0; while ($i < $num) { $user3=mysql_result($result,$i,user); $chat=mysql_result($result,$i,message); $date=mysql_result($result,$i,date); echo "<b>$user3</b>, <i>$date</i> - $chat<br>"; $i++; } ?> </font> </td> <td align="center" width="175"> Chatters </td> </tr> <td colspan="2" align="center" height="65"> <form action="chat.php" method="post"> User: <input type="text" name="user2" value="<?php if ($user == "") { echo "Anonymous"; } else { echo $user; } ?>" onChange="this.value='Locked text!';" size=12 readonly> Message: <input type="text" name="text" size="50"> <input type="submit" value="Submit"> </form> <?php $n = 0; while ($n < 20) { $emot = "emoticons/$n.gif\""; echo "<img src=\"http://modhalotrial.com/php_stuff/chat_room/$emot>"; $n++; } ?> </td> </table>
  7. sorry for late reply, i did... well almost. Since i dont have enough knowledge of php to make my own, safe page. I decided to download a phpBB mod and change it around to work on my main page http://modhalotrial.com/test.php only problem is i need to read it from a certain forum, right now it just reads from every forum. There is something in the orginal phpBB mod to do this but you need to be able to create arrays. [code]// exclude forums from fetching // can be left blank to disable it, can contain a single forum id or an array // with multiple id's // $CFG['posts_exclude_forums'] = '';[/code] i dont know how to turn that into an array lol edit: never mind i got it :)
  8. just tried it and it still doesn't show up =\
  9. ugh, ive managed to compile a test script but its not working properly, i dont get any php errors but It doesnt display the rank title [code]$username="********"; $password="********"; $database="********"; mysql_connect(localhost,$username,$password); @mysql_connect_db($database) or die ("Unable to connect to the database."); $query="SELECT * FROM phpbb_ranks"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $first=mysql_result($result,$i,"rank_title"); echo "rank_title"; $i++; }[/code]
  10. Though this is my first time trying to create a whole new page with php, i do have a bit of experience through installing mods on my phpBB forums. Ive managed to get it so that im connected to the same database my phpBB forums are installed on. Now what I'm trying to do i get it so that the text from each post in a specific forum is displayed on the page. I can't seem to figure this out. Any help would be greatly appreciated.
×
×
  • 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.