Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to make an Admin Panel of sorts?

Featured Replies

Hey guys, I have acouple questions. I'll just show you guys the script to make everything easier. Its a script to add games to the list on my main page, but eventually I want to make it so that when you click on the link to the game here http://360-talk.com/games.php each game title will link to its own page on my site (you can add links through here http://360-talk.com/games/adminsubmit.html feel free to play with it :p).

 

Here is my code if you guys want to have a look:

formprocess.php

<?php
require'dbconnect.php';
if (!$link)
 {
 die('Could not connect: ' . mysql_error());
 }
mysql_select_db("ryandarin", $link);
$sql="INSERT INTO Game (Title, Link, Description, Genre, Publisher, Published)
VALUES
('$_POST[Title]','$_POST[Link]','$_POST[Description]','$_POST[Genre]','$_POST[Publisher]','$_POST[Published]')";
if (!mysql_query($sql,$link))
 {
 die('Error: ' . mysql_error());
 }
echo "Info Added for ".$_POST[Title]."</br><a href='adminsubmit.html'>Return to Admin Submit.</a>";
mysql_close($link);
fopen("$_POST[Title].html", "w") or die("can't open file");

?>

 

And here is games.php with most of the html taken out so it doesn't take up the whole page

<?php
require'dbconnect.php';
if (!$link)
 {
 die('Could not connect: ' . mysql_error());
 }

mysql_select_db("ryandarin", $link);

$result = mysql_query("SELECT * FROM Game");
?>
[i]html was here[/i]
<?php
while($row = mysql_fetch_array($result))
 {
echo '<td class="row1" align="center" valign="middle" height="50"><img src="templates/Xbox360/images/folder_big.gif" width="50" height="30" alt="No new posts" title="No new posts" /></td> <td class="row1" width="100%" height="50" onMouseOver="this.style.backgroundColor="#ECECEC"; this.style.cursor="hand";" onMouseOut=this.style.backgroundColor="#FFFFFF" onclick="window.location.href="alanwake.html""><span class="forumlink"> <a href="'.$row['Link'].'" class="forumlink">'
.$row[Title]. '</a></span><br />';
 echo '<span class="genmed">'.$row['Description'].'</span></td> <span class="gensmall"> </span></td>';
 echo '<td class="row3" align="center" valign="middle" height="50"><span class="gensmall">'.$row['Genre'].'</span></td>';
 echo '<td class="row1" align="center" valign="middle" height="50"><span class="gensmall">'. $row['Publisher'] .'</span></td>';
 echo '<td class="row3" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">'.$row['Published'].'</span></td>';
 echo "</tr>";
 }
echo "</table>";
mysql_close($link);
?>

 

Next is where I get a little lost when you submit the game I have it create a new page with

fopen("$_POST[Title].html", "w") or die("can't open file");

and then im planning on creating some code which will extract information from the database to put on that page, but first I was wondering if anyone had a good tutorial, or could explain to me how to create an "admin panel" in which I could see each game and edit the information for it without having to go into the database.

 

*If I didn't make sense, let me know and i'll clear it up :p*

 

 

EDIT: What I was saying didn't make sense, I'll post the code I ended up using when I get a chance

  • 2 months later...
Hey guys, I have acouple questions. I'll just show you guys the script to make everything easier. Its a script to add games to the list on my main page, but eventually I want to make it so that when you click on the link to the game here http://360-talk.com/games.php each game title will link to its own page on my site (you can add links through here http://360-talk.com/games/adminsubmit.html feel free to play with it :p ).

 

Here is my code if you guys want to have a look:

formprocess.php

<?php
require'dbconnect.php';
if (!$link)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("ryandarin", $link);
$sql="INSERT INTO Game (Title, Link, Description, Genre, Publisher, Published)
VALUES
('$_POST[Title]','$_POST[Link]','$_POST[Description]','$_POST[Genre]','$_POST[Publisher]','$_POST[Published]')";
if (!mysql_query($sql,$link))
  {
  die('Error: ' . mysql_error());
  }
echo "Info Added for ".$_POST[Title]."</br><a href='adminsubmit.html'>Return to Admin Submit.</a>";
mysql_close($link);
fopen("$_POST[Title].html", "w") or die("can't open file");

?>

 

And here is games.php with most of the html taken out so it doesn't take up the whole page

<?php
require'dbconnect.php';
if (!$link)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("ryandarin", $link);

$result = mysql_query("SELECT * FROM Game");
?>
[i]html was here[/i]
<?php
while($row = mysql_fetch_array($result))
  {
echo '<td class="row1" align="center" valign="middle" height="50"><img src="templates/Xbox360/images/folder_big.gif" width="50" height="30" alt="No new posts" title="No new posts" /></td> <td class="row1" width="100%" height="50" onMouseOver="this.style.backgroundColor="#ECECEC"; this.style.cursor="hand";" onMouseOut=this.style.backgroundColor="#FFFFFF" onclick="window.location.href="alanwake.html""><span class="forumlink"> <a href="'.$row['Link'].'" class="forumlink">'
.$row[Title]. '</a></span><br />';
  echo '<span class="genmed">'.$row['Description'].'</span></td> <span class="gensmall"> </span></td>';
  echo '<td class="row3" align="center" valign="middle" height="50"><span class="gensmall">'.$row['Genre'].'</span></td>';
  echo '<td class="row1" align="center" valign="middle" height="50"><span class="gensmall">'. $row['Publisher'] .'</span></td>';
  echo '<td class="row3" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">'.$row['Published'].'</span></td>';
  echo "</tr>";
  }
echo "</table>";
mysql_close($link);
?>

 

Next is where I get a little lost when you submit the game I have it create a new page with

fopen("$_POST[Title].html", "w") or die("can't open file");

and then im planning on creating some code which will extract information from the database to put on that page, but first I was wondering if anyone had a good tutorial, or could explain to me how to create an "admin panel" in which I could see each game and edit the information for it without having to go into the database.

 

*If I didn't make sense, let me know and i'll clear it up :p *

 

 

EDIT: What I was saying didn't make sense, I'll post the code I ended up using when I get a chance

 

heres a brillo tutorial on using PHP with SQL:

 

http://www.pixel2life.com/tutorials/count/...mysql_with_php/

Next is where I get a little lost when you submit the game I have it create a new page with
fopen("$_POST[Title].html", "w") or die("can't open file");

and then im planning on creating some code which will extract information from the database to put on that page, but first I was wondering if anyone had a good tutorial, or could explain to me how to create an "admin panel" in which I could see each game and edit the information for it without having to go into the database.

 

*If I didn't make sense, let me know and i'll clear it up :p*

EDIT: What I was saying didn't make sense, I'll post the code I ended up using when I get a chance

Hiya!

You don't need to create a page for each game, that's the beauty of dynamic website. Your process should be something like that (that's only my opinion):

 

First, make sure you have an id field in your game table and make sure this field as auto increment/primary key set. The table should be something like that:

CREATE TABLE games (
 g_id SMALLINT (4) UNSIGNED NOT NULL AUTO_INCREMENT,
 g_title VARCHAR (255) NOT NULL,
 g_description LONGTEXT NOT NULL,
 g_genre VARCHAR (100) NOT NULL,
 g_publisher VARCHAR (100),
 g_published DATETIME NOT NULL,
 PRIMARY KEY (g_id)
);

I got rid of your "link" column as you don't need it.

Basically, each time a game is inserted, a unique "g_id" is assign to it.

 

Then you would create a page called something like "game_display.php" as a template to display the full details for each games.

 

Now that you have all that, in your "games.php" page, instead of using you old "link" colum and this

<a href="'.$row['Link'].'" class="forumlink">'.$row[Title]. '</a>

You can do this

<a href="game_display.php?id='.$row['g_id'].'" class="forumlink">'.$row[Title]. '</a>

This would call the game_display.php page and add a query string in the url so the url would look like this

http://yoursite.com/game_display.php?id=5

 

Now in your game_display.php page, you need to use $_GET, which would get the variable "id" from the url, in this case 5 and assign it to a variable name like so:

$id = $_GET['id'];

Then (still in that page) use a query like that:

SELECT * FROM games WHERE g_id = $id

This would SELECT "everything" FROM the "games" table WHERE the g_id (game unique number) = the requested id...

 

That's the basic way to do this!

Now, this isn't the way I'd do this. You should normalize your application first and look at the bigger picture but if you want to get started quick, this should get you going in no time!

 

Hope this helps, if you need more help, give me a shout!

 

Oli

 

Ps the admin panel is really easy to set up once you have the front end set up properly ;)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.