Jump to content

unidox

Members
  • Posts

    557
  • Joined

  • Last visited

    Never

Everything posted by unidox

  1. make sure the db table is not int, but varchar.
  2. unidox

    Session

    Login.php: <?php session_start(); include("../incs/conf.inc.php"); if ($_SESSION['admin'] == 1) { header("Location: index.php"); // The user is already logged in. } elseif (($_COOKIE['user']) && ($_COOKIE['pass'])) { $user = $_COOKIE['user']; $pass = $_COOKIE['pass']; $admin = $level['admin']; $ip = $_SERVER["REMOTE_ADDR"]; $date = "" . date('l dS \of F Y h:i:s A') . " EST"; //MySQL Query $q = mysql_query("SELECT * FROM `pcp_users` WHERE password = '$pass' AND username = '$user' AND level <= '$admin'"); $r = mysql_fetch_array($q); if (mysql_num_rows($q) == 1) { mysql_query("UPDATE `pcp_users` SET ip = '$ip', date = '$date' WHERE password = '$pass' AND username = '$user' AND level <= '$admin'"); $_SESSION['admin'] = 1; $_SESSION['user'] = $r['username']; header("Location: index.php"); } else { setcookie("user", "", time()-3600); setcookie("pass", "", time()-3600); header("Location: login.php"); } } else { if ($_GET['s'] == 1) { if ($_POST['user'] == "") { header("Location: login.php?e=1"); exit(); } elseif ($_POST['pass'] == "") { header("Location: login.php?e=2"); exit(); } else { // Vars $pass = md5($_POST['pass']); // Encrypts the password. $user = escape_data($_POST['user']); $admin = $level['admin']; $rem = $_POST['rem']; $ip = $_SERVER["REMOTE_ADDR"]; $date = "" . date('l dS \of F Y h:i:s A') . " EST"; //MySQL Query $q = mysql_query("SELECT * FROM `pcp_users` WHERE password = '$pass' AND username = '$user' AND level <= '$admin'"); $r = mysql_fetch_array($q); if (mysql_num_rows($q) == 1) { // Makes sure the username and password match up. if ($rem != "") { setcookie(user, $r['username']); setcookie(pass, $r['password']); } mysql_query("UPDATE `pcp_users` SET ip = '$ip', date = '$date' WHERE password = '$pass' AND username = '$user' AND level <= '$admin'"); $_SESSION['admin'] = 1; $_SESSION['user'] = $r['username']; header("Location: index.php"); } else { header("Location: login.php?e=4"); exit(); } } } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="US-EN" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <title>Test</title> <link rel="stylesheet" type="text/css" href="incs/admin.css" /> <script type="text/javascript" src="incs/tip.js"></script> <style type="text/css"> body { background-repeat: repeat-x; background-image: url(images/login_bg.gif); } table { font-size: 12px; font-family: verdana, arial, sans-serif; } </style> </head> <body class="login"> <div align="center"> <table border="0" width="237" cellspacing="0" cellpadding="0" style="margin-top: 88px;"> <tr> <td> <img border="0" src="images/login_logo.gif" width="237" height="87"></td> </tr> <tr> <td height="5"> <img border="0" src="images/login_top_bar.gif" width="237" height="5"></td> </tr> <tr valign="middle"> <form action="login.php?s=1" method="post"> <td background="images/login_bg2.gif" height="32"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="102"> <tr> <td rowspan="5" width="10"> </td> <td colspan="3" height="12"></td> <td rowspan="5" width="16" valign="top"><? if ($_GET['e'] == 1) { echo "<img src=\"images/info.gif\" style=\"margin-right: 5px;\" width=\"11\" height=\"11\" alt=\"\" onMouseover=\"ddrivetip('<strong class=red>Error:</strong> You need to enter a username.', 300)\"; onMouseout=\"hideddrivetip()\" />"; } elseif ($_GET['e'] == 2) { echo "<img src=\"images/info.gif\" style=\"margin-right: 5px;\" width=\"11\" height=\"11\" alt=\"\" onMouseover=\"ddrivetip('<strong class=red>Error:</strong> You need to enter a password.', 300)\"; onMouseout=\"hideddrivetip()\" />"; } elseif ($_GET['e'] == 3) { echo "<img src=\"images/info.gif\" style=\"margin-right: 5px;\" width=\"11\" height=\"11\" alt=\"\" onMouseover=\"ddrivetip('<strong class=red>Error:</strong> You need to enter something other than the default username/password.', 300)\"; onMouseout=\"hideddrivetip()\" />"; } elseif ($_GET['e'] == 4) { echo "<img src=\"images/info.gif\" style=\"margin-right: 5px;\" width=\"11\" height=\"11\" alt=\"\" onMouseover=\"ddrivetip('<strong class=red>Error:</strong> Incorrect username/password.', 300)\"; onMouseout=\"hideddrivetip()\" />"; } elseif ($_GET['e'] == 5) { echo "<img src=\"images/info.gif\" style=\"margin-right: 5px;\" width=\"11\" height=\"11\" alt=\"\" onMouseover=\"ddrivetip('<strong class=green>Success:</strong> You have been logged out.', 300)\"; onMouseout=\"hideddrivetip()\" />"; }?> </td> </tr> <tr height="20"> <td>Username:</td> <td width="5"> </td> <td><input name="user" class="login" size="18" /></td> </tr> <tr height="18"> <td colspan="3"></td> </tr> <tr height="20"> <td>Password:</td> <td> </td> <td><input name="pass" type="password" class="login" size="18" /></td> </tr> <tr height="30"> <td colspan="3" align="left"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="30"> <tr valign="middle"> <td> <label style="margin-top: 0;">Remember Me:</label> <input style="margin-top: 0;" name="rem" type="checkbox"></td> <td align="right"><p class="submit"><input value="" type="submit"></p></td> </tr> </table> </td> </tr> </table> </td> </form> </tr> <tr> <td height="5"> <img border="0" src="images/login_btm_bar.gif" width="237" height="5"></td> </tr> </table> </div> </body> </html> <? } } ?> Index.php: <?php session_start(); include ('../incs/conf.inc.php'); if ($_SESSION['admin'] != 1) { header("Location: login.php"); } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="US-EN" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <title>Test</title> <link rel="stylesheet" type="text/css" href="incs/admin.css" /> <script type="text/javascript" src="incs/tip.js"></script> <style type="text/css"> body { background-color: #FFFFFF; } table { font-size: 12px; font-family: verdana, arial, sans-serif; } .side,a { color: #FFFFFF; text-decoration: none; } div.pure { width: 400px; font-size: 12px; font-family: verdana, arial, sans-serif; height: 20px; text-align: left; position: absolute; margin-left: 10px; margin-top: 540px; } </style> </head> <body> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td background="images/admin_header.gif" height="52"> </td> </tr> <tr> <td height="100%" align="center"> <table border="0" width="850" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" background="images/admin_nav.gif" height="35" class="side" style="text-align: center; letter-spacing:2pt"> <div style="margin-left: 15px;"><a href="index.php">Home</a> | Modules | Pages | Users | Look & Feel | Support | <a href="logout.php">Logout</a></div> </td> </tr> <tr> <td width="193"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%" class="side"> <tr style="text-align: left;"> <td background="images/admin_side_top.gif" height="33"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%" class="side"> <tr> <td width="15"> </td> <td style="font-weight: bold; font-size:10px"> www.pure-cp.com</td> </tr> </table> </td> </tr> <tr> <td> <img border="0" src="images/admin_side_sep.gif" width="193" height="10"></td> </tr> <tr> <td background="images/admin_side_body.gif" height="397" valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="29" background="images/admin_side_bg2.gif" class="side"> <tr> <td width="15"> </td> <td style="text-align: left" height="29">- Home</td> </tr> <tr> <td width="15"> </td> <td style="text-align: left" height="29">- News</td> </tr> <tr> <td width="15"> </td> <td style="text-align: left" height="29">- Help</td> </tr> <tr> <td width="15"> </td> <td style="text-align: left" height="29">- Support</td> </tr> </table> </td> </tr> <tr> <td> <img border="0" src="images/admin_side_btm.gif" width="193" height="4"></td> </tr> </table> </td> <td background="images/admin_bg.gif" valign="top" height="100%"> <table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%"> <tr> <td height="440" valign="top" style="text-align: left;"> <?php if ($_GET['p']) { include("pages/" . $_GET['p'] . ".inc.php"); } else { include("pages/main.inc.php"); } ?> </td> </tr> <tr> <td> <img border="0" src="images/admin_main_btm.gif" width="657" height="4"></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td height="100%" align="center"> Test</td> </tr> </table> </body> </html> <? } ?>
  3. unidox

    Session

    Here is my login code: if (mysql_num_rows($q) == 1) { // Makes sure the username and password match up. if ($rem != "") { setcookie(user, $r['username']); setcookie(pass, $r['password']); } mysql_query("UPDATE `pcp_users` SET ip = '$ip', date = '$date' WHERE password = '$pass' AND username = '$user' AND level <= '$admin'"); $_SESSION['admin'] = 1; $_SESSION['user'] = $r['username']; header("Location: index.php"); } else { header("Location: login.php?e=4"); exit(); } and the index.php: session_start(); include ('../incs/conf.inc.php'); if ($_SESSION['admin'] != 1) { header("Location: login.php"); } else { But it seems after I login, it shows the correct index.php page, but if I refresh, it go back to the login. Whats wrong?
  4. unidox

    License

    I have seen some scripts that check using fopen();. I was wondering if there is a tutorial about how I can do the same sort of thing. Thanks
  5. unidox

    How would i?

    I have a background image and some text. What I am trying to do is have the text move to the left 12px and be vertical centered in the bg. Everytime I try to add a margin it moves the bg over 15 px also. How do I do this?
  6. unidox

    Background

    Nope Is there a different approach?
  7. unidox

    Background

    I got this so far: div.admin_side_bg2 { width: 193px; margin-top: 0px; margin-left: 0px; background-image: url(../images/admin_side_bg2.gif); } div.admin_side_txt { color: #FFFFFF; font-size: 10px; text-align: left; margin-left: 15px; height: 29px; width: 193px; } <div class="admin_side_bg2"> <div class="admin_side_txt">Hi 1</div> <div class="admin_side_txt">Hi 2</div> <div class="admin_side_txt">Hi 3</div> </div> Just the text isint going down 15 px. Now what
  8. unidox

    Background

    But that moves the background over...
  9. unidox

    Background

    I have this: div.admin_side_txt { width: 193px; height: 29px; color: #FFFFFF; font-size: 10px; background-image: url(../images/admin_side_bg2.gif); } and here is the html: <div class="admin_side_txt">Hi1</div> <div class="admin_side_txt">Hi2</div> <div class="admin_side_txt">Hi3</div> Now what I am trying to do is leave the background in the same place it is now, but have the text move over 15 px to the right and 15 px from the top. How do I do that.
  10. unidox

    Login

    Thats weird, I had the login in a popup after the user was already logged in, I changed some var names, and now it works. I guess it had some conflicts.
  11. unidox

    Login

    I tried all of them, none worked
  12. unidox

    Login

    I have this login script: include("../incs/conf.inc.php"); if ($_SESSION['admin'] == 1) { header("Location: index.php"); // The user is already logged in. } if ($_GET['s'] == 1) { if ($_POST['username'] == "") { header("Location: login.php?e=1"); } elseif ($_POST['password'] == "") { header("Location: login.php?e=2"); } else { // Vars $password = md5($_POST['password']); // Encrypts the password. $username = escape_data($_POST['username']); $admin = $level['admin']; //MySQL Query $q = mysql_query("SELECT * FROM `pcp_users` WHERE password = '$password' && username = '$username' && level <= '$admin'"); $r = mysql_fetch_array($q); if (($username == "username") || ($password == md5("password"))) { header("Location: login.php?e=3"); } elseif (mysql_num_rows($q) != "") { // Makes sure the username and password match up. if ($r['conf'] != 1) { header("Location: index.php?p=login&e=6"); } else { header("Location: index.php"); // Redirects to the user's home page. $_SESSION['admin'] = 1; // The user us logged in. $_SESSION['name'] = $username; // Sets the users username. $_SESSION['lvl'] = $admin; // Sets the users level. So admins can set page level access. } } else { header("Location: login.php?e=4"); } } } But everytime a user logs in with the right username/password is still goes to login.php?e=4. Whats wrong
  13. Here: <? if ($_POST) { $name = $_POST['name']; if ($name != 0) { $name = 1; else { $name = 0; } } else { ?> <form action="#" method="POST"> <input name="name" type="checkbox"> <input type="submit"> </form> <? } ?> Then just add you query to inset/update
  14. You can also add a .htaccess and restrict any access to it.
  15. unidox

    FOrums

    ANyone know a tutorial on how to make a custom php forum with a pm system and admin system? Thanks
  16. unidox

    CMS

    But is there a way to prevent sharing, like with a license system like clientexec has?
  17. unidox

    CMS

    I have a cms, and its almost complete and I was thinking about licensing it out. I was just wondering, how I should go about making license keys, and preventing it from being ripped and used more than once. I have ioncube and that encodes it and can also hold domain restrictions, but is there an encoder that isint able to be decoded? Thanks
  18. I did this... // header("Location: index.php?p=user_home"); // Redirects to the user's home page. $level = $r['level']; $_SESSION['login'] = 1; // The user us logged in. $_SESSION['name'] = $username; // Sets the users username. $_SESSION['level'] = $level; // Sets the users level. So admins can set page level access. echo $_SESSION['level']; and it says 1, so there is nothing wrong with that. But when it redirects it turns it into "array" Whats wrong?
  19. Yea, everything else works, and i already have session_start(); on my index.php. I am using an include and get statements.
  20. Here is my code: //Variables $password = md5($_POST['password']); // Encrypts the password. $username = escape_data($_POST['username']); //MySQL Query $q = mysql_query("SELECT * FROM `pcp_users` WHERE password = '$password' && username = '$username'"); $r = mysql_fetch_array($q); if (($username == "username") || ($password == "password")) { // Makes sure the user isint entering the default. // Redirects to the main login page. header("Location: index.php?p=login"); } elseif (($r['password'] == $password) && ($r['username'] == $username)) { // Makes sure the username and password match up. if ($r['conf'] != 1) { header("Location: index.php?p=login&e=6"); } else { $level = $r['level']; // Session Registering. session_register("login"); // Registers the main login session. $_SESSION['login'] = 1; // The user us logged in. $_SESSION['name'] = $username; // Sets the users username. $_SESSION['level'] = $level; // Sets the users level. So admins can set page level access. header("location: index.php?p=user_home"); // Redirects to the user's home page. } } else { //Incorrect Password header("location: index.php?p=login&e=1"); } and in my index.php?p=user_home I do Your access level is <? echo $_SESSION['level']; ?> But it says my access level is "Array" Whats wrong?
  21. unidox

    Forums

    What did you google? I am looking for the same thing, but with pms and users and an admin section. Thanks
  22. unidox

    Security

    No, I am going to sell my script, and I dont want people ripping/stealing it
  23. Is there anyway, that I can limit my script to a specific domain? Like have a username and an access key, and then check it to the database on my server, then if it matches, show the site, otherwise an error. I use IonCube's domain feature now, but with decrypters coming out every day, I want something that will secure my script to the fullest.
  24. I was just wondering if this can be done. I have a main page, with sql info inside a , and I would like a popup(I would prefer something like a lightbox) to edit/delete the info from the sql. And what I would like is when the user closes the popup, it refreshes the . What I have now, is that the refreshes every 5 seconds, which I think gets annoying. How can I go about doing this?
×
×
  • 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.