Author Topic: Joomla+Mysql+php  (Read 894 times)

Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Joomla+Mysql+php
« on: June 09, 2009, 11:49:03 PM »
So i have a database I've been compiling for a game i currently play. I also have a Joomla based site composed for the group am currently with. I've been trying numerous add ons etc to make php function inside of joomla itself along with html. Has anyone done anything similar ? Am just basically just looking for a way to add pages to the site that allow me to display information from the data base for the time being
« Last Edit: June 10, 2009, 12:12:31 AM by AcidicOne »
People Like You, Are the Reason People Like Me Need Medication

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: Joomla+Mysql+php
« Reply #1 on: June 10, 2009, 01:50:44 AM »
joomla has a plugin which enables u to write php code in between some default plugin symbol ( like ($) or something )

actually the problem is that i don't remember it
But i am sure u can have a plugin installed on joomla which allow u to write php code in the content box
bbgFramework v0.1.3
Sun Database Class v0.3

Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: Joomla+Mysql+php
« Reply #2 on: June 10, 2009, 02:19:05 AM »
I did some more searching after the post, And yes there are plenty of components and modules that allow you to use php code in either. My problem was finding one that would allow me to actually run commands to say a query to the mysql server to use the php/html to display the contents of a db from mysql.

I have found such add in i believe (it will run a simple current time script)
http://www.kksou.com/php-gtk2/Joomla/DirectPHP-plugin.php

People Like You, Are the Reason People Like Me Need Medication

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: Joomla+Mysql+php
« Reply #3 on: June 10, 2009, 12:14:59 PM »
http://docs.joomla.org/Tutorial:Creating_a_Hello_World_Module_for_Joomla_1.5
http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html

I would honestly make your own plugin or module, that will allow you to use Joomla's Database abstraction and you can display content with a module and place it dynamically without hardcoding anything. Plus, you'll be able to install/uninstall it at anytime with no hassles.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: Joomla+Mysql+php
« Reply #4 on: June 10, 2009, 04:22:17 PM »
yeah belive me i debated that option, but given my lack of php skills or coding skills in general I passed on that option.Especially considering all i need to do is display db info in a html table within say a article,possibly with options for different sorting methods if possible.
People Like You, Are the Reason People Like Me Need Medication

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: Joomla+Mysql+php
« Reply #5 on: June 10, 2009, 05:43:35 PM »
yeah belive me i debated that option, but given my lack of php skills or coding skills in general I passed on that option.Especially considering all i need to do is display db info in a html table within say a article,possibly with options for different sorting methods if possible.

Eh, no offense... but it doesn't really have much to do with BBG's even in general. This is kinda a generic question that's more focused on Joomla usage. I would go to their forums and ask if anyone is working on or if there already is a module that displays a table of sortable information from a database.

Otherwise grab a module that allows you to parse PHP code:
Code: [Select]
$sort = isset($_GET['sort']) ? $_GET['sort'] : 'field1';
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$rows = mysql_query("SELECT * FROM tablename ORDER BY $sort ASC");
echo '<table>';
echo '<tr><th><a href="/path/to/module.php?sort=field1">Field1</a></th><th><a href="/path/to/module.php?sort=field2">Field2</a></th></tr>';
while($row = mysql_fetch_assoc($rows)){
echo '<tr><td>'.$row['field1'].'</td><td>'.$row['field2'].'</td></tr>';
}
echo '</table>';
mysql_select_db($joomlaDatabaseName); // To go back to original database for joomla to continue

This should help somewhat... but I'm willing to bet there's a Joomla module that does this already.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline AcidicOne

  • Level 16
  • *
  • Posts: 147
  • Reputation: +0/-0
    • View Profile
Re: Joomla+Mysql+php
« Reply #6 on: June 10, 2009, 05:48:35 PM »
Oh not arguing the bbg thing at all,just i know this community has helped me tons with my game coding help, and figured i would post here as well seeing this is just the code help section :) but yes i found a plugin for it, now i just get the fun job of including html in my php code >.<

Not to mention now that i figured this out, i may just attempt to include my bg in my joomla site, make them handle the security/login code :) so i can concentrate more on the game itself.
People Like You, Are the Reason People Like Me Need Medication

Offline Crazy-T

  • Level 19
  • *
  • Posts: 197
  • Reputation: +0/-0
  • Building Games
    • View Profile
Re: Joomla+Mysql+php
« Reply #7 on: June 10, 2009, 07:15:34 PM »
Code: [Select]
$sort = isset($_GET['sort']) ? $_GET['sort'] : 'field1';
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$rows = mysql_query("SELECT * FROM tablename ORDER BY $sort ASC");
echo '<table>';
echo '<tr><th><a href="/path/to/module.php?sort=field1">Field1</a></th><th><a href="/path/to/module.php?sort=field2">Field2</a></th></tr>';
while($row = mysql_fetch_assoc($rows)){
echo '<tr><td>'.$row['field1'].'</td><td>'.$row['field2'].'</td></tr>';
}
echo '</table>';
mysql_select_db($joomlaDatabaseName); // To go back to original database for joomla to continue
I made a userlist like that but bit different, i was able to exploit it so i used a array() and in_array(), to stop it. How i exploited it was like changing the $_GET['sort'] from the Url..
Crazy-T

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: Joomla+Mysql+php
« Reply #8 on: June 10, 2009, 10:30:03 PM »
I made a userlist like that but bit different, i was able to exploit it so i used a array() and in_array(), to stop it. How i exploited it was like changing the $_GET['sort'] from the Url..

This is just for demonstration. It's very easy to exploit this because of the open $_GET variable and how I don't escape it either. Just to point him in the right direction.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal