Jump to content
  • Advertisement

b1gjo3

Member
  • Content count

    195
  • Joined

  • Last visited

Community Reputation

213 Neutral

About b1gjo3

  • Rank
    Member
  1. Hello all/gamedev,   I'm having some trouble rendering the yAxis after adding a new data series. I have a function that will allow me to add a data series dynamically to my highchart and for my use case I'll be entering only integer value series names. The categories are sorted in ascending order. $('#addSeries').on('click', function() {         //first check if value is already a series         var seriesid = document.getElementById('txtValue').value;         getSeriesIDIndex(seriesid, function(idindex) {             //if it doesnt exist, add it to chart             if (idindex == -1) {                 categories.push(parseInt(seriesid));                 categories = categories.sort(sortNumber);                 chart.yAxis[0].setCategories(categories, false);                 getCategoryIndex(parseInt(seriesid), function(cindex) {                     chart.addSeries({name: seriesid,  data: [{x: currentDate.getTime(), y: cindex}]}, false);                                          for (i = 0; i < chart.series.length; i++) {                         (function(i) {                             getCategoryIndex(chart.series[i].name, function(cindex) {                                 for (y = 0; y < chart.series[i].data.length; y++) {                                     chart.series[i].data[y].y = cindex;                                     chart.redraw();                                 }                             });                         })(i);                     }                                          chart.redraw();                 });             }         });     }); Only when you add a series that has the highest integer value does the chart display properly again.   To illustrate I've created a jsfiddle (link: http://jsfiddle.net/5L59r1qt/17/). First add a series "10", then add "5". You will see it displayed incorrectly at this point. Then add a series "15" and it will correct itself.   Any thoughts/ideas would be greatly appreciated!
  2. I sent them an email in regards to my question and also just asked for permission to use the api instead of doing all the extra web dev. waiting to hear back now... usually takes them a week to respond.
  3. I would like to write an app that you can scan a barcode and link to Amazon.com's website. The barcode scans in as UPC code and the only way I can link to Amazon is with ASIN. The <b>Associates API</b> has the ability to convert UPC to ASIN but in the Amazon.com Product Advertising API License Agreement:   What if I wrote a website using the Associates API to convert UPC to ASIN and then use my mobile phone to interface with said website to get ASIN from UPC. Would that be any trouble? I don't see why Amazon wouldn't want people to be able to link to their website off of UPC...   Not sure if this is the right place to ask this question. Thanks
  4. ahh I can't believe I didn't think of that. for some reason I thought unsigned char was an invalid type and just didn't even bother trying... it's been a while since I jumped into a C project though. thanks again!
  5.   I tried changing it to %.2x but it still displays the same. Also that wouldn't help me later in my code I don't think when I'm doing assignments like gif->Packed = buffer[10];   Btw my typdef for BYTE is char, not sure if that matters... I do that since char is a byte long and all I need is a byte for each variable in my gif struct.
  6. hey gamedev, I'm trying to read a file 1 byte at a time basically and I'm getting some strange results.   Here is my code int main(int argc, char** argv) {     GifInfo gif;     FILE* gifFile;     long lSize;     BYTE* buffer = 0;     size_t result;     gifFile = fopen("mario.gif", "rb");     if (gifFile == 0) {         printf("Failed to open gif\n");         return 0;     }     //obtain file size     fseek(gifFile, 0, SEEK_END);     lSize = ftell(gifFile);     rewind(gifFile);     //allocate memory to contain the whole file     buffer = (BYTE*) malloc(lSize);     if (buffer == 0) {         printf("Failed to allocate memory\n");         return 0;     }     memset(buffer, 0, lSize);     //copy file to buffer     result = fread(buffer, 1, lSize, gifFile);     if (result != lSize) {         printf("Could not copy file to allocated buffer\n");         return 0;     }     int i = 0;     for (i = 0; i < 20; i++)         printf("Buffer %d: %#x\n", i, buffer[i]);     //do stuff     readGif(buffer, &gif);     if (verifyGif(&gif)) {         printf("Valid GIF!\n");         printGifInfo(&gif);         }     else         printf("Invalid GIF!\n");          //cleanup     fclose(gifFile);     free(buffer);     return 0; }   Here is my output //... Buffer 0: 0x47 Buffer 1: 0x49 Buffer 2: 0x46 Buffer 3: 0x38 Buffer 4: 0x39 Buffer 5: 0x61 Buffer 6: 0x40 Buffer 7: 0x1 Buffer 8: 0x20 Buffer 9: 0x1 Buffer 10: 0xfffffff7 Buffer 11: 0xffffffdc Buffer 12: 0 Buffer 13: 0x4 Buffer 14: 0x4 Buffer 15: 0x4 Buffer 16: 0x4 Buffer 17: 0xffffffac Buffer 18: 0x4 Buffer 19: 0xffffffdc Valid GIF! //...   The problem comes in at buffer 10, 11, 17, 19. I've tryed initializing buffer and filling it with 0s as well but it still gets read like that and it's causing issues with the rest of my code. I'm sure I'm looking over something very simple. I appreciate the help.
  7. b1gjo3

    Gaussian Kernel Help

    Ahh okay. Thank you so much Alvaro, I had no idea (my math background is still coming back to me hehe). I'll try that out and will report back with updated code/results for anyone interested
  8. b1gjo3

    Gaussian Kernel Help

    Hello everyone, I'm trying to write a program that will return a Guassian Kernel for image blur processing and here are the results I'm getting from my function with KernelSize = 5 and Sigma = 1.4 0.012146124201989834    0.026109944200732167    0.033697319240713085    0.026109944200732167    0.012146124201989834     0.026109944200732167    0.056127302407599576    0.07243752084678488    0.056127302407599576    0.026109944200732167     0.033697319240713085    0.07243752084678488    0.0934873796057929    0.07243752084678488    0.033697319240713085     0.026109944200732167    0.056127302407599576    0.07243752084678488    0.056127302407599576    0.026109944200732167     0.012146124201989834    0.026109944200732167    0.033697319240713085    0.026109944200732167    0.012146124201989834     But when I compare results from online it says 0.012841    0.026743    0.03415    0.026743    0.012841 0.026743    0.055697    0.071122    0.055697    0.026743 0.03415    0.071122    0.090818    0.071122    0.03415 0.026743    0.055697    0.071122    0.055697    0.026743 0.012841    0.026743    0.03415    0.026743    0.012841 My formula is correct, here is what I use to calculate kernel     public static double[][] Kernel(int size, double sigma) {         double[][] ret = new double[size][size];                  double gausSum = 0;         double twoPiSigmaSquared = 2 * Math.PI * Math.pow(sigma, 2);         double expression1 = (1 / twoPiSigmaSquared);         double denominator = 2 * Math.pow(sigma, 2);                  for (int x = 0; x < size; x++) {             int gx = Math.abs((size/2) - x);             for (int y = 0; y < size; y++) {                 int gy = Math.abs((size/2) - y);                                  double numerator = Math.pow(gx, 2) + Math.pow(gy, 2);                 double expression2 = Math.pow(Math.E, -1 * (numerator/denominator));                 double gaussian = expression1 * expression2;                                  gausSum += gaussian;                 ret[x][y] = gaussian;             }         }                  double multiplier = (1 / gausSum);                  for (int x = 0; x < size; x++) {             for (int y = 0; y < size; y++) {                 ret[x][y] *= multiplier;             }         }                  return ret;     } Any thoughts would be greatly appreciated. My only guess is that double precission in java is better than the online site im referencing my calculations wtih.
  9. edit: i'm editing my post to better explain my problem.   I have an android application using swipe tabs to navigate between fragments. I have 2 fragments defined in xml file and 1 main activity. Whenever I run my application I'm getting the tabs to show up properly with the correct names "Administration", "Scan", "About"... but the page is blank. When I step through my debugger to check the return value of onCreateView (in my FragmentPagerAdapter code below) it appears to be returning correct value... I can't figure out why I keep getting a blank screen.   Here is my activity_main.xml <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.atd.giftmonster.MainActivity" /> Here is my MainActivity.java public class MainActivity extends ActionBarActivity implements ActionBar.TabListener { ViewPager mViewPager; DFragmentManager mFragmentManager; private static EditText textEmail; private static EditText textPw; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List<String> titles = new ArrayList<String>(); titles.add("administrator"); titles.add("scan"); titles.add("about"); List<Integer> layoutids = new ArrayList<Integer>(); layoutids.add(R.layout.fragment_admin); layoutids.add(R.layout.fragment_scan); layoutids.add(R.layout.fragment_scan); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mFragmentManager = new DFragmentManager(getSupportFragmentManager(), layoutids, titles); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mFragmentManager); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mFragmentManager.getCount(); i++) { actionBar.addTab( actionBar.newTab() .setText(mFragmentManager.getPageTitle(i)) .setTabListener(this)); } } Here is my FragmentPagerAdapter w/ static fragment class public class DFragmentManager extends FragmentPagerAdapter { List<String> mTitle; List<Integer> mLayoutID; List<Fragment> mFragments; FragmentManager mFragmentManager; public DFragmentManager(FragmentManager fm, List<Integer> layoutIDs, List<String> layoutTitles) { super(fm); mFragments = new ArrayList<Fragment>(); mLayoutID = layoutIDs; mFragmentManager = fm; mTitle = layoutTitles; int size = mLayoutID.size(); for (int i = 0; i < size; i++) { mFragments.add(DFragment.newInstance(mLayoutID.get(i))); } } @Override public Fragment getItem(int position) { return mFragments.get(position); } @Override public int getCount() { return mFragments.size(); } @Override public CharSequence getPageTitle(int position) { //return (CharSequence)new String("ss"); //return (CharSequence) mFragments.get(position).getTitle(); return (CharSequence) mTitle.get(position); } public Fragment getFragment(int position) { return mFragments.get(position); } public static class DFragment extends Fragment { private View mView; private static final String ARG_LAYOUT_ID = "layout_id"; public static final DFragment newInstance(int layoutID) { DFragment fragment = new DFragment(); Bundle bundle = new Bundle(); bundle.putInt(ARG_LAYOUT_ID, layoutID); fragment.setArguments(bundle); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup group, Bundle bundle) { int resourceID = getArguments().getInt(ARG_LAYOUT_ID); mView = inflater.inflate(resourceID, group, false); return mView; } public View getView() { return mView; } }
  10. Hello GameDev   I'm having some issues building my dev environment for GTK+ in OSX 10.8. I have followed the instructions from https://wiki.gnome.org/GTK+/OSX/Building but when I get to the part where it says to run command:   jhbuild bootstrap   I get the following error everytime. [ 40%] Built target LIBCURL In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,                  from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:18,                  from /Users/[redacted]/gtk/source/cmake-2.8.9/Utilities/cmlibarchive/libarchive/archive_string.c:65: /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:176:32: error: CarbonCore/Folders.h: No such file or directory make[2]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_string.c.o] Error 1 make[1]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/all] Error 2make: *** [all] Error 2 *** Error during phase build of cmake: ########## Error running make -j 9 *** [3/19]   [1] Rerun phase build   [2] Ignore error and continue to install   [3] Give up on module   [4] Start shell   [5] Reload configuration   [6] Go to phase "wipe directory and start over"   [7] Go to phase "configure"   [8] Go to phase "clean"   [9] Go to phase "distclean" choice: I have the latest version of XCode installed and made sure that my /Developer directory points to XCode.app/Contents/Directory. I have uninstalled MacPorts as suggested from their website. I have been troubleshooting myself the last couple days on/off and have nowhere else to turn to but you guys. I know it's probably a simple fix but I can't wrap my head around it.   Any thoughts/ideas would be greatly appreciated.   Thanks   edit:   It looks as if I've found the problem... but I still don't know how to fix it. It's the same problem this guy was having in this thread: http://stackoverflow.com/questions/5440300/gcc-include-path-and-symlinks/5440502#5440502. It looks like the compiler is able to see and begin processing CarbonCore.h (which is in the same dir as Folders.h). /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:176:32: error: CarbonCore/Folders.h: No such file or directory I tried going in and editing CarbonCore.h line 176 to but this doesn't work either. I have tried to make a symbolic link several different ways but it's not working. Anybody know what I can do to fix this? #include <CarbonCore.framework/Folders.h>
  11. b1gjo3

    php session manager help

    that did the trick. I also had $session->start_session being called multiple times on a single page because I was including 'header.php' on everything. thank you for the help.
  12. b1gjo3

    php session manager help

    thank you for replying. i tried commenting out session_regenerate_id() before and it didn't have any effect. I just tried it again and my session still regenerates on every page load.   i thought for a while I wasn't loading sessions on the appropriate pages correctly $session = new session();   if (!session_id()) { if ($_SERVER["HTTPS"] != "on") $session->start_session('_s', true); else $session->start_session('_s', false); }   but no matter how I seem to change this everything is still not working. uid, username, and login_string are still not being accessed on the next page load. So how do I refer to the old session_id() so I can update it in db?   thanks again!
  13. Hello gamedev   I'm currently trying to implement a secure login script using https, mysql and sesssions. I've been following this guide from here to manage sessions:   http://www.wikihow.com/Create-a-Secure-Session-Managment-System-in-PHP-and-MySQL   My problem is that my session data is not being stored from my login script (in logindb.php). The session_id is changing on every single page load and encrypts the data coming in/out to db and I'm not sure if this is whats causing the data to not carry over to next page load.   I've been debugging for a while now and cannot seem to come to a solution. I think maybe I just don't understand how sessions work. Sorry for the long post, I've included my code below for anyone who wants to help me look over it for any issues.   Much appreciated   ./inc/logindb.php   <?php   require_once('session.class.php'); $session = new session(); $session->start_session('_s', true);   function login($email, $password, $mysqli) { // Using prepared Statements means that SQL injection is not possible.     if ($stmt = $mysqli->prepare("SELECT uid, username, password, salt FROM login_ids WHERE email = ? LIMIT 1")) {     $stmt->bind_param('s', $email); // Bind "$email" to parameter.       $stmt->execute(); // Execute the prepared query.       $stmt->store_result();       $stmt->bind_result($uid, $username, $db_password, $salt); // get variables from result.       $stmt->fetch();              //echo "session: " . session_id() . "<br>";       //echo "uid: " . $uid . "<br>";         //echo "pw: " . $password . "<br>";       //echo "db: " . $db_password . "<br>";       $password = hash('sha512', $password.$salt); // hash the password with the unique salt.       //echo "salt: " . $salt . "<br>";           //echo "pw-salt: " . $password . "<br>";              if($stmt->num_rows == 1) { // If the user exists         // We check if the account is locked from too many login attempts          if(checkbrute($uid, $mysqli) == true) {              // Account is locked             // Send an email to user saying their account is locked             return false;          } else {          if($db_password == $password) { // Check if the password in the database matches the password the user submitted.           // Password is correct!                $user_browser = $_SERVER['HTTP_USER_AGENT']; // Get the user-agent string of the user.                 $uid = preg_replace("/[^0-9]+/", "", $uid); // XSS protection as we might print this value                $_SESSION['uid'] = $uid;                 $_SESSION['username'] = $username;                $_SESSION['login_string'] = hash('sha512', $password.$user_browser);                // Login successful.               return true;              } else {             // Password is not correct             // We record this attempt in the database             $now = time();             $mysqli->query("INSERT INTO login_attempts (uid, time) VALUES ('$uid', '$now')");             return false;          }       }       } else {         // No user exists.          return false;       } } }   function checkbrute($uid, $mysqli) { $valid_attempts = time() - (2 * 60 * 60);   if ($stmt = $mysqli->prepare("SELECT time FROM login_attempts WHERE uid = ? AND time > '$valid_attempts'")) { $stmt->bind_param('i', $uid);   // Execute the prepared query. $stmt->execute(); $stmt->store_result(); // If there has been more than 5 failed logins if($stmt->num_rows > 5) { return true; } else { return false; } } }   function login_check($mysqli) { // Check if all session variables are set if(isset($_SESSION['uid'], $_SESSION['username'], $_SESSION['login_string'])) { $uid = $_SESSION['uid']; $login_string = $_SESSION['login_string']; $user_browser = $_SERVER['HTTP_USER_AGENT']; // Get the user-agent string of the user.   if ($stmt = $mysqli->prepare("SELECT password FROM login_ids WHERE uid = ? LIMIT 1")) { $stmt->bind_param('i', $uid); // Bind "$user_id" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result();   if($stmt->num_rows == 1) { // If the user exists $stmt->bind_result($password); // get variables from result. $stmt->fetch(); $login_check = hash('sha512', $password.$user_browser); if($login_check == $login_string) { // Logged In!!!! return true; } else { // Not logged in return false; } } else { // Not logged in return false; } } else { // Not logged in return false; } } else { // Not logged in return false; } } ?>  ./inc/session.class.php // file - session.class.php <?php    class session {   function start_session($session_name, $secure) { // Make sure the session cookie is not accessable via javascript. $httponly = true;     // Hash algorithm to use for the sessionid. (use hash_algos() to get a list of available hashes.)   $session_hash = 'sha512';     // Check if hash is available   if (in_array($session_hash, hash_algos())) {     // Set the has function.       ini_set('session.hash_function', $session_hash);   }   // How many bits per character of the hash.   // The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ",").   ini_set('session.hash_bits_per_character', 5);     // Force the session to only use cookies, not URL variables.   ini_set('session.use_only_cookies', 1);     // Get session cookie parameters    $cookieParams = session_get_cookie_params();    // Set the parameters   session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly);    // Change the session name    session_name($session_name);   // Now we cat start the session   session_start();   // This line regenerates the session and delete the old one.    // It also generates a new encryption key in the database.    session_regenerate_id(true);     }   function __construct($secure = false) {   // set our custom session functions. session_set_save_handler(array($this, 'open'),  array($this, 'close'), array($this, 'read'),  array($this, 'write'), array($this, 'destroy'),  array($this, 'gc'));   // This line prevents unexpected effects // when using objects as save handlers. register_shutdown_function('session_write_close'); }   function open() { $host = 'localhost'; $user = 'sec_user'; $pass = 'f3HZqVGADvYsnvjA'; $name = 'secure_sessions'; $session_mysqli = new mysqli($host, $user, $pass, $name); $this->db = $session_mysqli; return true; }   function close() { $this->db->close(); return true; }   // prepare statement (read_stmt) to be executed on db // param: $id - session id stored in db function read($id) { if(!isset($this->read_stmt)) { $this->read_stmt = $this->db->prepare("SELECT data FROM sessions WHERE id = ? LIMIT 1"); } $this->read_stmt->bind_param('s', $id); $this->read_stmt->execute(); $this->read_stmt->store_result(); $this->read_stmt->bind_result($data); $this->read_stmt->fetch(); $key = $this->getkey($id); echo "read: \"" . $data . "\"<br>decrypted: "; $data = $this->decrypt($data, $key); echo $data . "<br>"; return $data; }   // prepare statement (w_stmt) to be executed on db function write($id, $data) { if ($data == null) return false;   // Get unique key $key = $this->getkey($id); // Encrypt the data echo "write: " . $data . "<br>crypted: "; $data = $this->encrypt($data, $key); echo $data . "<br>";   $time = time(); if(!isset($this->w_stmt)) { $this->w_stmt = $this->db->prepare("REPLACE INTO sessions (id, set_time, data, session_key) VALUES (?, ?, ?, ?)"); }   $this->w_stmt->bind_param('siss', $id, $time, $data, $key); $this->w_stmt->execute(); return true; }   // delete session function destroy($id) { if(!isset($this->delete_stmt)) { $this->delete_stmt = $this->db->prepare("DELETE FROM sessions WHERE id = ?"); } $this->delete_stmt->bind_param('s', $id); $this->delete_stmt->execute(); return true; }   //garbage collector function gc($max) { if(!isset($this->gc_stmt)) { $this->gc_stmt = $this->db->prepare("DELETE FROM sessions WHERE set_time < ?"); } $old = time() - $max; $this->gc_stmt->bind_param('s', $old); $this->gc_stmt->execute(); return true; }   //get key from db //creates key if no key avail private function getkey($id) { if(!isset($this->key_stmt)) { $this->key_stmt = $this->db->prepare("SELECT session_key FROM sessions WHERE id = ? LIMIT 1"); } $this->key_stmt->bind_param('s', $id); $this->key_stmt->execute(); $this->key_stmt->store_result();   //check to see if result ret any rows if($this->key_stmt->num_rows == 1) { $this->key_stmt->bind_result($key); $this->key_stmt->fetch(); return $key; } else { $random_key = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); return $random_key; } }   public function __isset($var){ return isset($_SESSION[$var]); }   private function encrypt($data, $key) { $salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; $key = substr(hash('sha256', $salt.$key.$salt), 0, 32); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_ECB, $iv)); return $encrypted; }   private function decrypt($data, $key) { $salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; $key = substr(hash('sha256', $salt.$key.$salt), 0, 32); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($data), MCRYPT_MODE_ECB, $iv); return $decrypted; } } ?> ./inc/header.php   <?php  //file - header.php include 'db_connect.php'; include 'logindb.php';   require_once('session.class.php'); $session = new session();   if (!session_id()) { if ($_SERVER["HTTPS"] != "on") $session->start_session('_s', true); else $session->start_session('_s', false); } $_SESSION['something'] = 'a value'; echo session_id() . " : "; print_r($_SESSION); ?>   <html>   <head> <title>PHP Login Example</title> <style> <?php  include './css/header.css';  include './css/signin.css'; ?> </style> </head>   <body> <div id="header">   <img src="./img/php_login.jpg" />   <div id="login-bar">   <?php  echo "sid: " . session_id() . "<br>";   if (!login_check($mysqli))  echo 'not logged in '; else echo 'logged in'; ?>   <ul> <li><a href=" <?php echo "https://" . $_SERVER["SERVER_NAME"] . "/php_login/login.php" ?>">SIGN IN</a></li> <li> | </li> <li><a href="#">REGISTER</a></li> </ul> </div> </div>  ./inc/process_login.php <?php include 'logindb.php'; include 'db_connect.php';   if (!session_id()) session_start();   if(isset($_POST['email'], $_POST['password'])) {  $email = $_POST['email'];    $password = $_POST['password']; //not hashed due to ssl        if(login($email, $password, $mysqli) == true) {     // Login success       //echo 'Success: You have been logged in!';           header('Location: ../index.php');    } else {     // Login failed       header('Location: ../login.php?error=1');    } } else {     // The correct POST variables were not sent to this page.    echo 'Invalid Request'; } ?> ./login.php <?php  include './inc/header.php'; ?> <div id="sign-in"> <?php  //check to see if logged in   if(isset($_GET['error'])) {    echo 'Error Logging In!'; } ?>   <form action="./inc/process_login.php" method="post" class="pw" name="login_form"> email: <input name="email" type="text"> pw: <input type="password" name="password"> <input type="submit" value="Submit"> </form>  </div>   </body> </html>
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!