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 6012423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:24:09+00:00 2026-05-23T02:24:09+00:00

<?php error_reporting(0); session_start(); if(!$_SESSION[login]){ print ‘<script type=text/javascript>’; print ‘alert(You need to login first)’; print

  • 0
<?php
error_reporting(0);
session_start();
if(!$_SESSION["login"]){
print '<script type="text/javascript">';
print 'alert("You need to login first")';
print '</script>';  echo '<meta http-equiv="REFRESH" content="0;url=home.php">';
die();
}
?>
<?php
//This is the book stuff
                ob_start();
                #error_reporting(0);
                $host="localhost"; // Host name
                include 'databaselogin.php';

                $db_name="X"; // Database name
                $tbl_name="Books"; // Table name

                // Connect to server and select databse.
                mysql_connect("$host", "$username", "$password")or die("cannot connect");
                mysql_select_db("$db_name")or die("cannot select DB");
                $id = $_GET["id"];
                $sql = 'SELECT * FROM Books WHERE `id` = '.$id.' LIMIT 1'; 
                $result=mysql_query($sql) or die(mysql_error());
                while($rows = mysql_fetch_array($result)){
?>

<?
//this is user stuff.
            ob_start();
            error_reporting(0);
            $host="localhost"; // Host name
            include 'databaselogin.php';
            $currentuser = $_SESSION["id"];
            $db_name="X"; // Database name
            $tbl_name="users"; // Table name
            $tbl_name="Books"; // Table name


/*
if ($rows['userid'] != $currentusers)
{
print '<script type="text/javascript">';
print 'alert("you dont have permissions")';
print '</script>';  echo '<meta http-equiv="REFRESH" content="0;url=home.php">';
}

*/
?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Silent Generation</title>
    <link rel="stylesheet" href="styles.css" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="print.css" media="print" />
    <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <!--script section-->
    <script type="text/javascript">

    </script>

    <!--end script section-->

</head>
<body>
<div id="wrapper"><!-- #wrapper -->

    <header><!-- header -->
        <h1><a href="#">Silent Generation</a></h1>
        <h2>Would it be too chezy to say silent but deadly</h2>
    </header><!-- end of header -->

    <nav><!-- top nav -->
        <div class="menu">
            <ul>
                <li><a href="home.php">Home</a></li>
                <li><a href="sell.php">Sell</a></li>
                <li><a href="buy.php">Buy</a></li>
                <li><a href="stores.php">Stores</a></li>
                <li><a href="donate.php">Donate</a></li>
                <li><a href="contact.php">Contact Us</a></li>
                <li><a href="support.php">Support</a></li>

            </ul>
        </div>
    </nav><!-- end of top nav -->

    <section id="main"><!-- #main content and sidebar area -->
            <section id="content"><!-- #content -->



                <article>
                    <form method="GET" action="editadd.php" name="add" id="add">
                Book Name: 
                <div align="center" style="margin-top:-15px;"> 
                <input type="text" name="name" id="name"  value="<?echo $rows["name"];?>"/></div>
                Author's Name: <div align="center" style="margin-top:-15px;"><input type="text" name="author" id="author"  value="<?echo $rows["author"];?>"></div>
                ISBN: <div align="center" style="margin-top:-15px;"><input type="text" name="ISBN" id="ISBN"  value="<?echo $rows["ISBN"];?>"></div>
                Edition : <div align="center" style="margin-top:-15px;"><input type="text" name="edition" id="edition"  value="<?echo $rows["edition"];?>"></div>
                Contact info:<div align="center" style="margin-top:-15px;"> <input type="text" name="contact" id="contact"  value="<?echo $rows["contact"];?>" /></div>
                Price: <div align="center" style="margin-top:-15px;"> <input type="text" name="price" id="price" / value="<?echo $rows["price"];?>"></div>
                Comments: <div align="center"><textarea id="comments" name="comments" rows="13" cols="80"  ><?echo $rows["comment"];?> </textarea></div>
                <div align="center"><input type="submit" value="Submit" style="width:660px;height:70px;"/></div>
                <input type="hidden" name="id" value="<?echo $rows["id"];?>" />
                </form>
                current user: <?echo $currentuser;?>
                posted by: <?echo $rows['userid']?>
                <?
                }
                ob_end_flush();
                if ( intval($rows['userid']) ==  intval($currentusers))
                {echo "true";}
                else
                {echo "fasle";}

                ?>
                </article>


                    <pre>









                            </pre>







            </section><!-- end of #content -->

        <aside id="sidebar"><!-- sidebar -->
        <?php
        error_reporting(0);
        session_start();
        if(!$_SESSION["login"]){
        ?>
                <h3>Login</h3>
              <form method="post" ACTION="login.php">
            E-mail
            <input type="text" id="myusername" name="myusername" />
            <br/>
            <br/>
            Password    <input type="password" id="mypassword" name="mypassword" />
            <br/>
            <br/>
            <INPUT TYPE="submit" VALUE="Submit" />
            <br/>
            <input TYPE="button" VALUE="Password?"onclick="javascript:document.location='lostpass.php'; return false; "/>
            </form> 
            <pre>
            </pre>
                <h3>Register</h3>
                    <form method="post" action="register.php" name="register" id="register">Name <br/><input type="text" id="name" name="name" ><br/>
                    Email <br/> <input type="text" id="email" name="email"><br/>
                    School <br/> <select name="school" id="school">
                            <option value='Sierra College'>Sierra College</option>
                            <option value='American River'>American River</option>
                            <option value='UC Davis'>UC Davis</option>
                            <option value='UCLA'>UCLA</option>
                            <option value='UCSD'>UCSD</option>
                            </select><br/>
                    Password <br/> <input type="password" id="password" name="password"><br/>
                    Conform Password <br/> <input type="password" id="password2" name="password2"><br/>

                    <br/>
                    <input type="submit" value="Submit">
                    <input type="reset" value="Clear">
                    </form>                         
<?}else{?>
<h3>Welcome</h3> <?php echo $_SESSION["username1"] ?>

<a href="logout.php">Logout</a>
<?}
?>
                <h3>Connect With Us</h3>
                    <ul>
                        <li><a href="#">Twitter</a></li>
                        <li><a href="#">Facebook</a></li>
                    </ul>

        </aside><!-- end of sidebar -->

    </section><!-- end of #main content and sidebar-->

        <footer>
        <section id="footer-area">

            <section id="footer-outer-block">


                    <aside class="footer-segment">
                            <h4>Joubin Jabbari</h4>
                                <p>&copy; 2011 <a href="#">Silentgen.com</a> 
                                presents a site by a student for students. 
                                </p>
                    </aside><!-- end of #fourth footer segment -->

            </section><!-- end of footer-outer-block -->

        </section><!-- end of footer-area -->
    </footer>

</div><!-- #wrapper -->
<!-- Free template created by http://freehtml5templates.com -->
</body>
</html>

The above is my entire code…. the fist few blocks of php is all you need to look at. All I want to is to make sure that the person is trying to edit this post is the person that has posted it. otherwise, they need to be rerouted else where.

  • 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-23T02:24:10+00:00Added an answer on May 23, 2026 at 2:24 am

    hmm… perhaps trying if ( intval($rows['userid']) == intva($currentusers))

    Ok, you were using the wrong variable name. It is meant to by $currentuser not $currentusers.

    if ( $rows['userid'] == $currentuser)
        echo "true";
    else
        echo "false";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I have this piece of jquery code: <script type=text/javascript > $(function() {
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN> <?php include('db_connection.php'); error_reporting(E_ALL); session_start(); ?> <html> <head>
I have this script which i use on my own website: <?php error_reporting(E_ALL); $email_subject
<?php ini_set('display_errors',1); error_reporting(E_ALL); require_once('/include/adLDAP.php'); $adldap = new adLDAP(); $username = user123; $password = pass123;
The code chokes at fopen(): <?php ini_set('display_errors',1); error_reporting(E_ALL); $fp = fopen(/path/to/file/some_file.txt,a) or die(can't open
I want to use two independent $_SESSIONs in a single PHP script. I have
I have A.php and B.php A.php <?php error_reporting(E_ALL); ini_set(display_errors,1); class myClass { function hello()
Right now I have this code. <?php error_reporting(E_ALL); require_once('content_config.php'); function callback($buffer) { // replace
I'm trying to connect to my server using php script to upload some files...
Is there any reason for a PHP script to return a fatal error of:

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.