Jump to content

ShoeLace1291

Members
  • Posts

    401
  • Joined

  • Last visited

Posts posted by ShoeLace1291

  1. I'm trying to get a horizontal list for a navigation bar, but I can't achieve this without adding float: left; to my li class.  The problem is that it automatically aligns the actual list to the left side of the page but I want it to be centered.  Any way to fix this problem?

     

    .toplinks { background: url(imgs/topmenu_bg.png);
    	  	height: 30px;
                text-align: center;
    
    }
    
    .toplinks ul { list-style: none;
    	  	   display: inline;
                   align: center;
    
    }
    
    .toplinks li { float: left;
                   height: 30px;
                   width: 100px;
    
    }
    
    .toplinks ul li a { background: url(imgs/button_bg.png);
                        display: block;
    	  	 	  	height: 30px;
    			  	width: 100px;
    			  	text-align: center;
    			  	color: #FFFFFF;
    				text-decoration: none;
    			  
    }

  2. I'm trying to create a file with XML in it which contains user login info.  In my script, a line is inserted that will be one type of user information, for example, <loginname>$username</loginname>.  When the script runs, it actually inserts the characters $username.  How do I make it so it enters in what $username equals, which is $_POST['username'] ?

     

    $userinfobody = '<?xml version="1.0"?>\n\<loginname>\"$username\"</loginname>\n\<loginpass>\"$password\"</loginpass>\n\<contactemail>\"$email\"</contactemail>\n\<regdate>\"$todaysdate\"</regdate>';

     

    I am also getting a syntax error now at 1.0.

  3. This if statement sees if the string contains certain characters with ereg.  I'm getting an error that says:

     

    Warning: ereg() [function.ereg]: REG_EMPTY in /home/unholy/public_html/webtop/register.php on line 44

     

    This is my code:

     

    if(ereg('\/?.><$%^&*()!@;:"-+=|',$directory)){
    

  4. Is there any way to display the filename without the name of the directory in front of it?  so instead of forums/index.php would display as just index.php.  Also, what arguement would I use for the first one if I only want to get the name of a directory? 

     

    glob('here', GLOB_ONLYDIR);

  5. I have a page that gets all the php files in a certain folder and displays them.  It's a foreach loop, but for some reason I'm getting an infinite loop.  This is my code:

     

    <?php
    
    echo "<table align='center' cellspacing='2' cellpadding='2' border='0'>
    <tr>";
    
    $rows = 0;
    
    foreach(glob('forums/*.php') as $szFilename){
    
    $rows = $rows + 1;
    
    
    
    	echo "<td style='text-align: center;'><img src='images/icon_phpfile.png' alt='PHP File'><br>$szFilename</td>";
    
    	if($rows == {
    
    	 echo "</tr><tr>";
    
    }
    
    }
    
    echo "</tr></table>";
    
    ?>

  6. Idk, maybe my logic is incorrect...

     

    <?php
    
    //Connect to My Gaming Ladder database
    include('config/config.php');
    
    if($_POST['convert']){
    $query = mysql_query("SELECT * FROM users") or die("Error: ".mysql_error());
    
    //How many MGL users are there?
    $numusers = mysql_num_rows($query);
    
    $addedusers = 0;
    
    include('community/Settings.php');
    $hdlComDataBase = mysql_connect($db_server, $db_user, $db_passwd,true) or die("Could not connect to SMF database server: ".mysql_error());
    mysql_select_db($db_name,$hdlComDataBase) or die("Could not select SMF database: ".mysql_error());
    
    if($numusers == 0){
    
    		 "There are no users registered on My Gaming Ladder.";
    
    } else {
    
    while($fetch=mysql_fetch_array($query, MYSQL_ASSOC)){
    
    	$id=$fetch["id"];
    	$alias=$fetch["alias"];
    	$pass=sha1($fetch["pass"]);
    	$email=$fetch["email"];
    	$icq=$fetch["icq"];
    	$aim=$fetch["$aim"];
    	$msn=$fetch["msn"];
    	$yahoo=$fetch["yahoo"];
    	$website=$fetch["website"];
    	$ipaddress=$fetch["ipaddress"];
    
    	echo "Converting MGL member <b>$alias</b> to SMF... <br>";
    
    //Connect to SMF database
    
    	$query2 = mysql_query("SELECT * FROM smf_members WHERE emailAddress = '$email'", $hdlComDataBase) or die("Could not search users: ".mysql_error());
    	$exists = mysql_num_rows($query2);
    
                                   //If the selected user doesn't exist in the SMF forum database...
    			if($exists==0){
    
    					  $query3 = "INSERT INTO smf_members (memberName,passwd,emailAddress,websiteUrl,ICQ,AIM,YIM,MSN,memberIP)
    					  		   		   values ('$alias', '$pass', '$email', '$website', '$icq', '$aim', '$yahoo', '$msn', '$ipaddress')";
    
                                                           //If the query is successfull
    						if(mysql_query($query3,$hdlComDataBase)){
    
    									echo "Added MGL member <b>$alias</b> to the SMF forum database.<br>";
    									$addedusers = $addedusers + 1;
    						//Otherwise...			
    						} else {
    
    						  	   		echo "There was an error adding the MGL member <b>$alias</b> to the SMF forum database.<br>";
    
    						}
    
    			} else {
    
    			  	   	echo "The MGL member <b>$alias</b> was not added because he/she is already a member of the SMF forum.<br>";
    
    			}
    
    	}
    
    }
    	echo "Database conversion complete.  A total of $addedusers My Gaming Ladder users have been successfuly added to SMF.";
    
    } else {
    
      	   echo "<form action='".$_SERVER['PHP_SELF']." method='POST'><input type='submit' value='Convert' name='convert'></form>";
       
    }
    
    ?>

  7. For a while now, I've had a main site(gaming ladders) and a forum.  They're on two seperate databases so users would have to register twice to access them.  I made a script that loops through database records from the ladders and determines if the ladder user is registered on the forums.  If the user is registered on the forums, an account isn't created.  If the user is not registered on the forums, an account is created.  Now, before I ran the script, the total of the ladders users was 3,717.  The total forums users was 1,762.  After I ran the script, the total number of forums users is 5,047.  I also made a script that calculates the number of forums users that aren't registered on the ladders and the result was 0.  So it's obvious that 1,995 of the ladders users weren't registered on the forums since 3,717 - 1,762 = 1,995.  So that means 1,995 forum accounts would have to be created so everyone that didn't register on both the ladders and the forums could use both.  Shouldn't the total number of forums users be 3,717 if my logic is correct?

  8. I've had a website/forum for a couple years now, but we were never able to figure out how to integrate our two softwares(My Gaming Ladder and SMF).  So I figured I would make a script that goes through and selects users from My Gaming Ladder since there are more users registered there and insert them into the SMF database.  My problem is that when I run the script, nothing happens, it just keeps loading and I don't know why.  This is my code:

     

    <?php
    
    //Connect to My Gaming Ladder database
    include('config/config.php');
    
    $query = mysql_query("SELECT * FROM users") or die("Error: ".mysql_error());
    
    //How many MGL users are there?
    $numusers = mysql_num_rows($query);
    
    if($numusers == 0){
    
    		 "There are no users registered on My Gaming Ladder.";
    
    } else {
    
    while($fetch=mysql_fetch_array($query)){
    
    	$id=$fetch["id"];
    	$alias=$fetch["alias"];
    	$pass=$fetch["pass"];
    	$email=$fetch["email"];
    	$icq=$fetch["icq"];
    	$aim=$fetch["$aim"];
    	$msn=$fetch["msn"];
    	$yahoo=$fetch["yahoo"];
    	$website=$fetch["website"];
    	$ipaddress=$fetch["ipaddress"];
    
    	echo "Converting MGL member <b>$alias</b> to SMF... ";
    
    //Connect to SMF database
    	include('community/Settings.php');
    			mysql_connect($db_server, $db_user, $db_passwd) or die("Could not connect to SMF database server: ".mysql_error());
    					mysql_select_db($db_name) or die("Could not select SMF database: ".mysql_error());
    
    	$query2 = mysql_query("SELECT * FROM smf_members WHERE memberName = '$alias'") or die("Could not search users: ".mysql_error());
    	$exists = mysql_num_rows($query2);
    
                                   //If the selected user doesn't exist in the SMF forum database...
    			if($exists != 1){
    
    					  $query3 = "INSERT INTO smf_members (memberName,passwd,emailAddress,websiteUrl,ICQ,AIM,YIM,MSN,memberIP)
    					  		   		   values('$alias', '$pass', '$email', '$website', '$icq', '$aim', '$yahoo', '$msn', '$ipaddress')";
    
                                                           //If the query is successfull
    						if(mysql_query($query3)){
    
    									echo "Added MGL member <b>$alias</b> to the SMF forum database.";
    						//Otherwise...			
    						} else {
    
    						  	   		echo "There was an error adding the MGL member <b>$alias</b> to the SMF forum database.";
    
    						}
    
    			} else {
    
    			  	   	echo "The MGL member <b>$alias</b> was not added because he/she is already a member of the SMF forum.";
    
    			}
    
    //Connect to MGL database for next loop
    		include('config/config.php');
    
    	}
    
    }
    
    ?>
    

  9. That is my code... but to make it simpler, say this were my code:

    $query = mysql_query("SELECT * FROM smf_topics ORDER BY ID_TOPIC DESC LIMIT 10") or die("Error: ".mysql_error());
    
    while($fetch=mysql_fetch_array($query)){
    
         $topicid=$fetch["ID_TOPIC"];
         $topicname=$fetch["topicName"];
    
         echo "$topicname<br>";
    
    }

     

    Say the last two topics were called "hello, I am new here" and "what the hell is going on".  instead of displaying as

     

    hello, I am new here

    what the hell is going on

     

    how would i make substr display it as

     

    hello, i am new ...

    what the the he...

  10. It's kind a long... I'm modifiying the SMF SSI.

     

    function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = 'echo')
    {
    
    ob_start();
    global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER;
    global $user_info, $modSettings, $func;
    
    if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
    	$exclude_boards = array($modSettings['recycle_board']);
    else
    	$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;
    
    $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
    $icon_sources = array();
    foreach ($stable_icons as $icon)
    	$icon_sources[$icon] = 'images_url';
    
    // Find all the posts in distinct topics.  Newer ones will have higher IDs.
    $request = db_query("
    	SELECT
    		m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
    		IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
    		IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
    		IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
    	FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
    		LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
    		LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
    		LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
    	WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
    		AND t.ID_LAST_MSG = m.ID_MSG
    		AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
    		AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
    		AND $user_info[query_see_board]
    		AND ms.ID_MSG = t.ID_FIRST_MSG
    	ORDER BY t.ID_LAST_MSG DESC
    	LIMIT $num_recent", __FILE__, __LINE__);
    $posts = array();
    while ($row = mysql_fetch_assoc($request))
    {
    	$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '&#10;')));
    	if ($func['strlen']($row['body']) > 128)
    		$row['body'] = $func['substr']($row['body'], 0, 128) . '...';
    
    	// Censor the subject.
    	censorText($row['subject']);
    	censorText($row['body']);
    
    	if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
    		$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';
    
    	// Build the array.
    	$posts[] = array(
    		'board' => array(
    			'id' => $row['ID_BOARD'],
    			'name' => $row['bName'],
    			'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
    			'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
    		),
    		'topic' => $row['ID_TOPIC'],
    		'poster' => array(
    			'id' => $row['ID_MEMBER'],
    			'name' => $row['posterName'],
    			'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
    			'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
    		),
    		'subject' => $row['subject'],
    		'short_subject' => shorten_subject($row['subject'], 25),
    		'preview' => $row['body'],
    		'time' => timeformat($row['posterTime']),
    		'timestamp' => forum_time(true, $row['posterTime']),
    		'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
    		'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>',
    		'new' => !empty($row['isRead']),
    		'new_from' => $row['new_from'],
    		'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
    	);
    }
    mysql_free_result($request);
    
    // Just return it.
    if ($output_method != 'echo' || empty($posts))
    	return $posts;
    
    foreach ($posts as $post)
    $postsubject = $post['subject'];
    $postsubject = substr($postsubject, 0, -10);
    	echo '
    
    				&#187 <a href="', $post['href'], '">$postsubject</a>
    				', $txt[525], ' ', $post['poster']['link'], '
    				', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br>
    			';
    	$ret=ob_get_contents();
    	ob_end_clean();
    	return $ret;
    }

  11. I have a script that pulls latest forum posts with a mysql query.  When I display the list, how do I limit the name of the topics and follow them with "..." if they are too long?  For example, the two latest posts are Hello, everyone, I am new here.  That's sixteen characters.  How would I make that display as say "Hello, Everyone, I am..."

     

    Thanks for any help.

  12. I have a script that retrieves a database record that's created by a user.  In that database record are bbcodes like [p].  My problem is that the records are for tutorials, so I need it to display the HTML as raw text, therefore I have to use htmlentities and even though I use str_replace to replace the bb tags, it still displays the <p> tags(previously [p]) as html.  I need the <p> tags to be translated into html so my layout works correctly.  Is there anyway to do this?

     

    $tutContent=$fetch["tutorialContent"];

    $bbcode = array('[p]', '[/p]', '[example]', '[/example]');

    $replacewith = array('<p>', '</p>', "<div id='example'>", '</div>');

     

    $tutContent = htmlentities(str_replace($bbcode,$replacewith,$tutContent));

  13. I just set up my first official web development site.  I have set up other sites with free services such as invisionfree and other free forum hosts, but this I am actually putting alot more time into.  Right now I just have a forum set up but I am currently working on completing the main site.  This is also my first web dev site to use a real domain, not just a subdomain, etc.  I'm hoping this site will do better than my previous ones.  I am also looking for some template designers to make some templates for us(designers will recieve 40% of the profits).  I actually just finished setting up the forums about 30 minutes ago incase the site looks inactive.  You can join if you want(would be preferred ;D).  Thanks for any critique.

     

    http://www.unholydesigns.com

  14. Hello, I have just launched my website Unholy Designs.com.  I am currently looking for experiene template designers, php and javascript coders, etc.  If you would like to design free templates(we won't charge for them), that would be wonderful.  We also offer premium templates and you would recieve 40% of the profits.  We also offer free PHP and JavaScript codes.  If you are interested in any of this, please email me at admin@unholydesigns.com.  You can also add me on MSN at unholyprayer@stormgaming.net.

     

    http://www.unholydesigns.com

     

    Note:  we only currently have forums, I will be finishing the main site within the next couple of days.

     

    Thanks,

    Unholy Prayer(Hybrid Kill3r), owner of Unholy Designs.com

  15. You could get the user's IP and insert that into whatever table you have for your users and at the beginning of your register script just query the ip found on that page and if the script finds one or more rows with that IP then don't display the register script.

  16. I have written a page for my website that displays tutorials.  The user uses bb code such as [example] and such so there is no html needed to write it.  On the page that displays the tutorials, I have to use htmlentities so that if a user attempts to insert html into the tutorial, it just displays raw text.  The only problem is that it also displays the bbcode as raw text since i use str_replace to replace the bbcode with the html tags.  Is there a way to use htmlentities only with html that wasn't a bbcode?

  17. I want to use it so I don't have to type out the table fields everytime I want to select something from it.  So I figure that it would be easier to use a function to list them.  Then I would only have to use SELECT $tablefields FROM news to select information from a news table.

×
×
  • 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.