Jump to content

plodos

Members
  • Posts

    212
  • Joined

  • Last visited

Everything posted by plodos

  1. reviewer_research_field table user id 22 2 22 4 22 6 when I try to update data which is coming from form with checkbox values <?php foreach ($_POST['state'] as $newstate) { $write = "update reviewer_research_field as r set r.id='{$newstate}' where r.user='{$_SESSION['id']}' "; mysql_query($write) or die(mysql_error()); } ?> im selecting 3 different checkbox 5-8-9 but this query is only adding one number like user id 22 9 22 9 22 9 but it must be user id 22 5 22 8 22 9 What is the problem? How can I solve :s Thanks in advance
  2. I changed the location of unset($_REQUEST['wrong_code9']); and it is solved
  3. URL is coming from header("Location:".$_SERVER['HTTP_REFERER']."?wrong_code9=true"); http://aaaa.com/add_new_reviewer.php?wrong_code9=true add_new_reviewer_save.php <?php if(isset($_REQUEST['wrong_code9'])) { unset($_REQUEST['wrong_code9']); header("Location:".$_SERVER['HTTP_REFERER']."&wrong_code=true"); } else { header("Location:".$_SERVER['HTTP_REFERER']."?wrong_code=true"); } ?> URL is coming than if(isset($_REQUEST['wrong_code9'])) if that is true unset($_REQUEST['wrong_code9']); than activate wrong_code=true but unset is not working, WHY ?
  4. this one is not working <?php <? if(isset($_GET['wrong_code25'])){ header( "refresh: 3; url=http://{$_SERVER['SERVER_NAME']}/index.php" ); ?> <table><tr><td> Thank you for registration.<br /> Wait, you are redirecting to login page.<br /> </td></tr></table> <? }?> ?> maybe i will change the algorithm Thanks for everything.
  5. process.php <?php if($result){ header("Location:".$_SERVER['HTTP_REFERER']."?wrong_code25=true"); } ?> registration.php //HTML codes <table><tr><td> <?php if(isset($_GET['wrong_code25'])){ ?> Thank you for registration.<br /> Wait, you are redirecting to login page.<br /> <?php header("refresh 3; url=http://{$_SERVER['SERVER_NAME']}/index.php"); } ?> </td></tr></table> //HTML codes process.php sending the wrong_code25=true, than registration.php is SET the wrong_code25 and showing the Thank you part. But HEADER() part is not working:s and there is no error!. WHY ? OR Can any body give me a hint how to redirect with different ways? Thanks in advance
  6. revraz, you know what are you doing i dont know how many times you solved my problems thank you one more time
  7. sql table CREATE TABLE IF NOT EXISTS `paper` ( `id` int(11) NOT NULL auto_increment, `title` text collate latin1_general_ci NOT NULL, `abstract` text collate latin1_general_ci NOT NULL, `keywords` varchar(50) collate latin1_general_ci NOT NULL, `authors` varchar(50) collate latin1_general_ci NOT NULL, `status` varchar(50) collate latin1_general_ci NOT NULL, `ext` text collate latin1_general_ci NOT NULL, `user` int(11) NOT NULL, `statustext` varchar(50) collate latin1_general_ci NOT NULL, `datum` datetime NOT NULL, `comment` text collate latin1_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; I have query and result is true $now = time(); $date = date("d-m-Y H:i:s",$now); $q = "insert into paper set title='{$_REQUEST['title']}', abstract='{$_REQUEST['abstract']}', keywords='{$_REQUEST['keywords']}', authors='{$_REQUEST['authors']}', ext='$file_ext', user='{$_SESSION['id']}', status='new', datum='$date' "; output is : insert into paper set title='aaaaaaaa', abstract='aaaaaaaa', keywords='aaaaaaaa', authors='aaaaaaaa', ext='.doc', user='20', status='new', datum='25-12-2008 18:49:06' But when I check my PHPmyADMIN, i cant see my datum variable, the field is 000000000 there is no time, WHY? datum (field) 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
  8. im going to search "ternary operation" methods now. thank you one more time
  9. Thanks for urgent reply. Could you explain this code word by word, what does it stand for ( ? : ) <?php (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; ?>
  10. If I POST variable with this method, where like = '%%' query is not working <?php $var = $_POST['search']; but if I post with like that where like = '%%' query is working (somebody give me this code) <?php $search = (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; $search = trim(mysql_real_escape_string($search)); ?> What is the meaning of this sentence ??? <?php (isset($_POST['search'])) ? $_POST['search'] : $_GET['search']; ?> and what is the difference between these methods?
  11. you are right when i change the code but i forgot to put session thank you one more time revraz
  12. if($count==1){ $row = mysql_fetch_array($result); $_SESSION['loggedIn'] = $row['type']; $_SESSION['id'] = $row['id']; header("location:{$row['type']}.php?id={$row['id']}&type={$row['type']}"); } http://aaaa.com/reviewer.php?id=9&type=reviewer ID is true, TYPE is true BUT why this part is working FALSE, WHY header("location:index.php"); is working ???? Please help me <?php include('dbconfig.php'); session_start(); if ($_SESSION['loggedIn'] != 'reviewer') { //check the registered user, if not go index.php if(!$_SESSION['id']) { header("location:index.php"); die(); //echo $_SESSION['id']; //echo "<br>".$_SESSION['loggedIn']; } else //if registered with different user type turn back to your page { echo " <script language='JavaScript'>history.go(-1);</script>"; } }else{ //page starts here ?>
  13. there are the errors when I try to login as a reviewer with reviewer information Notice: Undefined index: loggedIn in /home/bbp/reviewer.php on line 6 Notice: Undefined index: id in /home/bbp/reviewer.php on line 8 Notice: Undefined index: id in /home/bbp/reviewer.php on line 12 Notice: Undefined index: loggedIn in /home/bbp/reviewer.php on line 13
  14. if I login the system as a reviewer, login_control.php must open the reviewer.php page id username password email type 1 p p a@a reviewer login_control.php <?php $sql="SELECT * FROM user WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched table row must be 1 row if($count==1){ $row = mysql_fetch_array($result); $_SESSION['loggedIn'] = $row['type']; $_SESSION['id'] = $row['id']; header("location:{$row['type']}.php?"); } ?> but problem starts here. My username and password is true, and type is reviewer. when I try to login the system as a reviewer, header("location:index.php"); is open the index page. WHY ? reviewer.php <?php include('dbconfig.php'); session_start(); if ($_SESSION['loggedIn'] != 'reviewer') { //check the registered user, if not go index.php if(!$_SESSION['id']) { header("location:index.php"); die(); } else //if registered with different user type turn back to your page { echo " <script language='JavaScript'>history.go(-1);</script>"; } } else { //open the secure page } ?>
  15. I add javascipt 100% working now <?php else //if registered with different user type turn back to your page { echo " <script language='JavaScript'>history.go(-1);</script>"; }?>
  16. I add javascipt 100% working now <?php else //if registered with different user type turn back to your page { echo " <script language='JavaScript'>history.go(-1);</script>"; }?>
  17. I got these errors:S Notice: Undefined variable: HTTP_REFERER in /bbp/reviewer.php on line 18 Notice: Undefined index: HTTP_REFERER in bbp/reviewer.php on line 19 <?php echo $HTTP_REFERER; //line 18 echo $_SERVER['HTTP_REFERER']; //line 19 ?>
  18. that page is coming from www.aaaa.com/user.php or www.aaaa.com/blabla.php but it is not giving any error or there is no action this part is not working with header() if I put header, problem starts here <?php else { //header("Location:".$_SERVER['HTTP_REFERER'].""); exit(); } ?> What is the problem ? Why the header() is not working or is not giving any error
  19. <?php if ($_SESSION['loggedIn'] != 'reviewer') { //check the registered user, if not go index.php if(!$_SESSION['id']) { header("location:index.php"); die(); } else //if registered with different user type turn back to your page { echo $HTTP_REFERER; header("Location:".$_SERVER['HTTP_REFERER'].""); } } ?> this part is not working else { echo $HTTP_REFERER; header("Location:".$_SERVER['HTTP_REFERER'].""); } but if I write like this it is working else { exit(); } What is the problem ?
  20. <?php if ($_SESSION['loggedIn'] != 'reviewer') { //check the registered user, if not go index.php if(!$_SESSION['id']) { header("location:index.php"); die(); } else //if registered with different user type turn back to your page { echo $HTTP_REFERER; header("Location:".$_SERVER['HTTP_REFERER'].""); } } ?> this part is not working else { echo $HTTP_REFERER; header("Location:".$_SERVER['HTTP_REFERER'].""); } but if I write like this it is working else { session_destroy(); exit(); } WHY header("Location:".$_SERVER['HTTP_REFERER'].""); is not working!!!!!
  21. I have another question that code gives the current page $pageURL ="http://"; $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']; how to redirect to previous page? <?php if ($_SESSION['loggedIn'] != 'admin') { //check the registered user, if not go index.php if(!$_SESSION['id']) { header("location:index.php"); die(); } else //if registered with different user type, turn back to your page {//header("Location:".$_SERVER['HTTP_REFERER'].""); $pageURL ="http://"; $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']; //echo $pageURL = www.aaaa.com/admin.php //but it must redirect to = previous page header("Location: $pageURL "); die(); } } ?>
  22. I forgot to put if ($_SESSION['loggedIn'] != 'admin') you are right! thank you
  23. i login with user account id username password email type 10 pa pa a@aa user than im going to user.php page. but when I write admin.php also I can see the admin part user mustnt see the admin part. what can be the problem? if (!$_SESSION['loggedIn'] == 'admin') { header("location:login.php"); die (); } print_r($_SESSION); echo "<br />".$_SESSION['loggedIn']; //type is user but I can see the admin page
  24. MySQL code CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL auto_increment, `username` varchar(50) collate latin1_general_ci NOT NULL, `password` varchar(50) collate latin1_general_ci NOT NULL, `email` varchar(200) collate latin1_general_ci NOT NULL, `type` varchar(20) collate latin1_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; id username password email type 1 p p a@a admin login_control.php $sql="SELECT * FROM user WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched table row must be 1 row if($count==1){ $row = mysql_fetch_array($result); $_SESSION['loggedIn'] = $row['type']; $_SESSION['id'] = $row['id']; header("location:{$row['type']}.php?"); } that part is not working, how can I control the correct type user user.php (for users) admin.php (for admins) only admin user must see that part. But HOW ? Can any body give me a hint? If there are guys or girls who has done similar things, please help me Thanks in advance admin.php session_start(); if (!$_SESSION['loggedIn'] == 'admin') { header("location:login.php"); die (); } //page start here
×
×
  • 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.