#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0

    Help with this code


    blow is a register form after the user registers it goes to a blank white screen how do I get it to go to my login.php please help



    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>welcome</title>
    <script type="text/javascript">
    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    </script>
    </head>


    <?php

    require('connect.php');


    if(isset($_POST['submit'])){
    $email1 = $_POST['email1'];
    $email2 = $_POST['email2'];
    $pass1 = $_POST['pass1'];
    $pass2 = $_POST['pass2'];
    if($email1 == $email2){
    if($pass1 == $pass2){


    $name = mysql_escape_string($_POST['name']);
    $lname = mysql_escape_string($_POST['lname']);
    $uname = mysql_escape_string($_POST['uname']);
    $email1 = mysql_escape_string($email1);
    $email2 = mysql_escape_string($email2);
    $pass1 = mysql_escape_string($pass1);
    $pass2 = mysql_escape_string($pass2);
    $pass1 = md5($pass1);

    $sql = mysql_query("SELECT * FROM `users` WHERE `uname` = '$uname'");
    if(mysql_num_rows($sql) > 0){

    echo "sorry user already exists.";
    exit();

    }

    mysql_query(" INSERT INTO `users` (`id` , `name` , `lname`, `uname`, `email1`, `pass1`) VALUES ( 'null' , '$name', '$lname', '$uname', '$email1', '$pass1') ") or die(mysql_error ());


    }else{
    echo" sorry, your passwords do not match. <br />";
    exit();

    }
    }else{
    echo" sorry, your email's do not match. <br />";
    exit();


    }

    }else{

    $form = <<<EOT
    <body bgcolor="#66FF66" onLoad="MM_preloadImages('eye.jpg')">

    <table width="1000" border="1" align="center" bgcolor="#000000">
    <tr>
    <td><marquee direction="" behavior="alternate"> <img src="tv/logo.gif" width="577" height="42" alt=""/></td>

    </tr>
    <tr>
    <td>
    <h1 align="center"> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','eye.jpg',1)"><img src="croc farm2.jpg" alt="" width="460" height="325" id="Image1"></a></tr>
    <tr>
    <td>
    <a href="Login.php" title="login" target="_self">Login</a>
    </td>
    </tr>

    <tr>
    <td>


    <font color="#33FF00">
    <form action="register.php" method="POST">
    First Name: <Input type="text" name="name" /> <br />
    Last Name: <Input type="text" name="lname" /> <br />
    Username: <Input type="text" name="uname" /> <br />
    Email: <Input type="email" name="email1" /> <br />
    Confirm Email: <Input type="email" name="email2" /> <br />
    Password: <Input type="password" name="pass1" /> <br />
    Confirm Password: <Input type="password" name="pass2" /> <br />
    <input Type="submit" value="Register" name="submit" />
    </form>
    </font>
    </body>
    </td>
    </tr>

    </table>

    EOT;

    echo $form;


    exit();



    }


    ?>

    <body>
    </body>
    </html>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,003
    Rep Power
    376
    use PHP tags around your code.. and it will highlight your code as PHP & possibly reveal an error.

    Also there is a sticky at the top for NEWBIES

    Finally, a blank screen means that there is a php error but your server has chosen to not display php errors (good for the live server!)

    on top of your page do:

    <?php ini_set('display_errors', 'On');
    error_reporting(E_ALL | E_STRICT);
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0
    it sings up the user it enters them in to the db but after it dose the it goes to a blank screen so I don't think theres an error in my coding
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0
    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 53

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 54

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 55

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 56

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 57

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 58

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 59
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0
    Originally Posted by babylon123
    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 53

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 54

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 55

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 56

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 57

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 58

    Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\xampp\htdocs\register.php on line 59
    after fixing that up blank white screen
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,003
    Rep Power
    376
    mysql_query(" INSERT INTO `users` (`id` , `name` , `lname`, `uname`, `email1`, `pass1`) VALUES ( 'null' , '$name', '$lname', '$uname', '$email1', '$pass1') ") or die(mysql_error ());

    you do this but you do not echo anything out after this

    to let the user know that he has been registered or re-direct him to another page so of course the page will be blank
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0
    mysql_query(" INSERT INTO `users` (`id` , `name` , `lname`, `uname`, `email1`, `pass1`) VALUES ( 'null' , '$name', '$lname', '$uname', '$email1', '$pass1') ") or die(mysql_error ());

    you do this but you do not echo anything out after this

    to let the user know that he has been registered or re-direct him to another page so of course the page will be blank



    no its needed for my $form it has the html code need to use to submit the users info so echo is need to inform them that there passwords and emails don't match and for the html form
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,003
    Rep Power
    376
    I KNOW but after you insert their data into the DATABASE. you do not say "You have successfully registered" or anything.. just do an echo after that line and see if you still get a blank screen

    Your indentation is all messed up but i think your form only shows up if user hasnt pressed submit!
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0

    ok we are on the wright track


    Originally Posted by paulh1983
    I KNOW but after you insert their data into the DATABASE. you do not say "You have successfully registered" or anything.. just do an echo after that line and see if you still get a blank screen

    Your indentation is all messed up but i think your form only shows up if user hasnt pressed submit!
    ok no my form shows up I fill it out it works but when submitted it went to a blank screen now it displays jews so how do I redirect it from there
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,003
    Rep Power
    376
    displays jews so how? what isthat? lol..

    if you want to redirect you should google "php redirect" or am i missing sometihing here?
    clue header ( );
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    7
    Rep Power
    0
    Originally Posted by paulh1983
    displays jews so how? what isthat? lol..

    if you want to redirect you should google "php redirect" or am i missing sometihing here?
    clue header ( );
    yeah I did finally work that out thanks ( jews defined by google is (jew) a person belonging to the worldwide group claiming descent from Jacob (or converted to it) and connected by cultural or religious..... and my name is Jacob lol )
    Last edited by babylon123; July 26th, 2013 at 09:30 PM. Reason: coz i was high

IMN logo majestic logo threadwatch logo seochat tools logo