Results 1 to 6 of 6

Thread: Submit to write on a page

  1. #1
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    130
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Submit to write on a page

    here is a submition form i made and i know there is a lot of errors with the submit.php because i am brand new to this kind of stuff, but no it does not work, so i need someone smart to please help me fix it

    this is the form
    HTML Code:
    <form method="post" action="submit.php">
    <font color="#00ff00">Game Name: </font><input type="text" name="title"><p>
    <font color="#00ff00">Game URL: </font><input type="text" name="URL"><p>
    <font color="#00ff00">Banner URL (height-68 width-520 EXACT): </font><input type="text" name="banner">
    <p>
    <font color="#00ff00">Game Information (Tell about your game): </font><input type="text" name="siteinfo"><p>
    <input type="submit" name="submit" value="Submit Game">
    <input type="reset" value="Reset Form" name="reset">
    </form>
    here is submit.php (wrong wrong wrong)
    please help me with the mistakes i made

    PHP Code:
    <?php 


    //find all the posted info and files

    $title =$_POST['title'];
    $URL =$_POST['URL'];
    $banner =$_POST['banner'];
    $siteinfo =$_POST['siteinfo'];
    $valuefile "value.txt"
    $gamefile "games.php"
    $cho $_POST['submit']; 

    //get ready for file changing
    $username $_COOKIE['ID_my_site'];
    $pass $_COOKIE['Key_my_site'];
    $check mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    while(
    $info mysql_fetch_array$check )) {

    if(isset(
    $cho)) {   
     if(
    $info['points'] <= 79){
     die(
    'You do not have enough points yet! Go back to <a href="topgames.php">Top Games</a>');
     };
     
     
    $fh fopen($valuefile'r');
    /* Write game */
    $gamestuff "
    <tr>
    <td bgcolor=\"black\">
    <center>
    <font color=red>
    <br>
    <h2>
    "
    .$title."
    </h2>
    </font>
    </center>
    </td>
    </tr>
    <tr>
    <td bgcolor=\"black\">
    <center>
    <h2>
    <font color=\"#00ff00\"><a href=\"
    "
    .$URL."
    \">
    <img src=\"
    "
    .$banner."
    \" border=\"0\">
    </a>
    </font>
    </h2>
    </center>
    <?php 
    $savefile = \"save"
    .$valuefile['1'].
    ".txt\";
    $contentsave = file_get_contents($savefile);
    $file = explode(\"|\",$contentsave); ?> 
    <center>
    <font color=\"00ff00\">
    #1 - Awesome: <?php echo 
    $file['1']; ?>
    <br> 
    #2 - Ok: <?php echo 
    $file['2']; ?>
    <br> 
    #3 - Terrible: <?php echo 
    $file['3']; ?> 
    <br> 
    </font>
    </center> <center>
    <form action=\"vote.php"
    .$valuefile['1'].
    "\" method=\"post\"> 
    <font color=\"00ff00\">
    #1 - Vote that the game is Awesome: <input type=\"radio\" name=\"choice\" value=\"1\"><br> 
    #2 - Vote that the game is Ok: <input type=\"radio\" name=\"choice\" value=\"2\">
    <br> 
    #3 - Vote that the game is Terrible:  <input type=\"radio\" name=\"choice\" value=\"3\">
    <br>
    </font>
    <input type=\"submit\" value=\"Vote\" name=\"Vote\">
    </form>
    </center>
    <center>
    <table width=\"50%\" height=\"100\" cellpadding=7>
    <tr>
    <td bgcolor=\"#330000\">
    <font color=\"00ff00\">"
    .$siteinfo.
    "</font></td></tr>\r\n"
        
    $handip fopen($gamefile,"a+"); 
        
    fwrite($handip$gamestuff); 
        
    fclose($handip);
        
    fclose($valuefile);
        
    //change the value in valuefile
    $valuething =  fopen($valuefile"a+");
    fwrite($valuething, ++);
    fclose($valuething);
     
    /* Change the points to subtract 20 */
        
    $newpoints $info['points'];
        echo 
    "<p>Points before you submitted = " . ($newpoints-80) . "<br>"
        echo 
    "Your points after you submitted = " $newpoints ."<br>";
        echo 
    "Submittion complete! <a href=\"topgames.php\">View</a>";
      
      
    mysql_query("UPDATE users SET points='$newpoints' WHERE points='{$info['points']}'") or die(mysql_error());
     
    }
    }
    ?>
    any help is greatly appreciated
    Last edited by Demonicman; 03-04-2007 at 04:43 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    130
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    i forgot to mention that valuefile.php consists of a 0

  3. #3
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    130
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    help... please? really im at a block until i get help with this

  4. #4
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    You just gave us you SQL username and password...

    You should edit that out before someone malicios sees it.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  5. #5
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    130
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    thanks i was so frustrated i completely forgot (hope noone saw it)

  6. #6
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    130
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    for those of you that looked at it and went "wtf" and went elsewhere i will break down what i want to happen

    i have a file (topgames.php)

    in it there is an include that includes (games.php)

    what i want submit.php to do is write a new table on games.php so that i do not have to do it manually

    what (value.txt) is, is a file with just 1 number in it and once the form has been submited i want that number to go up by 1 (which is why in $gamestuff i have $valuefile['1'] (i dont think thats right))

    and i want this only possible to be submitted if $info['points'] is greater than or equal to 80

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •