Jump to content

slanderman

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

slanderman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. actually, nevermind, figured this one out on my own hehe, thanks anyway
  2. Does anyone know of a script, or is it even possible to redirect users running a Mac to a different page? Want it to redirect based on OS rather than browser. Could something like this be manipulated to redirect users based on the OS? $OSList = array ( // Match user agent string with operating systems 'Windows 3.11' => 'Win16', 'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)', 'Windows 98' => '(Windows 98)|(Win98)', 'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)', 'Windows XP' => '(Windows NT 5.1)|(Windows XP)', 'Windows Server 2003' => '(Windows NT 5.2)', 'Windows Vista' => '(Windows NT 6.0)', 'Windows 7' => '(Windows NT 7.0)', 'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)', 'Windows ME' => 'Windows ME', 'Open BSD' => 'OpenBSD', 'Sun OS' => 'SunOS', 'Linux' => '(Linux)|(X11)', 'Mac OS' => '(Mac_PowerPC)|(Macintosh)', 'QNX' => 'QNX', 'BeOS' => 'BeOS', 'OS/2' => 'OS/2', 'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves/Teoma)|(ia_archiver)' ); // Loop through the array of user agents and matching operating systems foreach($OSList as $CurrOS=>$Match) { // Find a match if (eregi($Match, $_SERVER['HTTP_USER_AGENT'])) { // We found the correct match break; } } // You are using Windows Vista echo "You are using ".$CurrOS;
  3. yea, I see that...at first glance it looked like the whole piece of the "Welcome..." Script was gone completely, I didnt see that he had rewritten it
  4. Thats awesome Techie Thanks so much for your help :D
  5. oops, now i see what ya did, i'll try it
  6. okie dokie, here we go kids This one is my search.php page, the one page i need password protection on <?php session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> <?php include '/header.php'; ?> <title>Our Models</title> </head> <body> <!-- Begin Wrapper --> <div id="wrapper"> <!-- Begin Header --> <div id="header"><h1><a href="http://www.bluesapphirestudios.com"><img src="../slanderbanner.jpg" border=0></a></h1> <br /> <?php if(isset($_SESSION['myusername'])){ echo "<strong><font color='#fffff'>Welcome ".$_SESSION['myusername']."</font></strong> ... <a href='http://www.bluesapphirestudios.com/search/logout.php'>Logout</a>"; }else{ echo "<a href=\"http://www.bluesapphirestudios.com/search/main_login.php\">Login</a>"; } ?> </div> <!-- End Header --> <?php include '/menu2.php'; ?> <div id="rightcolumn"> <br /><br /> </h3> <form method="post" action="sqlsearch.php"> Search Models: <input type="Text" name=".$Search" size="20" maxlength="30"> <input type="Submit" name="submit" value="Search"> </form> </div> <?php include '/footer.php'; ?> This one is my checklogin.php <?php $host="HOST"; // Host name $username="USERNAME"; // Mysql username $password="PASSWORD"; // Mysql password $db_name="DBNAME"; // Database name $tbl_name="TABLENAME"; // 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"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name 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 $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "search.php" //session_register("myusername"); $_SESSION['myusername'] = $myusername; session_register("mypassword"); header("location:search.php"); } else { echo "Wrong Username or Password"; } ?> Missing anything?
  7. this is what is at the beginning of the page if this helps... <?php session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?>
  8. ok, I've got all that changed..already had session start at beginning... Its no longer displaying "Welcome..." or logout link when the user is logged in <?php if(isset($_SESSION['myusername'])){ echo "<strong><font color='#fffff'>Welcome ".$_SESSION['myusername']."</font></strong> ... <a href='http://www.bluesapphirestudios.com/search/logout.php'>Logout</a>"; }else{ echo "<a href=\"http://www.bluesapphirestudios.com/search/main_login.php\">Login</a>"; } ?> // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name 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 $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "search.php" //session_register("myusername"); $_SESSION['myusername'] = $myusername; session_register("mypassword"); header("location:search.php"); } else { echo "Wrong Username or Password"; } ?>
  9. thats great info, I think I'm still using the wrong variable, everything I try either displays plain text, or nothing at all... Welcome (myusername) ... logout and Welcome ... logout <? if(session_is_registered(myusername)){ echo "<strong><font color='#fffff'>Welcome $myusername</font></strong> ... <a href='http://www.bluesapphirestudios.com/search/logout.php'>Logout</a>"; }else{ echo "<a href=\"http://www.bluesapphirestudios.com/search/main_login.php\">Login</a>"; } ?>
  10. ok, no more error, it almost works lol its displaying "Welcome $session_is_registered[myusername]" as text rather than seeing this as a variable and inserting the session uid. I'm not sure where to find the correct variable to use to make this display the logged in persons username this is the contents of my checklogin.php *excluding database connection settings*, would the variable I need to reference be in here? // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name 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 $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "search.php" session_register("myusername"); session_register("mypassword"); header("location:search.php"); } else { echo "Wrong Username or Password"; } ?>
  11. oops, I missed part of your post, let me go try again! sorry
  12. if I escape the quotes and leave the curly braces on line 25, I get the same error, if I remove the curly braces from line 25, I get this error now Parse error: syntax error, unexpected T_ELSE, expecting ',' or ';' in /search.php on line 25 <? if(session_is_registered(myusername)){ echo '<strong><font color='#000000'>Welcome $session_is_registered[myusername]</font></strong> ... <a href=\"http://www.bluesapphirestudios.com/search/logout.php\">Logout</a>'; else //this is line 25 echo '<a href=\"http://www.bluesapphirestudios.com/search/main_login.php\">Login</a>'; } ?>
  13. yes, that worked beautifully... I keep adding bits and pieces to the code and I keep breaking it as I go...can you help with one more? lol Parse error: syntax error, unexpected '}', expecting ',' or ';' in /search.php on line 25 <? if(session_is_registered(myusername)){ echo '<strong><font color='#000000'>Welcome $session_is_registered[myusername]</font></strong> ... <a href="http://www.bluesapphirestudios.com/search/logout.php">Logout</a>'; }else{ //This is line 25 echo '<a href="http://www.bluesapphirestudios.com/search/main_login.php">Login</a>'; } ?>
  14. getting syntax error, what did I do wrong? lol Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /search.php on line 22 <?php if(isset($_SESSION['uid'])) echo "<a href="http://www.bluesapphirestudios.com/search/logout.php">Logout</a>"; //this is line 22 else echo "<a href="http://www.bluesapphirestudios.com/search/main_login.php">Login</a>"; ?>
×
×
  • 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.