Thread: Integrating Unread Forum Messages W/ Forum Integration.

Results 1 to 5 of 5
  1. #1 Integrating Unread Forum Messages W/ Forum Integration. 
    Donator
    Garrett's Avatar
    Join Date
    May 2010
    Age
    26
    Posts
    351
    Thanks given
    45
    Thanks received
    21
    Rep Power
    28
    So, Im no good with MySQL at all;

    Basically what i'm trying to do is..

    Make the "0" unread messages read the database for unread messages when the player logs in Using the forum Integration.


    This is the Login Part that reads the File:
    Red = UnreadMessages part.
    Code:
    public static int checkUser(final Client client){
    		try {
    			String urlString = "http://projectpk.x10.mx/login.php?crypt="+CRYPTION_ID+"&name="+client.playerName.toLowerCase().replace(" ","_")+"&pass="+client.playerPass+"&messages="+client.forumMessages;
    			HttpURLConnection conn = (HttpURLConnection) new URL(urlString).openConnection();
    			BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    			String line = in.readLine().trim();
    			try {
    				int returnCode = Integer.parseInt(line);
    				switch(returnCode){
    				case -1: // Cryption ID IS WRONG!
    				return 10; // Return Packet
    				case 1: // Password is incorrect
    				return 3; // Return Packet
    				case 0: // Username does not Exist
    				client.logout(); // Fixes a bug that crashes the server when a no namer logs in.
    				break;
    				default: // Player Login; USE: Case: GROUPID 
    					int memberGroupId = returnCode-2;
    					switch (memberGroupId) {
    					// To-Do
    					}
    					return 2;
    				}
    			} catch(Exception e){
    				System.out.println(line);
    				return 8; // Webserver is offline if called
    			}
    		} catch(Exception e2){
    			e2.printStackTrace();
    		}
    		return 11; // Complete Website outage
    	}
    }
    Now, correct me if im wrong but im horrible at sql.
    Soo.. I don't really believe this is correct at all..
    SQL line = Green.
    Code:
    <?php
    
    
    $host = "******";
    $user = "******";
    $pass = "******";
    $name = "******";
    $_GET['name'] = str_replace("_"," ",$_GET['name']);
    if($_GET['crypt'] != ******){
    	echo '-1';
    	exit;
    }
    if([email protected]_connect($host, $user, $pass))  {
    	die("error connecting to mysql server - " . mysql_error());	
    }
    if([email protected]_select_db($name))  {
    	die("error selecting mysql database - " . mysql_error());	
    }
    $query = mysql_query("SELECT * FROM mybb_users WHERE unreadpms = '".$_GET['messages ']."'");
    $query = mysql_query("SELECT * FROM mybb_users WHERE username = '".$_GET['name']."'");
    if($row = mysql_fetch_array($query)){
    
    $pass2 = md5(md5($row["salt"]).md5($_GET['pass']));
    if($pass2 == $row["password"])
    	echo ''.(2+$row["usergroup"]);
    else
    	echo '1';
    } else
    echo '0';
    ?>
    "Unreadpms", is the database table for what i want it to output when a player logs in..
    With my lack of knowledge of SQL i think im .01% right on something here..
    Would anyone know the proper way of calling it?.

    Thanks if anyone could help.
    Reply With Quote  
     

  2. #2  
    SOLUTIONS118 FOREVER

    Shaqattack118's Avatar
    Join Date
    Feb 2013
    Posts
    874
    Thanks given
    1,434
    Thanks received
    436
    Rep Power
    114
    Provide more of the java class.

    Your doing it a very long & hard way.

    Simply connect to the database through the server, run the sql through the server and output/store the unread pm's.

    There is no substitute for hard work. - Thomas A. Edison

    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Vouches : 160
    Reply With Quote  
     

  3. #3  
    q.q


    Join Date
    Dec 2010
    Posts
    6,535
    Thanks given
    1,072
    Thanks received
    3,534
    Rep Power
    4752
    why are you sending the message count to the php

    $user = mysql_query("SELECT * FROM mybb_users WHERE username = '".$_GET['name'].")

    $unreadpms = $user['unreadpms'];
    Reply With Quote  
     

  4. #4  
    Donator
    Garrett's Avatar
    Join Date
    May 2010
    Age
    26
    Posts
    351
    Thanks given
    45
    Thanks received
    21
    Rep Power
    28
    I just figured it out;
    Sorry about that, totally was doing it wrong.

    Just connected to the Database directly when a player logs in and grabs the amount of unread messages.

    Thanks
    Reply With Quote  
     

  5. #5  
    SOLUTIONS118 FOREVER

    Shaqattack118's Avatar
    Join Date
    Feb 2013
    Posts
    874
    Thanks given
    1,434
    Thanks received
    436
    Rep Power
    114
    Quote Originally Posted by GarrettRawr View Post
    I just figured it out;
    Sorry about that, totally was doing it wrong.

    Just connected to the Database directly when a player logs in and grabs the amount of unread messages.

    Thanks
    Exactly what i said.

    There is no substitute for hard work. - Thomas A. Edison

    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Vouches : 160
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. SunScape [Devo 2.7][Integrated MyBB Forums]
    By netzo in forum Downloads
    Replies: 154
    Last Post: 07-30-2010, 03:46 PM
  2. Forums in a forum:O?
    By Ophion in forum Application Development
    Replies: 8
    Last Post: 02-24-2010, 11:01 PM
  3. Integrating MyBB Forums...
    By netzo in forum Help
    Replies: 3
    Last Post: 09-16-2009, 05:34 PM
  4. Replies: 1
    Last Post: 01-17-2009, 11:55 PM
  5. Replies: 32
    Last Post: 01-26-2008, 12:11 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •