Jump to content

corrupshun

Members
  • Posts

    80
  • Joined

  • Last visited

    Never

Posts posted by corrupshun

  1. :(

     

    Sorry, but I can't lie to you. I think one thing you should do is go around the internet and look for websites that inspire you, then see how they did what they did. I'm not saying to rip off somebody's design, but perhaps if you look at a few sites, and consider things like their menus, footer, banner area, etc., you will be able to use what you like most and create something really cool.

    k :)

  2. Hello, I recently created a game website but am not fully satisfied with it.

    So basically I use GET to choose which game will display, and to make sure people don't put in stupid crap i used the range() function

    The problem is I REALLY do not want to edit the game page each time i add a new game.

    The code is below, and as you can see there is a range(1,4)

    --

    MY QUESTION:

    Is there a way I can SELECT the ID from my database and get the lowest and highest values, set them as variables, and then put them in the range function?

    This would perfect my game page! :)

     

    <?php
    include("inc/template.php");
    echo "$headers";
    $nothing = "";
    $list = range(1,4);
    if(!isset($_GET['gameid'])) {
    include("inc/defaultgame.php");
    }
    elseif($_GET['gameid'] == $nothing){
    include("inc/defaultgame.php");
    }
    elseif(in_array($_GET['gameid'], $list) === false) {
    echo "Invalid GameID";
    include("inc/defaultgame.php");
    }
    else {
    $con = mysql_connect("localhost","root","");
    mysql_select_db("Corrupshun", $con);
    $query = mysql_query("SELECT Title, Side, Path FROM Games WHERE id = $_GET[gameid]");
    while($row = mysql_fetch_assoc($query)) {
    $gametitle = $row['Title'];
    $gameside = $row['Side'];
    $gamepath = $row['Path'];
    }
    }
    ?>
    <title><?php echo "$title[game] $gametitle"; ?></title>
    </head>
    <body>
    <?php echo "$banner"; ?>
    <?php echo "$pagediv"; ?>
    <?php echo "$nav"; ?>
    <?php echo "$bodydiv"; ?>
    <div class="h"><?php echo "$gametitle"; ?></div>
    <div class="s"><?php echo "$gameside"; ?></div>
    <?php echo "$paramstart"; ?>
    <?php echo "$gamepath"; ?>
    <?php echo "$paramend"; ?>
    <?php echo "$divend"; ?><!--body-->
    <?php echo "$news"; ?><!--news-->
    <?php echo "$divend"; ?><!--page-->
    <?php echo "$copyright"; ?>
    </body>
    </html>

  3. Alright, so I've been wanting to make a script soley for my personal use, to insert games into a database.

    Is there a way that before I submit the title, side(title), and path while checking to see if any of it is already in the database? Also for the path I would like to check if it is actually there.

    For example: a path would be the path to a flash game such as "swf/game.swf"

    Now I would like to make the script to check if there is such a file and to check if it's already in the database..

    Here's my code if needed.

    (Right now it doesn't check anything and don't tell me it's vulnerable to SQL Injection, cuz i know that ;))

    <?php
    $con = mysql_connect("localhost","root","");
    if(!$con) {
    die('failed to connect to db' . '<br />');
    }
    else {
    echo "CONNECTED" . "<br />";
    }
    mysql_select_db("Corrupshun", $con);
    $query = "INSERT INTO Games (Title, Side, Path) VALUES ('$_POST[title]','$_POST[side]','$_POST[path]')";
    if(mysql_query("$query",$con)) {
    echo "Inserted $_POST[title], $_POST[side], and $_POST[path] successfully into database";
    }
    else {
    echo "Did not enter." . mysql_error();
    }
    ?>

  4. It's MySQL's console.

     

    Perhaps you can upload your project to some webhost with php and mysql? Then show it to your teacher on web?

    Well, that was my initial idea but I don't only want to use mysql to show it to my teacher

    I also want to be able to work on some random projects that I do

  5. Alright, so I'm a huge noobie that cuts and pastes to make things easier.

    I got WAMP server a few months back but WAMP would not work on my flash drive

    I removed the WAMP files, keeping php apache and mysql (and all the config files ;) )

    So I run apache, I assumed everything worked because I could get to localhost, see my index page and run php.

    Now that I have the need to run MySQL for where I am in teaching myself, it doesn't run.

    I clicked directly on MySQL.exe in the mysql bin folder

    It gave me this error code in cmd.

    ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

    This does not run at all

    The reason I need to run MySQL portably is because I need it at school to show my teacher my work.

    It was freightfully embarassing when it did not work (made databases on home WAMP and copied to flash drive

    Not only does it not work when I have non-admin privlages, but even on my local computer it isn't working

     

    How can I make MySQL running? I thought apache automaticallly made it run?

    Please help, ANY and ALL help will be greatly appreciated :)

    If you need any more info just ask, I will refresh often ;)

    -AUSTIN

    ALSO (if forgot this before)

    I did google this, found a link that said that fat32 don't work with mysql.

    formatted it to ntfs and it still don't work :/

  6. How can i store all of this in varible $gamecode

    (idk how to put php code in variables)

    $nothing = "";
    $list = range(1,2);
    if(!isset($_GET['gameid'])) {
    include("inc/defaultgame.php");
    }
    elseif($_GET['gameid'] == $nothing){
    include("inc/defaultgame.php");
    }
    elseif(in_array($_GET['gameid'], $list) === false) {
    echo('Invalid GameID');
    }
    else {
    $con = mysql_connect("localhost","root","");
    mysql_select_db("Corrupshun", $con);
    $query = mysql_query("SELECT Title, Path FROM Games WHERE id = $_GET[gameid]");
    while($row = mysql_fetch_assoc($query)) {
    $gamepath = $row['Path'];
    $gametitle = $row['Title'];
    }
    }

    This is probably a really dumb question

  7. Hello

    I need help with a game php engine script i've been working on.

    This is what it does:

    Selects the inputted GET and corresponds to the gameid that it is.

    such as if you go to game.php?gameid=2 it will go to game 2 and implement the path and title

    I already created code that will fix if they put nothing or if they put gameid=(nothing)

    My problem is, what if someone decides to go to game.php?gameid=blue ?

    it results in an error code.

    I want to make an if else statement that does not allow someone to type characters and will erase anything typed in other than an interger

    maybe like:

     if($_GET['gameid'] == *non-int*) {
    echo "Please try another game";
    }
    else {
    //other stuffs
    }

    Heres my code:

    <?php
    include("inc/template.php");
    echo "$headers";
    $nothing = "";
    if(!isset($_GET['gameid'])) {
    include("inc/defaultgame.php");
    }
    elseif($_GET['gameid'] == $nothing){
    include("inc/defaultgame.php");
    }
    else {
    $con = mysql_connect("localhost","root","");
    mysql_select_db("Corrupshun", $con);
    $query = mysql_query("SELECT Title, Path FROM Games WHERE id = $_GET[gameid]");
    while($row = mysql_fetch_assoc($query)) {
    $gamepath = $row['Path'];
    $gametitle = $row['Title'];
    }
    }//end else
    ?>
    <title><?php echo "$title[game] $gametitle"; ?></title>
    </head>
    <body>
    <?php echo "$banner"; ?>
    <?php echo "$pagediv"; ?>
    <?php echo "$nav"; ?>
    <?php echo "$bodydiv"; ?>
    <div class="h"><?php echo "$gametitle"; ?></div>
    <?php echo "$paramstart"; ?>
    <?php echo "$gamepath"; ?>
    <?php echo "$paramend"; ?>
    <?php echo "$divend"; ?><!--body-->
    <?php echo "$news"; ?><!--news-->
    <?php echo "$divend"; ?><!--page-->
    <?php echo "$copyright"; ?>
    </body>
    </html>
    

    The warning:

    Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in B:\wamp\www\corrupshun\game.php on line 15
    

    -Thanks!

    -Austin

  8. wait so what's the difference between '  and `

    it worked..

    but how do i type it :P

    ACTUALLY**

    I still have an error..

    Notice: Undefined index: title in B:\wamp\www\sql\select.php on line 18

     

    Notice: Undefined index: path in B:\wamp\www\sql\select.php on line 19

     

    What?

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