Jump to content

ryanmetzler3

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by ryanmetzler3

  1. I have found that the error is always at the line where the first php tag occurs. Right now it is reading an error at line 12 which is the first php tag in the code. If I delete that section (because it does not contribute to the functionality of the code) , the errror reads line 19 which is the next php tag. If I delete that, the error jumps to the next php tag. It doesnt like the first php tag for some reason.
  2. Here is all the code. I put line 12 in red so you can see it easier. Thank you <html> <head> <link rel="stylesheet" type="text/css" href="/style.css" /> <link rel="stylesheet" type="text/css" href="/login_scripts/user_style.css" /> <title>Wet Dog Nose Polls</title> </head> <body> <div id="wrapper"> <div id="headerwrap"> <div id="header"> <?php include $_SERVER['DOCUMENT_ROOT'] . '/header_source/index.php'; ?> <a href="/index.php"> <img src="/images/wetdognose.jpg"> </a> </div> </div> <div id="navigationwrap"> <div id="navigation"> <?php include $_SERVER['DOCUMENT_ROOT'] . '/menu_source/index.php'; ?> </div> </div> <div id="loginwrap"> <div id="login"> <h2>Welcome back! Sign in here.</h2> <?php include $_SERVER['DOCUMENT_ROOT'] . '/login_scripts/sessionstart.php'; if (isset($_POST['loginbtn']) or ($username && $userid)) {} else{echo "";} if ($username && $userid) { echo "You are already logged in as <b>$username</b>"; echo "<br/>Not " . $username . "? <a href='/login_scripts/logout.php'>Logout</a>"; } else { $form = "<div id='forms'> <form action='/login_scripts/login.php' method='post'> <table class='forms'> <td><input type='text' name='user' placeholder='Username' class='input_style'/></td> </tr> <tr> <td><input type='password' name='password' placeholder='Password' class='input_style'/></td> </tr> <td><input type='submit' name='loginbtn' id='loginbtn' value='Login'/></td> </tr> <tr> <td><a href='/login_scripts/register.php'>Register</a> <a href='/login_scripts/forgotpass.php'>Forgot Password?</a></td> </tr> </table> </form> </div>"; } if ($_POST['loginbtn']) { $user = $_POST['user']; $password = $_POST['password']; if ($user) { if ($password) { include $_SERVER['DOCUMENT_ROOT'] . '/login_scripts/connect.php'; $password = md5(md5("R4E2M0".$password."R4E2M0")); $link = mysqli_connect("localhost","wetdogno_ryan","Relztem$3","wetdogno_login") or die ("Cannot connect"); $query = mysqli_query($link, "SELECT * FROM user WHERE username='$user'") or die (mysqli_error()); $numrows = mysqli_num_rows($query); if ($numrows ==1) { $row = mysqli_fetch_assoc($query); $dbid= $row['id']; $dbuser= $row['username']; $dbpass = $row['password']; $dbactive = $row['active']; if ($password == $dbpass) { if ($dbactive == 1) { $_SESSION['userid'] = $dbid; $_SESSION['username'] = $dbuser; header('Location:/login_scripts/member.php'); } else { echo "<font color='red'>You must activate your account to login. $form</font>"; } } else { echo "<font color='red'>You did not enter the correct password. $form</font>"; } } else { echo "<font color='red'>The username you entered was not found. Be sure that you are entering your username and not email.$form</font>"; } } else { echo "<font color='red'>You must enter your password . $form</font>"; } } else { echo "<font color='red'><p>You must enter your username. Be sure you are entering your username and not your email. $form</font>"; } } else{ echo $form; } ?> </div> </div> <div id="rightcolumnwrap"> <div id="rightcolumn"> <?php include $_SERVER['DOCUMENT_ROOT'] . '/ad.php'; ?> </div> </div> <div id="footerwrap"> <div id="footer"> <?php include $_SERVER['DOCUMENT_ROOT'] . '/footerlinks.php'; ?> </div> </div> </div> </body> </html>
  3. I have a script where a user can register and then login to my site. It all works fine on WAMP. When I put it on a live server I am having issues. I am getting this error when you try to login. Warning: Cannot modify header information - headers already sent by (output started at /home/wetdogno/public_html/login_scripts/login.php:12) in /home/wetdogno/public_html/login_scripts/login.phpon line 75 I know sessions are not starting becuase normally when you register, it automatically logs you into the account you just created, but its not doing that. It creates the user, because their information gets injected into my DB. Their session just isn't starting. Also the header() function is not working. Here is the code that the error message describes. I really don't think its a white space issue like many of the blogs that I have read indicated. f ($password == $dbpass) { if ($dbactive == 1) { $_SESSION['userid'] = $dbid; $_SESSION['username'] = $dbuser; header('Location:/login_scripts/member.php'); }
  4. Hello everyone, I just wrote a significiant amount of code using mysql commands. I am now finding out that mysqli is the better option. Will mysql commands not work in the future? Do you have to switch to mysqli to avoid any potential issues?
×
×
  • 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.