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

  • SEARCH
  • Home
  • 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 7907761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:37:10+00:00 2026-06-03T11:37:10+00:00

This is the code: <html> <body> <?php $valid = true; //Check for first name

  • 0

This is the code:

<html>
<body>

<?php
$valid = true;



//Check for first name value
if (empty($_POST['texts'])) {
    echo 'You forgot to type something in<br />';
    $valid = false;
}

if ($valid == true) {
    $conn1 = mysqli_connect('xxx') or die('Error connecting to MySQL server.');

    $name=   $_POST['name'];
    $title=  sha1($_POST['title']);
    $texts= $_POST['texts'];
    $forum_id = $_POST['forum_id'];




        $name = str_replace("'","''",$name);
        $title = str_replace("'","''",$title);
        $title = str_replace("b074acd521","STREAMER",$title);

        $texts = str_replace("'","''",$texts);


        $title = substr($title,0,8);


        $sql = "INSERT INTO post (name,title, texts, forum_id) VALUES ('$name', '$title', '$texts', '$forum_id')";
        mysqli_query($conn1, $sql) or die('Error inserting to database.');
        mysqli_close($conn1);

        header('Location: requests.php');
        }
else {
    echo 'Click <a href="javascript:history.go(-1)">HERE</a> to go back and adjust your entry.';
}

?>

</body>
</html>

When I make a post on the site and leave the id field empty it still generates an ID, how can I fix this? Also, if the name field is empty how can I make it default to a something?

  • 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-06-03T11:37:13+00:00Added an answer on June 3, 2026 at 11:37 am

    Most (if not all) hashing algorithms will hash an empty string. If they didn’t, they wouldn’t really be “honest” hashes. The idea is that you shouldn’t be able to decipher the hash to the original input. For example, if the following:

    All good boys deserve fudge!
    

    and

    All good boys deserve  fudge!
    

    used a hash algorithm that treated empty space as unhashable, then they would get the same hash, which would make it easier to crack.

    If you don’t want empty strings to be hashed, you need to check the string before hashing it. Something like:

     if(!empty($_POST['user_input']) {
          $user_hash = sha1($_POST['user_input']);
     } else {
          echo "No input given, wiseguy!";
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example… This PHP code <?php echo '<html>'; echo '<body>'; echo '<h1>Header One</h1>'; echo
Can any body check this code please.. <?php $hl_1 = $_POST['hl_1']; $bc_1 = $_POST['bc_1'];
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have the following code: <html> <head> <title><?php echo $GLOBALS['L']['title']; ?></title> </head> <body> <ul
may i get the jquery-ajax equivalent of this code? thanks <html> <head></head> <body> <?php
What am I doing wrong in this HTML code: <html> <head> </head> <body> <div
So i got this snippet of code: $(document).ready(function () { var replacementDoneIn = $(body).html();
This PHP code below fetches html from server A to server B. I did
I have the following php code: <html> <body> <?php $_GET = Array('filename' => 'scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML');
is it possible to embed this into html if (empty($_POST['extras'])) { $message .=<br />

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.