Jump to content

vishalonne

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by vishalonne

  1. Thank you for your consideration floridaflatlander but I can't understand what you want to say. If possible you can take look in my site www.cbsecsnip.in Home Page - > Computer Science -> XI - > Solved Materials (click this, required valid login) Now if user enter valid login from on home page he should see the page which is blocked (Solved Material)
  2. Hello I want this feature in my site. If I Go on PHP forum and try to start new discussion without doing login process, it takes me to the login page and if enter my valid login id and password it directly takes me to page where I can start posting new post. In my site I want to implement same facility. I have already done login part if user click with doing login process on a link which requires login validation process then user will get a message for Enter login information.... Now I am not find the way "How I will take the user back to that same page where he/she want to go after his/her valid login". Need guidance me to do this Thank you for any support?
  3. Thanx for guidance. If you don't mind can you please check my code just I tried have some problem login.php <script type="text/javascript" src="sha512.js"></script> <script type="text/javascript"> function formhash(form, password) { // Create a new element input, this will be out hashed password field. var p = document.createElement("input"); // Add the new element to our form. p.name = "p"; p.type = "hidden" p.value = hex_sha512(password.value); // Make sure the plaintext password doesn't get sent. password.value = ""; // Finally submit the form. form.appendChild(p); form.submit(); } </script> <?php if(isset($_GET['error'])) { echo 'Error Logging In!'; } ?> </head> <body><form action="[b]process_login.php[/b]" method="post" name="login_form"> Email: <input type="text" name="email" /><br /> Password: <input type="password" name="password" id="password"/><br /> <input type="button" value="Login" onclick="formhash(this.form, this.form.password);" /> </form> process_login.php <?php define("HOST", "localhost"); // The host you want to connect to. define("USER", "root"); // The database username. define("PASSWORD", ""); // The database password. define("DATABASE", "check1"); // The database name. $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); echo "Process Login"; include 'functions.php'; sec_session_start(); // Our custom secure way of starting a php session. if(isset($_POST['email'], $_POST['p'])) { $email = $_POST['email']; $password = $_POST['p']; // The hashed password. if(login($email, $password, $mysqli) == true) { // Login success include("XICS.php"); } else { // Login failed header('Location: ./login.php?error=1'); } } else { // The correct POST variables were not sent to this page. echo 'Invalid Request'; } ?> XICS.php on top of the page <?php $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); echo "Process Login"; sec_session_start(); ?> then where the links should appear <?php if(login_check($mysqli) == true){ ?> <div id="nav" class="image002-03"> <span id="smalltext" style="bottom: 0px; margin-bottom: 0px; padding-bottom: 0px; font-family: Calibri; font-size: large; text-align: center;">Service Menu</span> <ul id="ul1" class="serviceul"> <li class="serviceli"><a href="unsolvedCSQPXI.php">Unsolved Question Papers</a></li> <li class="serviceli"><a href="unsolvedCSSPXI.php">Unsolved Sample Paper</a></li> <li class="serviceli"><a href="#">Notes</a></li> <li class="serviceli"><a href="prosamCSXI.php">Projects Samples</a></li> <li class="serviceli"><a href="#">Presentations</a></li> <li class="serviceli"><a href="#">Uploads</a></li> <li class="serviceli"><a href="downloads.php">Solved Materials</a></li> <li class="serviceli"><a href="forum.php">Forum</a></li> <li class="serviceli"><a href="#">Live Chat</a></li> </ul> </div> <?php } else{ ?> <div id="nav" class="image002-03"> <span id="smalltext" style="bottom: 0px; margin-bottom: 0px; padding-bottom: 0px; font-family: Calibri; font-size: large; text-align: center;">Service Menu</span> <ul id="ul1" class="serviceul"> <li class="serviceli"><a href="unsolvedCSQPXI.php">Unsolved Question Papers</a></li> <li class="serviceli"><a href="unsolvedCSSPXI.php">Unsolved Sample Paper</a></li> <li class="serviceli"><a href="#">Notes</a></li> <li class="serviceli"><a href="prosamCSXI.php">Projects Samples</a></li> <li class="serviceli"><a href="#">Presentations</a></li> <li class="serviceli"><a href="login.php">Uploads</a></li> <li class="serviceli"><a href="login.php">Solved Materials</a></li> <li class="serviceli"><a href="login.php">Forum</a></li> <li class="serviceli"><a href="#">Live Chat</a></li> </ul> </div> <?php } ?> This is working but if give wrong password or id it is not showing those link which doesn't require login credentials. Rest is fine :-\
  4. Okay I got the point... So I have to check those page which require validation. Right..!
  5. Thank you Pikachu for looking into my Issue. What I understand from your reply that I should check every page like this <?php if(isset($_SESSION['user'])){ ?> <div id="nav" class="image002-03"> <span id="smalltext" style="bottom: 0px; margin-bottom: 0px; padding-bottom: 0px; font-family: Calibri; font-size: large; text-align: center;">Service Menu</span> <ul id="ul1" class="serviceul"> <li class="serviceli"><a href="unsolvedCSQPXI.php">Unsolved Question Papers</a></li> <li class="serviceli"><a href="unsolvedCSSPXI.php">Unsolved Sample Paper</a></li> <li class="serviceli"><a href="#">Notes</a></li> <li class="serviceli"><a href="prosamCSXI.php">Projects Samples</a></li> <li class="serviceli"><a href="#">Presentations</a></li> <li class="serviceli"><a href="#">Uploads</a></li> <li class="serviceli"><a href="downloads.php">Solved Materials</a></li> <li class="serviceli"><a href="#">Forum</a></li> <li class="serviceli"><a href="#">Live Chat</a></li> </ul> </div> <?php } else{ do the required login here... (this contains the links to push to a login page) }?> But if you see the page on site on a page I have 5-6 link some of them need login and some are not how can I separate them?
  6. I already have the php code for login and varification done using mysql database. I have some links which should not work if user click them without VALID LOGIN. My index.html page contain menu - Home Computer Science Informatics Practices Take Test (login required) Software Register Get Together(login required) Structure of my web site index.html---- Login Box and Register Page Link Computer Science (Menu) XI (Sub Menu) Unsolved Question Papers (Link) login not required Project Samples (Link) login not required Solved Materials (Link) login required Forum (Link) login required XI I (Sub Menu) Unsolved Question Papers (Link) login not required Project Samples (Link) login not required Solved Materials (Link) login required Forum (Link) login required Here is the code - login.php (login form) <script type="text/javascript" src="sha512.js"></script> // contain encryption code <script type="text/javascript"> function formhash(form, password) { // Create a new element input, this will be out hashed password field. var p = document.createElement("input"); // Add the new element to our form. p.name = "p"; p.type = "hidden" p.value = hex_sha512(password.value); // Make sure the plaintext password doesn't get sent. password.value = ""; // Finally submit the form. form.appendChild(p); form.submit(); } </script> <?php if(isset($_GET['error'])) { echo 'Error Logging In!'; } ?> </head> <body><form action="process_login.php" method="post" name="login_form"> Email: <input type="text" name="email" /><br /> Password: <input type="password" name="password" id="password"/><br /> <input type="button" value="Login" onclick="formhash(this.form, this.form.password);" /> </form> </body> process_login.php (checking validity) <?php define("HOST", "localhost"); // The host you want to connect to. define("USER", "root"); // The database username. define("PASSWORD", ""); // The database password. define("DATABASE", "check1"); // The database name. $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); echo "Process Login"; include 'functions.php'; sec_session_start(); // Our custom secure way of starting a php session. if(isset($_POST['email'], $_POST['p'])) { $email = $_POST['email']; $password = $_POST['p']; // The hashed password. if(login($email, $password, $mysqli) == true) { // Login success echo 'Success: You have been logged in!'; } else { // Login failed header('Location: ./login.php?error=1'); } } else { // The correct POST variables were not sent to this page. echo 'Invalid Request'; } ?> Can see the online demo of web site here http://www.cbsecsnip.in/
  7. Hello All I am developing 1 very simple site and I am totally confused "HOW TO DISPLAY MY DIFFERENT CONTENTS IN <DIV>". Detail - My links as are in left side in <DIV class="image002-03"> and on clicking on them I just want to display the content of link in Mid of the page in <DIV class="image002_10"> Like if I click in Sample Paper link content of the link that is No of Sample Sets like this - Set 1 Set 2 Set 3 Set 4 should display in imagae002_10 div. And if I click on Notes link then in same Div i.e. image002_10 should display the content of the link that is Chapter Names like this - Chapter ABC Chapter XYZ Chapter MNO Chapter POI Chapter LMK . How can do this please guide me. Here is the HTML code <div class="panel_container"> <div class="image002-03"> <span id="smalltext" style="bottom: 0px; margin-bottom: 0px; padding-bottom: 0px; font-family: Calibri; font-size: large; text-align: center;">Service Menu</span> <ul class="serviceul"> <li class="serviceli">Question Papers (unsolved)</li> <li class="serviceli">Question Papers (solved)</li> <li class="serviceli">Sample Papers</li> <li class="serviceli">Notes</li> <li class="serviceli">Solved Assignments</li> <li class="serviceli">Projects</li> <li class="serviceli">Presentations</li> <li class="serviceli">Uploads</li> <li class="serviceli">Forum</li> </ul> </div> <div class="image002-07"> Site Map</div> <div class="image002-08"> Advertisement </div> <div class="image002-09"> Advertisement </div> <div class="image002-10"> Here the content of link should display </div> <div class="image002-11"> </div> <div class="image002-13">Footer</div> </div> //And CSS Code DIV.image002-03 { position: relative; left: 49px; top: 0px; width: 208px; height: 238px; border: thin solid #000000; } DIV.image002-07 { position: absolute; left: 266px; top: 174px; width: 973px; height: 24px; border: thin solid #000000; } DIV.image002-08 { border: thin solid #000000; position: absolute; left: 277px; top: 203px; width: 953px; height: 109px; } DIV.image002-09 { position: relative; left: 49px; top: 4px; width: 208px; height: 315px; border: thin solid #000000; } DIV.image002-10 { position:absolute; left:283px; top:355px; width:806px; height:211px; } DIV.image002-11 { border: thin solid #000000; position: absolute; left: 266px; top: 320px; width: 973px; height: 413px; } DIV.image002-13 { position: absolute; left: 48px; top: 739px; width: 1192px; height: 52px; border: thin solid #000000; } Thank you All In Advance with lots of expectation.
  8. Thank you ManiacDan for consideration can you give some good links on this
  9. Dear All I want to send a mail as phpfreaks send confirmation mail when new user register. How can I send mail from my site using SMTP outgoing mail server. I tried and checked may way but not achive any positive result. Here is my mail server detail- Can any body help me out in this with some sort of code. I am trying one example I found on net - http://www.9lessons.info/2009/10/send-mail-using-smtp-and-php.htmlBut this also not works. Thank you in advance.
  10. Thank you Scootstah for clearing my doubt.
  11. Well Thank you. I done with my old code because I don't know what is benefit of using the way to suggested, as I am a learner, but I will obliviously try to know what is the difference. Thanx once again for cooperation
  12. Thanx Do you mena this My Code $hits = trim(fgets($handle)) + 1; Your Code file_put_contents('hitcount.txt', ((int) file_get_contents('hitcount.txt')) + 1); Am I correct
  13. I found this code from Google <?php $filename = 'hitcount.txt'; $handle = fopen($filename, 'r'); $hits = trim(fgets($handle)) + 1; fclose($handle); $handle = fopen($filename, 'w'); fwrite($handle, $hits); fclose($handle); // Uncomment the next line (remove //) to display the number of hits on your page. //echo $hits; ?> And I have to put this code where I want to display the counter like this <p>This web site has had <b><?php include("counter.php"); ?></b> hits since January 1st, 2007.</p> This will open a txt file and write in it. Is this OK?
  14. Hi Thank you for looking in my problem, actually I want to display hit counter at the bottom of the page. Do I need session...????? I just want to keep track how many of visitors came to this page. Is it possible without session?? My problem is simple for you but for new one like me it confusing
  15. Hi All I am getting an warning on my web page when I uploaded the page on server I just writing a PHP PAge Hit Counter- Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/cbsecpsn/public_html/csnip/form_453570.php:7) in /home/cbsecpsn/public_html/csnip/counter.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/cbsecpsn/public_html/csnip/form_453570.php:7) in /home/cbsecpsn/public_html/csnip/counter.php on line 2 This is the output - Total page views = 1 Here is the Code - Counter.php <?PHP session_start(); if(isset($_SESSION['views'])){ $_SESSION['views'] = $_SESSION['views']+ 1; }else{ $_SESSION['views'] = 1; } echo "Total page views = ". $_SESSION['views']; ?> And I used it like this in Survey_Form.php <div class='sfm_cr_box' style='padding:3px; width:350px'> <?php echo "<hr><div align=\"center\">"; include_once "counter.php"; // this will include the counter. echo "</div>"; ?> </div> What is the problem with the code?
×
×
  • 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.