Jump to content

aenigma

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aenigma's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well, although that was REALLY vague, lol, I managed to read enough to figure it out. Here's what I came up with: if (!ereg("^[a-zA-Z0-9_]{4,16}$", $_POST["uname"])) { echo "Invalid Username<br>Usernames must be between 4 and 16 characters, contain only alphanumeric characters and \"_\""; $allchecks = 0; }
  2. Hey, I was wondering if there was a way to make sure a string from an input box doesn't contain anything except a-z and 1-0 without checking an entire string against every character I don't want. Thanks for any help!
  3. Okay, i lied. version 4.4.3 is giving me the error, but it works fine in 4.4.4
  4. Im trying to call a session via session_start(); in a script, and im getting this error. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/frozen/public_html/fg/index.php: in /home/frozen/public_html/fg/ses.php on line 11 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/frozen/public_html/fg/index.php: in /home/frozen/public_html/fg/ses.php on line 11 PHP version 4.4.6
  5. Fuck.. Thanks for the help. I'm so retarded... I forgot to add a mages column... Ugh... little silly details.
  6. http://nopaste.php-q.net/281203 For some reason, this code won't insert the data from teh form into the DB.
  7. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <? $db_host = "localhost"; $db_username = "aenigma_josh"; $db_password = "strg388"; $db_name = "aenigma_joshs"; if ( isset( $_POST["Submit"] ) ) { if ( !$link = mysql_connect($db_host, $db_username, $db_password)) { die( "Unable to connect to MySQL Server." ); } if ( !$dbselect = mysql_select_db($db_name, $link)) { die( "Unable to select MySQL database." ); } if ( isset( $_POST["username"] ) ) { $username = $_POST["username"]; } else { die( "You did not enter a username." ); } if ( isset( $_POST["password"] ) ) { $password = $_POST["password"]; } else { die( "You did not enter a password." ); } $query = "SELECT * FROM users WHERE username = '". mysql_real_escape_string($username) ."' AND password = '". md5($password) ."' LIMIT 1"; if ( !$result = mysql_query($query, $link)) { die( "Unable to run SQL query." ); } if ( mysql_num_rows( $result ) != 1 ) { die( "Invalid username or password" ); } else { $userinfo = mysql_fetch_array( $result ); } mysql_free_result( $result ); $day = date('d', time()); $month = date('m', time()); $year = date('Y', time()); $hour = date('H', time()); $min = date('i', time()); $sec = date('s', time()); $uid1 = md5(uniqid(rand(), true)); $uid2 = md5(uniqid(rand(), true)); $uid3 = md5(uniqid(rand(), true)); $sessionid = "'". $uid2 . $yeah . $sec ."'-'". day . $hour . $uid3 ."'-'". $min . $uid1 . $month ."'"; $sname = session_name("$sessionid"); session_start($sname); $_session['username'] = $userinfo[username]; $_session['displayname'] = $userinfo[displayname]; $_session['email'] = $userinfo[email]; $next = "index.php?page=news"; Header('Location: $next'); } ?>[/quote] Says "Unable to Run SQL Query" ANy ideas? lol.
  8. Thanks a bunch for the help mate. You're a lifesaver.
  9. Ahh, figured it out, you had a small error though. You gave me this: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$maxvalue = "SELECT MAX(id) AS id FROM news"; $maxresult = mysql_query($maxvalue); $minvalue = "SELECT MIN(id) AS id FROM news"; $minresult = mysql_query($minvalue); $max = mysql_fetch_array([!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]$maxvalue[!--colorc--][/span][!--/colorc--]); $min = mysql_fetch_array([!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]$minvalue[!--colorc--][/span][!--/colorc--]); echo "Max ID is: " . $max['id'] . " - Mininum ID is: " . $min['id'];[/quote] and it needed to be: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$maxvalue = "SELECT MAX(id) AS id FROM news"; $maxresult = mysql_query($maxvalue); $minvalue = "SELECT MIN(id) AS id FROM news"; $minresult = mysql_query($minvalue); $max = mysql_fetch_array([!--coloro:#000099--][span style=\"color:#000099\"][!--/coloro--]$maxresult[!--colorc--][/span][!--/colorc--]); $min = mysql_fetch_array([!--coloro:#000099--][span style=\"color:#000099\"][!--/coloro--]$minresult[!--colorc--][/span][!--/colorc--]); echo "Max ID is: " . $max['id'] . " - Mininum ID is: " . $min['id'];[/quote]
  10. This is what I have so far: [code]$maxvalue = "SELECT MAX(id) AS id FROM news"; $maxresult = mysql_query($maxvalue); $minvalue = "SELECT MIN(id) AS id FROM news"; $minresult = mysql_query($minvalue); echo "Max ID is: $maxresult - Mininum ID is: $minresult";[/code] But, all I get is: Max ID is: Resource id #4 - Mininum ID is: Resource id #5
×
×
  • 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.