Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1036941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:47:09+00:00 2026-05-16T14:47:09+00:00

<?php //filename signup.php ob_start(); include(‘dat.php’); if (!empty($_POST)){ if ($pass!=d41d8cd98f00b204e9800998ecf8427e OR $user!=) { // 1

  • 0
    <?php                    //filename signup.php
    ob_start();
 include('dat.php');
    if (!empty($_POST)){


        if ($pass!="d41d8cd98f00b204e9800998ecf8427e" OR $user!="") {       // 1
            $result=mysql_query($sql);
            if(mysql_error()) {
                die('Sorry, this username already exists');                 // 2
            }
        } else {
        echo "Please enter the Password";
        }
    }

    ob_end_flush();
    ?>

<html>
<body>
<form name="form1" method="post" action="signup.php">                <!--3-->
Username<input name="myusername" type="text" id="myusername" />
Password<input name="mypassword" type="text" id="mypassword" />
e-mail<input name="email" type="text" id="email" />
<input type="submit" name="Submit" value="Login" />
</form>
</body>
</html>

This is a sign up page (All the mysql details are missing here, they are included in dat.php) . If there is ny error , it is displayed in the same page.
problem 1 : [ //1 ] what is the operator for OR , in this case I have used the condition for if the pass or user is blank,but the OR is not working neither || , used in javascript.
problem 2 : [ //2 ] if die is used , then the statement is printed in the new window , but I want it to appear in the same window…I also used echo, it worked but I feel like i am missing the main function of ‘die’ by using ‘echo’.
problem 3 : [ <!--3--> ] how can I replace signup.php as action to something like SERVER_PAGE or whatever…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:47:10+00:00Added an answer on May 16, 2026 at 2:47 pm
    1. OR is the same as || except that OR has a lower precedence than ||. This can cause logical errors when it’s used with other operators with a higher precedence than OR but a lower precedence than || like the assignment operators:

      $var = false OR true;  // ($var = false) OR true;
      var_dump($var);        // bool(false)
      $var = false || true;  // $var = (false || true);
      var_dump($var);        // bool(true)
      

      So I recommend you to rather use || than OR.

    2. die does print the passed string and quits the execution of the current script. Personally, I wouldn’t use use die but implement a more decent error handling like storing the error message in a variable and print it in the document like this:

      $errors = array();
      if (!empty($_POST)) {
          if ($pass!="d41d8cd98f00b204e9800998ecf8427e" || $user!="") {
              $result=mysql_query($sql);
              if (mysql_error()) {
                  $errors[] = 'Sorry, this username already exists';
              }
          } else {
              $errors[] = "Please enter the Password";
          }
      }
      if (!empty($errors)) {
          echo 'There were some errors:';
          echo '<ul><li>', implode('</li><li>', $errors), '</li></ul>';
      }
      
    3. If you use an empty URL for the action attribute, it refers to the very same URL:

      <form name="form1" method="post" action="">
      

    Some further tips:

    • Use $_SERVER['REQUEST_METHOD'] === 'POST' to test the request method instead of testing !empty($_POST).
    • Avoid register globals. So use $_POST['pass'] instead of $pass if you want to refer to the parameter pass passed by POST.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do something like a C #include filename.c , or PHP include(dirname(__FILE__).filename.php)
Just curious...when writing a require/include statement, what do you prefer as better practice? require('filename.php');
PHP has a great function called htmlspecialcharacters() where you pass it a string and
Below are the files in PHP that I am trying to include a file
I'm trying to change all http://www.mysite.com/filename.php files to show as http://www.mysite.com/filename/ using mod_rewrite, but
hey guys, the following rule overwrites /signup.php with just /signup RewriteRule ^signup$ signup.php exactly
upload.php <?php $host = 'localhost'; $user = 'root'; $pw = ''; $db = 'thepillar';
PHP's explode function returns an array of strings split on some provided substring. It
PHP, as we all know is very loosely typed. The language does not require
PHP stores its session information on the file system of the host of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.