Jump to content

nander

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nander's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Drummin No go same result.
  2. Pikachu2000 Ok here is my code now its ridirecting me to the 2nd header page instead of showing me the successfull login page? <?php ob_start() ; //check for required fields from the form if ((!$_POST[username]) || (!$_POST[password])) { header("Location: listing15.7.php"); exit; } //connect to server and select database $link = mysql_connect('servicescom.ipagemysql.com', 'enter', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db(formlogin); //create and issue the query $sql = 'SELECT `auth_users` . `f_name` , `auth_users` . `l_name` ' . ' FROM auth_users ' . ' LIMIT 0, 30 '; $result = mysql_query($sql, $link) or die(mysql_error()); //get the number of rows in the result set; should be 1 if a match if (mysql_num_rows($result) == 1) { //if authorized, get the values of f_name l_name $f_name = mysql_result($result, 0, 'f_name'); $l_name = mysql_result($result, 0, 'l_name'); //set authorization cookie setcookie("auth", "1", 0, "/", "services.com", 0); //prepare message for printing, and user menu $msg = "<P>$f_name $l_name is authorized!</p>"; $msg .= "<P>Authorized Users' Menu:"; $msg .= "<ul><li><a href=\"listing15.8.php\">secret page</a></ul>"; } else { //redirect back to login form if not authorized header("Location: topiclist.php"); exit; } ob_end_flush(); ?> <html> <head> <title>Listing 15.8 User Login</title> </head> <body> <?php print "$msg";?> </body> </html>
  3. Pikachu2000 tried that and I get the same error? I think it has something to do with the second header because I change the file of the second header and it takes me to that page.
  4. <?php //check for required fields from the form if ((!$_POST[username]) || (!$_POST[password])) { header("Location: listing15.7.php"); exit; } //connect to server and select database $link = mysql_connect('votpservicescom.ipagemysql.com', 'logindb', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db(formslogin); //create and issue the query $sql = "select f_name, l_name from auth_users where username = '$_POST[username]' AND password = password('$_POST[password]')"; $result = mysql_query($sql, $link) or die(mysql_error()); //get the number of rows in the result set; should be 1 if a match if (mysql_num_rows($result) == 1) { //if authorized, get the values of f_name l_name $f_name = mysql_result($result, 0, 'f_name'); $l_name = mysql_result($result, 0, 'l_name'); //set authorization cookie setcookie("auth", "1", "0", "/", "votpservices.com", 0); //prepare message for printing, and user menu $msg = "<P>$f_name $l_name is authorized!</p>"; $msg .= "<P>Authorized Users' Menu:"; $msg .= "<ul><li><a href=\"listing15.8.php\">secret page</a></ul>"; } else { //redirect back to login form if not authorized header("Location: listing15.7.php"); exit; } ?> <html> <head> <title>Listing 15.8 User Login</title> </head> <body> <?php print "$msg"; ?> </body> </html> MOD EDIT: . . . tags added.
  5. Meant to say I think I was doing it correctly. msaz87 how can I find what the script is outputting?
  6. The sticky topic HEADER ERRORS - READ HERE BEFORE POSTING THEM was a bit confusing? I think I dont it correctly but still getting the same error?
  7. Hello I am getting this error in my script. Can anyone help? Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb25b/b904/ipg.votpservicescom/listing15.8.php:12) in /hermes/bosweb25b/b904/ipg.votpservicescom/listing15.8.php on line 39 if ((!$_POST[username]) || (!$_POST[password])) { header("Location: listing15.7.php"); exit; } //connect to server and select database $link = mysql_connect('servicescom.ipagemysql.com', 'ssap', 'pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db(formlogin); //create and issue the query $sql = "select f_name, l_name from auth_users where username = '$_POST[username]' AND password = password('$_POST[password]')"; $result = mysql_query($sql, $link) or die(mysql_error()); //get the number of rows in the result set; should be 1 if a match if (mysql_num_rows($result) == 1) { //if authorized, get the values of f_name l_name $f_name = mysql_result($result, 0, 'f_name'); $l_name = mysql_result($result, 0, 'l_name'); //set authorization cookie setcookie("auth", "1", 0, "/", "votpservices.com", 0); //prepare message for printing, and user menu $msg = "<P>$f_name $l_name is authorized!</p>"; $msg .= "<P>Authorized Users' Menu:"; $msg .= "<ul><li><a href=\"listing15.8.php\">secret page</a></ul>"; } else { //redirect back to login form if not authorized header("Location: listing15.7.php"); exit; } ?> <html> <head> <title>Listing 15.8 User Login</title> </head> <body> <?php print "$msg"; ?> </body> </html>
  8. Pikachu2000 that was it great thank you so much, simple mistake but hard to find. Fresh eyes are the best.
  9. correct non of the $display_block gets output.
  10. Here is my code. $display_block .= " <P>Showing posts for the <strong>$topic_title</strong> topic:</p> <table width=100% cellpadding=3 cellspacing=1 border=1> <tr> <th>AUTHOR</th> <th>POST</th> </tr>"; while ($posts_info = mysql_fetch_array($get_posts_res)) { $post_id = $posts_info['post_id']; $post_text = nl2br(stripslashes($posts_info['post_text'])); $post_create_time = $posts_info['fmt_post_create_time']; $post_owner = stripslashes($posts_info['post_owner']); //add to display $display_block .= " <tr> <td width=35% valign=top>$post_owner<br>[$post_create_time]</td> <td width=65% valign=top>$post_text<br><br> <a href=\"replytopost.php?post_id=$post_id\"><strong>REPLY TO POST</strong></a></td> </tr>"; } //close up the table $display_block .= "</table>"; } ?> <html> <head> <title>Posts in Topic</title> </head> <body> <h1>Posts in Topic</h1> <?php print $dislplay_block; ?> </body> </html>
  11. Ok here is what I get now? Get Vars: Array ( ) Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb25b/b904/ipg.votpservicescom/showtopic.php:3) in /hermes/bosweb25b/b904/ipg.votpservicescom/showtopic.php on line 7
  12. mjdamato I got this on the output Array ( ) Get Vars: 1
  13. Hello I am creating a simple Discussion Forum, and I cant get past my IF Statement to verify topics exist? Please help? <?php //check for required info from the query string if (!$_GET[topic_id]) { header("Location: topiclist.php"); exit; } //connect to server and select database $link = mysql_connect('votpservicescom.ipagemysql.com', 'mantest', 'testman') or die(mysql_error()); mysql_select_db("learn2db",$link) or die(mysql_error());
×
×
  • 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.