Jump to content

blink359

Members
  • Posts

    169
  • Joined

  • Last visited

    Never

Everything posted by blink359

  1. It was disabled but do you mean? If so, what do I need to do to set it up correctly?
  2. Topic moving away from PhP now :/ I get 401 - Unauthorized: Access is denied due to invalid credentials.
  3. echo ">male; is missing close quotation echo ">male";
  4. Hi, I am trying to get the local windows username on the domain PC's on our intranet, I have tried $_SERVER['LOGON_USER'] but it doesn't seem to work, How can I go about doing this. Regards, Nathan
  5. Hi there, having a few problems with my pagination script firstly i get an error "mysql_fetch_array(): supplied argument is not a valid MySQL result resource " before it was doing that all the time (it was doing it on/off for a bit) my search feature didnt seem to be narrowing down the results, Here is my code: <?php //mysql connect is here $name = $_POST['name']; $county = $_POST['county']; $town = $_POST['town']; $max = 10; //amount of articles per page. change to what to want $p ="1"; $p = $_GET['p']; $pp = $p -1; $np = $p +1; $limits = ($p - 1) * $max; //view the news article! if(!$name || !$county || !$town){ $sql = mysql_query("SELECT * FROM pusers LIMIT ".$limits.",$max"); $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM pusers"),0); $totalpages = ceil($totalres / $max); $nplimit = $totalpages; $nplimit++; while($info = mysql_fetch_array($sql)){ echo $info['pname']; echo '<br>'; echo $info['ptown']; } echo'<br>'; if($pp =="0"){ echo(''); }else{ echo'<a href="publist.php?p='. $pp .'">'. Previous .'</a> '; } for($i = 1; $i <= $totalpages; $i++){ echo'<a href="publist.php?p='. $i .'">'. $i .'</a> '; } if($np == $nplimit){ echo(''); }else{ echo'<a href="publist.php?p='. $np .'">'. Next .'</a> '; } }else{ $sql =""; if($name !=""){ $searchsplit = explode(" ", $pubname); $searchsplit0 = $searchsplit['0']; $searchsplit1 = $searchsplit['1']; $searchsplit2 = $searchsplit['2']; $searchsplit3 = $searchsplit['3']; $searchsplit4 = $searchsplit['4']; $searchsplit5 = $searchsplit['5']; $searchsplit6 = $searchsplit['6']; $searchsplit7 = $searchsplit['7']; $searchsplit8 = $searchsplit['7']; $searchsplit9 = $searchsplit['9']; if($searchsplit0 =="the" || $searchsplit0 =="The" || $searchsplit0 =="of" || $searchsplit0 =="Of" || $searchsplit0 =="and" || $searchsplit0 =="And" || $searchsplit0 ==""){ $use0 ="no"; } if($searchsplit1 =="the" || $searchsplit1 =="The" || $searchsplit1 =="of" || $searchsplit1 =="Of" || $searchsplit1 =="and" || $searchsplit1 =="And" || $searchsplit1 ==""){ $use1 ="no"; } if($searchsplit2 =="the" || $searchsplit2 =="The" || $searchsplit2 =="of" || $searchsplit2 =="Of" || $searchsplit2 =="and" || $searchsplit2 =="And" || $searchsplit2 ==""){ $use2 ="no"; } if($searchsplit3 =="the" || $searchsplit3 =="The" || $searchsplit3 =="of" || $searchsplit3 =="Of" || $searchsplit3 =="and" || $searchsplit3 =="And" || $searchsplit3 ==""){ $use3 ="no"; } if($searchsplit4 =="the" || $searchsplit4 =="The" || $searchsplit4 =="of" || $searchsplit4 =="Of" || $searchsplit4 =="and" || $searchsplit4 =="And" || $searchsplit4 ==""){ $use4 ="no"; } if($searchsplit5 =="the" || $searchsplit5 =="The" || $searchsplit5 =="of" || $searchsplit5 =="Of" || $searchsplit5 =="and" || $searchsplit5 =="And" || $searchsplit5 ==""){ $use5 ="no"; } if($searchsplit6 =="the" || $searchsplit6 =="The" || $searchsplit6 =="of" || $searchsplit6 =="Of" || $searchsplit6 =="and" || $searchsplit6 =="And" || $searchsplit6 ==""){ $use6 ="no"; } if($searchsplit7 =="the" || $searchsplit7 =="The" || $searchsplit7 =="of" || $searchsplit7 =="Of" || $searchsplit7 =="and" || $searchsplit7 =="And" || $searchsplit7 ==""){ $use7 ="no"; } if($searchspli8 =="the" || $searchspli8 =="The" || $searchspli8 =="of" || $searchspli8 =="Of" || $searchspli8 =="and" || $searchspli8 =="And" || $searchspli8 ==""){ $use8 ="no"; } if($searchsplit9 =="the" || $searchsplit9 =="The" || $searchsplit9 =="of" || $searchsplit9 =="Of" || $searchsplit9 =="and" || $searchsplit9 =="And" || $searchsplit9 ==""){ $use9 ="no"; } if($searchsplit1 =="" & $searchsplit2 =="" & $searchsplit3 =="" & $searchsplit4 =="" & $searchsplit5 =="" & $searchsplit6 =="" & $searchsplit7 =="" & $searchsplit8 =="" & $searchsplit9 ==""){ $use0="no"; } $sql ='SELECT FROM pusers WHERE pname LIKE \''. $pubname .'\''; if($use0 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit0 .'\''; } if($use1 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit1 .'\''; } if($use2 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit2 .'\''; } if($use3 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit3 .'\''; } if($use4 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit4 .'\''; } if($use5 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit5 .'\''; } if($use6 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit6 .'\''; } if($use7 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit7 .'\''; } if($use8 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchspli8 .'\''; } if($use9 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit9 .'\''; } } if($county !="" & $sql ==""){ $county = $_POST['county']; $sql ="SELECT FROM pusers WHERE pcounty = '$county'"; }else if( $county !="" & $sql !=""){ $sql =''. $sql .' AND pcounty = \''. $county .'\''; } if($town !=""){ $tsearchsplit = explode(" ", $town); $tsearchsplit0 = $tsearchsplit['0']; $tsearchsplit1 = $tsearchsplit['1']; $tsearchsplit2 = $tsearchsplit['2']; $tsearchsplit3 = $tsearchsplit['3']; $tsearchsplit4 = $tsearchsplit['4']; if($tsearchsplit0 ==""){ $tuse0 ="no"; } if($tsearchsplit1 ==""){ $tuse1 ="no"; } if($tsearchsplit2 ==""){ $tuse2 ="no"; } if($searchsplit3 ==""){ $tuse3 ="no"; } if($tsearchsplit4 ==""){ $tuse4 ="no"; } if($tsearchsplit1 =="" & $tsearchsplit2 =="" & $tsearchsplit3 =="" & $tsearchsplit4 ==""){ $tuse0 ="no"; } $tsearchsplit2 = explode("-", $town); $tsearchsplit02 = $tsearchsplit2['0']; $tsearchsplit12 = $tsearchsplit2['1']; $tsearchsplit22 = $tsearchsplit2['2']; $tsearchsplit32 = $tsearchsplit2['3']; $tsearchsplit42 = $tsearchsplit2['4']; if($tsearchsplit0 ==""){ $tuse0 ="no"; } if($tsearchsplit1 ==""){ $tuse1 ="no"; } if($tsearchsplit2 ==""){ $tuse2 ="no"; } if($searchsplit3 ==""){ $tuse3 ="no"; } if($tsearchsplit4 ==""){ $tuse4 ="no"; } if($tsearchsplit02 ==""){ $tuse02 ="no"; } if($tsearchsplit12 ==""){ $tuse12 ="no"; } if($tsearchsplit22 ==""){ $tuse22 ="no"; } if($searchsplit32 ==""){ $tuse32 ="no"; } if($tsearchsplit42 ==""){ $tuse42 ="no"; } if($tsearchsplit1 =="" & $tsearchsplit2 =="" & $tsearchsplit3 =="" & $tsearchsplit4 ==""){ $tuse0 ="no"; } if($tsearchsplit12 =="" & $tsearchsplit22 =="" & $tsearchsplit32 =="" & $tsearchsplit42 ==""){ $tuse02 ="no"; } if($sql ==""){ $sql ='SELECT FROM pusers WHERE ptown LIKE \''. $town .'\''; if($tuse0 !="no"){ $sql =''.$sql .' OR ptown LIKE '. $tsearchsplit0 .''; } if($tuse1 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit1 .'\''; } if($tuse2 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit2 .'\''; } if($tuse3 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit3 .'\''; } if($tuse4 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit4 .'\''; } if($tuse02 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit02 .'\''; } if($tuse12 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit12 .'\''; } if($tuse22 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit22 .'\''; } if($tuse32 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit32 .'\''; } if($tuse42 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit42 .'\''; } }else{ $sql =''. $sql .' AND ptown LIKE \''. $town .'\''; if($tuse0 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit0 .'\''; } if($tuse1 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit1 .'\''; } if($tuse2 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit2 .'\''; } if($tuse3 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit3 .'\''; } if($tuse4 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit4 .'\''; } if($tuse02 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit02 .'\''; } if($tuse12 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit12 .'\''; } if($tuse22 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit22 .'\''; } if($tuse32 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit32 .'\''; } if($tuse42 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit42 .'\''; } } } $sql =''. $sql .' LIMIT ".$limits.",$max"'; $sql ='mysql_query("'. $sql .'")'; $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM pusers"),0); $totalpages = ceil($totalres / $max); $nplimit = $totalpages; $nplimit++; while($info = mysql_fetch_array($sql2)){ echo $info['pname']; echo $info['ptown']; } echo'<br>'; if($pp =="0"){ echo(''); }else{ echo'<a href="publist.php?p='. $pp .'">'. Previous .'</a> '; } for($i = 1; $i <= $totalpages; $i++){ echo'<a href="publist.php?p='. $i .'">'. $i .'</a> '; } if($np == $nplimit){ echo(''); }else{ echo'<a href="publist.php?p='. $np .'">'. Next .'</a> '; } echo'<br>'; echo $sql; } ?> Any help will be much appriciated, Thanks, Blink359
  6. I did check the variables, the do contain what there meant to but there is no error shown its just blank were the data should be everything else on the page is fine e.g the page navigation (e.g.<< < 1 2 3 4 > >>)
  7. Hi there Im trying to add a search feature to my pagination but with some googling and searching have had no luck and have also had no luck trying myself this is what i have so far Form <form action="publist.php" method="post"> Search: <input type="text" name="search"> By: <select name="by"> <option value="name" selected="selected">Name</option> <option value="town">Town</option> <option value="county" >County</option> </select> Results Per Page: <select name="perpage"> <option value="10" selected="selected">10</option> <option value="25">25</option> <option value="50" >50</option> </select> <input type="hidden" name="hidden"> <input type="submit" value="Search"> </form> Related code: if(isset($_POST['hidden'])){ $by = $_POST['by']; $search = $_POST['search']; $sql = "SELECT * FROM table WHERE approved = 'Yes' AND '. $by .' = '. $search .' LIMIT $offset, $rowsperpage"; }else{ $sql = "SELECT * FROM table WHERE approved = 'Yes' LIMIT $offset, $rowsperpage"; } $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); while ($list = mysql_fetch_assoc($result)) { echo' <table width="700" border="1"> <tr> <td colspan="3">'. $list['name'] .'</td> </tr> <tr> <td height="24">Town: '. $list['town'] .'</td> <td>County: '. $list['county'] .'</td> <td>Postcode: '. $list['postcode'] .'</td> </tr> <tr> <td>Contact Number: '. $list['phone'] .'</td> <td>Email: '. $list['pubemail'] .'</td> <td><a href="info.php?id='. $list['ID'] .'">More Information</a></td> </tr> </table><br>'; } But when i try the search it comes out blank, Any help would be great Thanks, Blink359
  8. hmm that works but if i limit it to one row of information per page (Which is what im doing whilst i test it out as i only have 3 records for testing) I have a blank third page anyway to stop this?
  9. Hi there i wanted to know how i could rule out certain rows from being shown in the pagination in this case i want to approve all information before it's posted i tried $sql = "SELECT * FROM tablename LIMIT $offset, $rowsperpage WHERE approved = 'Yes'"; But it didnt work Any help would be great, Thanks, Blink359
  10. Ah thanks for that, found the problem Blink359
  11. Hi im trying to get pagination to work this is something im very new to and have tried a load f tutorial scripts but i keep getting: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a1581845/public_html/publist.php on line 60 here is my php code: <html> <head> <link rel="stylesheet" href="css/reset.css"> <link rel="stylesheet" href="css/style.css"> <title>E-Beer - Buying your pint has never been so easy!</title> </head> <body> <div id="head"><div id="header"> <div id="logo"></div><div id="login"> <form action="#" method="post"> <h3>Login to website:</h3> Username: <input type="text" name="name" class="1pxtotheright"><br> Password: <input type="password" name="password" class="1pxtotheright"><br> <div class="smallprint"><a href="register.php">Register Now</a> <a href="forget.php">Forgot Your Password?</a> </div> <input type="submit" value="Login"> </form> </div> </div> <div id="navbar"><a href="#">Home</a> <a href="#">Find a Pub</a> <a href="#">Register</a> <a href="#">Add your Pub</a> <a href="#">Contact Us</a> <a href="#">About Us</a></div> </div> <div id="container"> <?php include('includes/mysql.php'); $max = 1; //amount of articles per page. change to what to want $p = $_GET['p']; if(empty($p)) { $p = 1; } $limits = ($p - 1) * $max; //view the news article! if(isset($_GET['act']) && $_GET['act'] == "view") { $id = $_GET['id']; $sql = mysql_query("SELECT * FROM data WHERE id = '$id'"); while($info = mysql_fetch_array($sql)) { echo ' information'; } }else{ //view all the news articles in rows $sql = mysql_query("SELECT * FROM data LIMIT ".$limits.",$max"); //the total rows in the table $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM Pubs"),0); //the total number of pages (calculated result), math stuff... $totalpages = ceil($totalres / $max); //the table echo "<table><tr><td>Title</td><td>Author</td></tr><tr>"; while($info = mysql_fetch_array($sql)) { echo ' information } //close up the table echo " </tr></table>"; for($i = 1; $i <= $totalpages; $i++){ //this is the pagination link echo'<a href="publist.php?p='. $i .'">'. $i .'</a>'; } } ?> </div> </body> </html> If anyone could help it will be great, Thanks, Blink359
  12. Hi there i would like to send my clients a randomly generated order code by email i have had no success so far and was wondering how to do it. Any help would be great! Thanks, Blink359
  13. How do i include a php variable inside the body of my email i've tried a number of things and have had no success here is my code a the moment <? FunCtion gEtRAnDomString($lEngth = 4) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString1($lEngth = 6) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString2($lEngth = 4) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString3($lEngth = 6) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString4($lEngth = 4) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } $code = " gEtRAnDomString() - gEtRAnDomString1() - gEtRAnDomString2() - gEtRAnDomString3() - gEtRAnDomString4() "; //change this to your email. $to = "n**********"; $from = "na*******y_19*******co.uk"; $subject = "Code"; $message = "Your order code is: $code "; $headers .= "From: $from"; mail($to, $subject, $message, $headers); echo "Message has been sent....!"; ?> If anyone can help it will be great Thanks, Blink359
  14. Hi there im not quite sure how to do something and was wondering if anyone can help me, I am going to create a large database with lots of fields and these are going to be displayed on a page i want to limit it to 20 per page and be able to sort them aswell by ID (default) and then a-z or z-a, i dont know how to do this and i also need to know how to create the next previous and last and first links im guessing theres a count++ involved ? im not quite sure but anyway if someone can help it will be great. Thanks, Blink359
  15. Im dabbling in PhP and its something i want to do if years and months is what it takes i shall get there (Im 16 at the moment and need to find a decent way of learning all this) any good websites/books? that are up to data with php 5.3?
  16. Hi, i'm looking to start learning how to do ecommerce websites, im not sure what im going to need to do and cant seem to find any tutorials that show everything i need to do, If you know any it would be great if you can share them, Thanks, Blink359 p.s sorry if i posted in wrong section
  17. Hi there i have made a mistake setting or checking my sessions and was not sure what it is because i cant reach my locked content Creating: session_start(); if ($role="valiant") { $_SESSION["username"] =="valiant"; header("location: 1/index.php"); }elseif($role="vulcan") { $_SESSION["username"] =="vulcan"; header("location: 2/index.php"); }else{ echo "Wrong Username or Password"; } Checking: <?php // Inialize session session_start(); // Check, if username session is NOT set then this page will jump to login page if (!isset($_SESSION['username']) || $_SESSION['username'] != "valiant") { header("location:../index.php"); } ?> //OR <?php // Inialize session session_start(); // Check, if username session is NOT set then this page will jump to login page if (!isset($_SESSION['username']) || $_SESSION['username'] != "vulcan") { header("location:../index.php"); } ?> Any help will be great Thanks, Blink359
  18. Got a step closer no php error but my headers are the same as last time but not redirecting the user: <html> <head> <title></title> </head> <body> <form action="JNCOlogin.php" method="post"> Surname:<br><input type="text" name="myusername"><br> Password:<br><input type="password" name="mypassword"><br> <input type="submit" name="submit" value="Login"> <input type="hidden" name="code"> </form> <?php if(isset($_POST['code'])) { $host="mysql12.000webhost.com"; // Host name $username="a9855336_root"; // Mysql username $password="n4th4n%"; // Mysql password $db_name="a9855336_mail"; // Database name // Connect to server and select databse. mysql_connect($host, $username, $password); mysql_select_db($db_name); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); // encrypt password $encrypted_mypassword=md5($mypassword); $sql="SELECT * FROM cdtmembers WHERE username='$myusername' and password='$encrypted_mypassword'"; $result=mysql_query($sql); $row = mysql_fetch_array($result); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1 & $row['flight']=="vulcan"){ $_SESSION['flight'] = $row['flight']; header("location:2/index.php"); }else if($count==1 & $row['flight']=="valiant") $_SESSION['flight'] = $row['flight']; header("location:1/index.php"); }else { echo "Wrong Username or Password"; } } ?> </body> </html>
  19. Ok thanks, what about the new code i put up, im trying to understand all this session stuff a bit better but im following tuts atm and trying to change it to my site atm
  20. Tried to do it again with different script but i get Parse error: syntax error, unexpected $end in /home/a9855336/public_html/261website/index.php on line 45 from this code <html> <head> <title>Login</title> </head> <body> <form action="index.php" method="post"> Surname:<br><input type="text" name="myusername"><br> Password:<br><input type="password" name="mypassword"><br> <input type="submit" name="submit" value="Login"> <input type="hidden" name="code"> </form> <?php if(isset($_POST['code'])) { $host="mysq*******t.com"; // Host name $username="a*******t"; // Mysql username $password="n******%"; // Mysql password $db_name="a********il"; // Database name // Connect to server and select databse. mysql_connect($host, $username, $password); mysql_select_db($db_name); // Retrieve username and password from database according to user's input $login = mysql_query("SELECT * FROM cdtmembers WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')"); $row = mysql_fetch_array($login); session_start(); // Check username and password match if (mysql_num_rows($login) == 1 && $row['flight'] =="vulcan") { if($row['flight'] =="vulcan"){ $_SESSION['flight'] = $_POST['flight']; header('location: vulcan/index.php'); }else if (mysql_num_rows($login) == 1 && $row['flight'] =="valiant") { if($row['flight'] =="vulcan"){ $_SESSION['flight'] = $_POST['flight']; header('location: valiant/index.php'); }else{ echo "Wrong Username or Password"; } } ?> </body> </html> line 45 i believe :S Also is my check session correcet now? <?php session_start(); if (!isset($_SESSION['flight']) && $_SESSION['flight'] !="valiant") { header('Location: ../index.php'); } ?>< //or <?php session_start(); if (!isset($_SESSION['flight']) && $_SESSION['flight'] !="vulcan") { header('Location: ../index.php'); } ?><
  21. Hi there i have a login script to access an area which is restricted on my website rather than having 2 logon scripts i want 1 logon script to create one of two sessions this script is what i wrote from a tutorial but the session allows access to both areas which i dont want, can someone please help me change it to work but talk me through it so i can learn from this: Create Session: if($count==1 & $row['flight']=="vulcan"){ session_start(vmyusername); session_start(vmypassword); header("location:vulcan/index.php"); }else if($count==1 & $row['flight']=="valiant"){ session_start(myusernamev); session_start(mypasswordv); header("location:valiant/index.php"); }else { echo "Wrong Username or Password"; } Check login: <? session_start(); if(!session_is_registered(myusernamev)){ header("location:../login.php"); } ?> //or <? session_start(); if(!session_is_registered(vmyusername)){ header("location:../login.php"); } ?> Any help will be greatly appriciated Thanks Blink359
  22. Sorted my headers but that code and my session code doesnt restrict the user from accessing the other content session start if($count==1 & $row['flight']=="vulcan"){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_start(vmyusername); session_start(vmypassword); header("location:vulcan/index.php"); }else if($count==1 & $row['flight']=="valiant"){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_start(myusernamev); session_start(mypasswordv); header("location:valiant/index.php"); }else { echo "Wrong Username or Password"; } check session: <? session_start(); if(!session_is_registered(vmyusername)){ header("location:../login.php"); } ?> //OR <? session_start(); if(!session_is_registered(myusernamev)){ header("location:../login.php"); } ?> What do i do?
×
×
  • 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.