Jump to content

crabfinger

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

crabfinger's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i see that there is an unwanted whitespace character in this line $sth-> execute(); other than that try some error reporting.
  2. This is susceptible to an sql injection. $pass = $_POST['pass']; Remember mysql_real_escape_string(); $pass = mysql_real_escape_string($_POST['pass']
  3. Why not comment on the article? You're probably more likely to get the help you want. I can only speak for myself but I'm not going to jump right in to give you suggestions about how to use a language you don't have a clue how to use in the first place. My only suggestion is to visit http://www.php.net and RTFM (Read the Friendly Manual).
  4. on another note why not add the numeric level to the database and interpret it on the other end? saves for database size
  5. change </color> to </font> and your good
  6. consider arrays, they work with html too <input type="text" name="mypost[22]" value="" /><input type="text" name="mypost[54]" value="" />
  7. really budget has nothing to do with databases, learn how to use phpmyadmin (free) or an ssh terminal and the mysql command to build databases and tables, even build the databases using php code. there are a world of possibilities which cost nothing if you already have the server.
  8. If you have access to the server mysql is very easy and free to install. I would recommend looking into it. otherwise what I posted will do exactly what you're asking for, just modify the code to show what you want it to.
  9. <?php $strThisPage = 'hello.php'; // Change this to your page name $players['1'] = 'player 1'; $players['2'] = 'player 2'; $players['3'] = 'player 3'; $players['4'] = 'player 4'; $players['5'] = 'player 5'; if( isset( $_GET['player'] ) && !empty( $_GET['player'] ) ) { if( isset( $players[$_GET['player']] ) ) { print $players[$_GET['player']] . '<br /><br />'; } } foreach($players as $key => $value) { print '<a href="' . $strThisPage . '?player=' . $key . '">' . $value . '</a><br />'; } ?>
  10. alright so you didnt do what i said print_r($something) prints to the screen $somethingelse = print_r($something,true) formats an array as a string and returns to a variable instead of printing to the screen. make sure the second argument is true or it will print to the screen
  11. did a little work to clean your code up. not sure why you want to create another table with one thing in it, why not just add a column to the users table. <html> <head> <title>ReH-0.1--Create a Session</title> </head> <body bgcolor="#575757"> <center> <?php try { // Connect and select $connect = mysql_connect("localhost","root",""); if(!$connect) { throw new Exception( mysql_error() ); } mysql_select_db( "reh_temp", $connect ); // verify post-data if( isset( $_POST['session'] ) && !empty( $_POST['session'] ) ) { if( strlen( $_POST['session'] ) < 4 ) { throw new Exception('Session must be longer than four characters'); } $session = mysql_real_escape_string($_POST['session']); } else { throw new Exception( 'Session Required' ); } if(isset($_POST['session_conf']) && !empty($_POST['session_conf'])) { if( strlen( $_POST['session_conf'] ) < 4 ) { throw new Exception('Session confirmation must be longer than four characters'); } $session_conf = mysql_real_escape_string($_POST['session_conf']); } else { throw new Exception( 'Session Confirmation Required' ); } // Query post data $query = mysql_query("SELECT * FROM users WHERE users='${session}'"); if( mysql_num_rows( $query ) != 0 ) { //Check for Match if ( $session != $session_conf ) { throw new Exception('Session does not match confirmation'); } //Insert value into users table if( !@mysql_query( "INSERT INTO users VALUES ( '${session}' )" ) ) { throw new Exception( mysql_error() ); } // if this executes the script is complete print '<font color="#0F0">Success</font>'; } catch(Exception $objException) { print '<font color="#f00">' . $obj->Exception->getMessage() . '</font><br/>'; } ?> <font color="#fff">Before encrypting your password, a session must be started. We need you to enter a personal session name that you will remember so that you password is protected by this session.</font><br /> <form action="ReH-0.1.php" method="POST"> <label for="session" style="color: #fff;">Session Name: <input type="text" maxlength="10" size="10" name="session"></label><br /> <label for="session_conf" style="color: #fff;">Session Name Confirmation: <input type="text" maxlength="10" size="10" name="session_conf"></label><br /> <input type="submit" value="Create Session"> </form> </center> </body> </html>
  12. Upon further thought this reply was not correct tech help
  13. i was thinking about that too but this wouldn't replace autoload in any way. It could make a useful addition to __autoload in some applications
×
×
  • 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.