Jump to content

MsRedImp

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by MsRedImp

  1. Because somebody told me this would be a good function to use to direct my users to a new page upon different register procedures. So do I have to put all of my html script inside the <php> tags? Is there any other way of directing a user to a certain page depending on what happens when they register?
  2. But I have echo outputs throughout my script, and want to use header during the form. Is there a way around this?
  3. What do you mean by output? Line 13 is where <title> begins: <title> <?php $title = "Registering..."; echo "$title"; ?> </title> Sorry about that, didn't see the sticky.
  4. Hi guys, I wanted to include a header in my login script so that when somebody registers a new user it directs them to a certain page. The registration is happening and the users are being added to the database, but this piece of error code appears on the page and it doesn't redirect to any page: Warning: Cannot modify header information - headers already sent by (output started at F:\wamp\www\euro\submitregister.php:13) in F:\wamp\www\euro\submitregister.php on line 111 Line 111 is where the header text is placed: if(mysql_affected_rows() > 0) { $_SESSION['login'] = $_POST['login']; header ("Location: registered.php"); } else { $login = "User name already exists."; } Thanks for your help.
  5. Thanks I will look into header, I know =P these are my only 2 problems with the whole web site. Up the imps!
  6. Hey guys, I have a small problem, this is my current script: { $_SESSION['login'] = $_POST['login']; $login='You are now logged in <b>' . $_SESSION['login']; } else { $login= 'Wrong user name or password.'; } If the user name or password is incorrect, it will just display Wrong user name or password. But what I want it to do is have the browser open a new page if it is incorrect, for example incorrect.php. Which will then display an incorrect user name or password message. This shouldn't be too complicated, I just have no idea how to go about it. Any help is much appreciated, thank you
  7. Thank you very much guys, I got it to work =)
  8. Okay I changed it, and got this message again: "The user name you have requested already exists." At least there isn't any mysql error. This worked fine on my computer, so the issue can't be that big especially since the output is my own code. Thanks for you help anyway dude.
  9. I changed it and got this: Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in /home/a5491461/public_html/submitregister.php on line 112 The user name you have requested already exists. Why would it have worked 100% fine on my computer but changed when I uploaded it?
  10. It didn't change anything, still get the same message.
  11. Hmm okay I will change it, but if it worked fine on my computer, will this really fix it?
  12. <?php $login='Your password fields do not match! Go back and try again.'; /*simple checking of the data*/ if(isset($_POST['login']) && isset($_POST['pass']) && ($_POST['pass'] == $_POST['confirm'])) { /*Connection to database logindb using your login name and password*/ $db=mysql_connect('localhost','a5491461_admin','admin') or die(mysql_error()); mysql_select_db('test'); /*additional data checking and striping*/ $_POST['login']=mysql_real_escape_string(strip_tags(trim($_POST['login']))); $_POST['pass']=mysql_real_escape_string(strip_tags(trim($_POST['pass']))); mysql_query("INSERT INTO login SET login='{$_POST['login']}',pass='{$_POST['pass']}'",$db); /*If the database has been updated*/ if(mysql_affected_rows() > 0) { $_SESSION['login'] = $_POST['login']; $login='Thank you for registering ' . $_SESSION['login']; } else { $login= 'The user name you have requested already exists.'; } mysql_close($db); } echo $login ?> I only posted a bit because it works perfectly on my computer, here is the whole code for the submit register page.
  13. Thanks guys I got it now the problem is that when I try and register a new user, it gives me my "user name already exists" message, even though there aren't any user names on the database. if(mysql_affected_rows() > 0) { $_SESSION['login'] = $_POST['login']; $login='Thank you for registering ' . $_SESSION['login']; } else { $login= 'The user name you have requested already exists.'; } mysql_close($db); } Anybody have any ideas why? =/ It worked perfectly on my computer.
  14. I made my first PHP and MySql web site on my computer, the database access is ('localhost', 'user', 'password') obviously...so when I uploaded my web site to my hosting, and created the database what do I change localhost to?! I get the error, access denied for user @ localhost. This is a newbie question but surprisingly hard to find on a search engine, thank you
  15. Thank you dude, the password thing was a help. But the size wasn't my problem. I don't think the image was big enough...let me edit it and see. It's the alignment that is the problem, it looks silly. How do I fix it? Thank you.
  16. <form action="submitreg.php" method="post"> Desired Username: <input type="text"><br> Desired Password: <input type="text"> </form> This is just an ordinary unmodified form I have created. The problem is that the form positioning outputs like this: How do I make this look normal? Thank You
  17. Ah I see. I didn't know it was invalid html, thank you
  18. Ah I understand what you mean. But if I put them inside the <td> tags I have to do the whole <div style> code for every row and column of text I want with that size and color, this is why I put it on the outside so that it can color and size many rows at once. Why isn't this working? I put a <div style> tag on the outside of the whole table form, so that all of the text inside is centered and a certain font, so why can't i put one inside? Here is the whole code: // This div code works and affects the text. <div style="position:absolute; LEFT:13px; top:90px; font-family:tahoma; text-align:center"> <table width="180" border="2" bordercolor="#004284" > // This one doesn't do anything, but I want more than one row to be affected. <div style="color: #FFFFFF; font-size:5px"> <tr bgcolor="#336699"> <td><b>1st</b></td> <td><b>Matt Smith</b></td> </tr> </div> <tr> <td>2nd</td> <td>James Ford</td> </tr> <tr> <td>3rd</td> <td>Ashley Jones</td> </tr> </table> </div>
  19. I have a feeling this has something to do with where I placed the tags. For some reason this div tag isn't taking any effect on the text inside, if I change the color or size nothing happens. It may have something to do with the tables, but if I put it before the <td> and after the </td> it works, any help please? <div style="color: #FFFFFF; font-size:5px"> <tr bgcolor="#336699"> <td><b>1st</b></td> <td><b>Matt Smith</b></td> </tr> </div>
  20. Oh sorry, it's because my whole file is PHP. I will post in the HTML area.
  21. I have a feeling this has something to do with where I placed the tags. For some reason this div tag isn't taking any effect on the text inside, if I change the color or size nothing happens. It may have something to do with the tables, but if I put it before the <td> and after the </td> it works, any help please? <div style="color: #FFFFFF; font-size:5px"> <tr bgcolor="#336699"> <td><b>1st</b></td> <td><b>Matt Smith</b></td> </tr> </div>
  22. Hmm I opened a PHP new in dreamweaver so it should be PHP, I used those tags you added but they didn't work. What am I doing wrong?
×
×
  • 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.