Jump to content

cohan1279

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cohan1279's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $remamount = ($amount % 12); thanks, im a tard lol
  2. Hi , I feel kinda dumb for asking this, but im lost. I just need to get the remaider for div. example --  $divamount = floor($amount / 12); --- if $amount = 16 , is there a function i can use to get the remaining 4?  $remamount = ? ($amount / 12); ??? Ive looked thruogh a list of php functions over and over but havent seen anything. What im tring to do is split up a givin # in to 12 database table rows but i want to be able to put the remainder in the 12th one as well. [code]if ($type == 't_armtrp')   {     $divamount = floor($amount / 12);   if ($amount > 12)      {         $users[$type] += $amount;  $users[armtrain1] += $divamount; $users[armtrain2] += $divamount; $users[armtrain3] += $divamount; $users[armtrain4] += $divamount; $users[armtrain5] += $divamount; $users[armtrain6] += $divamount; $users[armtrain7] += $divamount; $users[armtrain8] += $divamount; $users[armtrain9] += $divamount; $users[armtrain10] += $divamount; $users[armtrain11] += $divamount; $users[armtrain12] += ($divamount + $remamount); $canbuy[$type] -= $amount; print commas($amount)." $uera[$type] have been sent to training for $".commas($cost).".<br>\n";     }[/code] please help........
  3. nevermind....... i got it just need to add <img src= to ':)' => 'image/smiley-smile.png', so that its ':)' => '<img src=image/smiley-smile.png', all working now javascript:void(0); Grin
  4. ok im gone a dif. route.... now with this [code]$threadlst = mysql_query("select * from $forumdb where forumid=$forumid and (parentid=$read OR msgid=$read);"); while ($threadlist = mysql_fetch_array($threadlst)) { $messagetext = eregi_replace("<","&lt;",$threadlist[message]); $messagetext = eregi_replace("\n","<br>",$messagetext); $messagetext = eregi_replace("\cM","<br>",$messagetext); $smilies = array( // code => image             ':)' => 'image/smiley-smile.png',             ':-)'  =>    "image/smiley-smile.png"      ,                     ':('    =>    "image/smiley-sad.png"        ,                     ':-('  =>    "image/smiley-sad.png"                            );     $codes = array_keys($smilies);     $messagetext = str_replace($codes,$smilies,$messagetext);     $msgstamp = date("D, F j, Y g:i:s a",$threadlist[timestamp]); $clantg = ""; if ($threadlist[clantag] > 0) { $clantga = mysql_fetch_array(mysql_query("select tag from $clandb where num=$threadlist[clantag];")); $clantg = " - $clantga[tag]"; } if ($threadlist[adminflag] == "2") { $clantg = " - <font class=\"cbad\">Administrator</font>"; } if (($forumlista[clanonly] == 1) && ($postok[$forumid] >= 2)) { $deleteok = " - <a href=$config[main]?action=testpage&forumid=$forumid&do_delete=1&post=$threadlist[msgid]>Delete</a>"; } if ($postok[$forumid] == 3) { $deleteok = " - <a href=$config[main]?action=testpage&forumid=$forumid&do_delete=1&post=$threadlist[msgid]>Delete</a>"; } print "<tr><td width=25%><b><i>$threadlist[subject]</b>$deleteok</i></td><td>$threadlist[postername] (#$threadlist[posternum])$clantg</td><td><b>Posted at:</b> $msgstamp</td></tr>\n"; print "<tr><td bgcolor=#993300 colspan=3>&nbsp;</td></tr>\n"; print "<tr><td colspan=3>$messagetext</td></tr>\n"; print "<tr><td colspan=3>&nbsp;</td></tr>\n";[/code] if i try to do a smile ": )" it prints this "image/smiley-smile.png" im geting closer , but i want to see the pic. ???? any help now?
  5. hi i cant seem to get smillies to print. heres the code , any ideas? function - [code]function smilies($messagetext){ $path="image"; //Specify the direcory in which images are stored $sql = "SELECT smilie, image FROM smilies"; //Select the smilies from the database //along with the names of the image files to //replace them $rs = mysql_query($sql); //Run the query while($row = mysql_fetch_array($rs)) { //Loop through the results creating two arrays $smilies[] = $row['smilie']; //Create array of smilie texts $images[] = "<img src='" . $path . "/" . $row['image'] . "'>"; //create array of image replacments with the html in it. } $messagetext=str_replace($smilies, $images, $messagetext);//Replace the smilies with the images. return $messagetext; }[/code] and this gets/prints message- [code]$threadlst = mysql_query("select * from $forumdb where forumid=$forumid and (parentid=$read OR msgid=$read);"); while ($threadlist = mysql_fetch_array($threadlst)) { $messagetext = eregi_replace("<","&lt;",$threadlist[message]); $messagetext = eregi_replace("\n","<br>",$messagetext); $messagetext = eregi_replace("\cM","<br>",$messagetext); $msgstamp = date("D, F j, Y g:i:s a",$threadlist[timestamp]); smilies($messagetext); $clantg = ""; if ($threadlist[clantag] > 0) { $clantga = mysql_fetch_array(mysql_query("select tag from $clandb where num=$threadlist[clantag];")); $clantg = " - $clantga[tag]"; } if ($threadlist[adminflag] == "2") { $clantg = " - <font class=\"cbad\">Administrator</font>"; } if (($forumlista[clanonly] == 1) && ($postok[$forumid] >= 2)) { $deleteok = " - <a href=$config[main]?action=testpage&forumid=$forumid&do_delete=1&post=$threadlist[msgid]>Delete</a>"; } if ($postok[$forumid] == 3) { $deleteok = " - <a href=$config[main]?action=testpage&forumid=$forumid&do_delete=1&post=$threadlist[msgid]>Delete</a>"; } print "<tr><td width=25%><b><i>$threadlist[subject]</b>$deleteok</i></td><td>$threadlist[postername] (#$threadlist[posternum])$clantg</td><td><b>Posted at:</b> $msgstamp</td></tr>\n"; print "<tr><td bgcolor=#993300 colspan=3>&nbsp;</td></tr>\n"; print "<tr><td colspan=3>$messagetext</td></tr>\n"; print "<tr><td colspan=3>&nbsp;</td></tr>\n"; }[/code] Im not geting any errors its just not printing the smllie pic. am i calling the function right? sorry im still pretty new at this.. the database table is there and has the right info. in it .... im pretty sure its not the problem.
  6. ;D thanks alot shoz! i think i should have my eyes checked after that one! All's well now  ;D
  7. its the table in my database called forumname ... [code]$forumnamedb = 'forumname'; // forumname table name[/code]
  8. [code]CREATE TABLE forumname (   forumid bigint(20) default NULL,   name blob,   adminonly int(11) default NULL,   clanonly int(11) default NULL ) TYPE=MyISAM;[/code]
  9. [code]$forumlst = mysql_query("select * from $forumnamedb;"); $result = mysql_query($query) or die(mysql_error());         $data = mysql_fetch_array($result);         while ($forumlist = mysql_fetch_array($forumlst)) { $adminonly = ""; $clanonly = "";[/code] that should be geting this [code]INSERT INTO forumname VALUES (1,'Announcements',1,0); INSERT INTO forumname VALUES (2,'Clan Messages',0,1); INSERT INTO forumname VALUES (3,'General Chatter',0,0); INSERT INTO forumname VALUES (4,'Bugs/Suggestions',0,0);[/code] and printing it ...it is not , just says query was empty,
  10. sorry for the long code but i really have no idea where the problem is.... maybe here... [code]<? $forumlst = mysql_query("select * from $forumnamedb;"); $result = mysql_query($query) or die(mysql_error());         $data = mysql_fetch_array($result);         while ($forumlist = mysql_fetch_array($forumlst)) { $adminonly = ""; $clanonly = ""; if ($forumlist[adminonly] == 1) { $adminonly = " - Read only access"; $postok = array($forumlist[forumid] => 0); } if ($forumlist[clanonly] == 1) { $clanonly = " - Clan read/write access"; $postok = array($forumlist[forumid] => 1); } if (($users[clan] == 0) && ($forumlist[clanonly] == 1)) { $clanonly = " - NO access (create or join a clan)"; $postok = array($forumlist[forumid] => 0); } if ((($users[num] == $clan[founder]) || ($users[num] == $clan[asst]) || ($users[num] == $clan[fa1]) || ($users[num] == $clan[fa2])) && ($forumlist[clanonly] == 1)) { $adminonly = " - Clan Administrator Access"; $clanonly = ""; $postok = array($forumlist[forumid] => 2); } if ($users[disabled] == 2) { $adminonly = " - Administrator Access"; $clanonly = ""; $postok = array($forumlist[forumid] => 3); } print "<tr><th><a href=$config[main]?action=forums&forumid=$forumlist[forumid]>$forumlist[name]</a>$adminonly$clanonly</th></tr>\n"; } ?> </table> <? if ($forumid != 0) { $forumlista = mysql_fetch_array(mysql_query("select * from $forumnamedb where forumid=$forumid;")); if ($forumlista[adminonly] == 1) { $postok = array($forumlista[forumid] => 0); } if ($forumlista[clanonly] == 1) { $postok = array($forumlista[forumid] => 1); } if (($users[clan] == 0) && ($forumlist[clanonly] = 1)) { $postok = array($forumlista[forumid] => 0); } if ((($users[num] == $clan[founder]) || ($users[num] == $clan[asst]) || ($users[num] == $clan[fa1]) || ($users[num] == $clan[fa2])) && ($forumlist[clanonly] = 1)) { $postok = array($forumlista[forumid] => 2); } if (($forumlista[adminonly] != 1) && ($forumlista[clanonly] != 1)) { $postok = array($forumlista[forumid] => 1); } if ($users[disabled] == 2) { $postok = array($forumlista[forumid] => 3); } ?>[/code]
  11. hello im trying to get a query but it comes back as empty when it is not?? can someone please help? [code]### ### Table structure for table 'forumname' ### CREATE TABLE forumname (   forumid bigint(20) default NULL,   name blob,   adminonly int(11) default NULL,   clanonly int(11) default NULL ) TYPE=MyISAM; ### ### Dumping data for table 'forumname' ### INSERT INTO forumname VALUES (1,'Announcements',1,0); INSERT INTO forumname VALUES (2,'Clan Messages',0,1); INSERT INTO forumname VALUES (3,'General Chatter',0,0); INSERT INTO forumname VALUES (4,'Bugs/Suggestions',0,0); ### ### Table structure for table 'forum' ### CREATE TABLE forum (   msgid bigint(20) NOT NULL auto_increment,   posternum bigint(20) default NULL,   message blob,   parentid bigint(20) default NULL,   forumid bigint(20) default NULL,   subject blob,   timestamp bigint(20) default NULL,   postername blob,   clantag blob,   adminflag int(11) default NULL,   lastpost bigint(20) default NULL,   PRIMARY KEY  (msgid) ) TYPE=MyISAM;[/code] thats the tables and here is the php script.. [code]if ($users[clan] != "") { $clan = loadClan($users[clan]); } ?> Welcome to the <?=$config[servname]?> internal forum, <?=$users[empire]?>!<br> <table border=1 align=center width=100% class="scores"> <tr><th>Forum Name (Click name to go to forum)</th></tr> <? $forumlst = mysql_query("select * from $forumnamedb;"); $result = mysql_query($query) or die(mysql_error());         $data = mysql_fetch_array($result);         while ($forumlist = mysql_fetch_array($forumlst)) { $adminonly = ""; $clanonly = ""; if ($forumlist[adminonly] == 1) { $adminonly = " - Read only access"; $postok = array($forumlist[forumid] => 0); } if ($forumlist[clanonly] == 1) { $clanonly = " - Clan read/write access"; $postok = array($forumlist[forumid] => 1); } if (($users[clan] == 0) && ($forumlist[clanonly] == 1)) { $clanonly = " - NO access (create or join a clan)"; $postok = array($forumlist[forumid] => 0); } if ((($users[num] == $clan[founder]) || ($users[num] == $clan[asst]) || ($users[num] == $clan[fa1]) || ($users[num] == $clan[fa2])) && ($forumlist[clanonly] == 1)) { $adminonly = " - Clan Administrator Access"; $clanonly = ""; $postok = array($forumlist[forumid] => 2); } if ($users[disabled] == 2) { $adminonly = " - Administrator Access"; $clanonly = ""; $postok = array($forumlist[forumid] => 3); } print "<tr><th><a href=$config[main]?action=forums&forumid=$forumlist[forumid]>$forumlist[name]</a>$adminonly$clanonly</th></tr>\n"; } ?> </table> <? if ($forumid != 0) { $forumlista = mysql_fetch_array(mysql_query("select * from $forumnamedb where forumid=$forumid;")); if ($forumlista[adminonly] == 1) { $postok = array($forumlista[forumid] => 0); } if ($forumlista[clanonly] == 1) { $postok = array($forumlista[forumid] => 1); } if (($users[clan] == 0) && ($forumlist[clanonly] = 1)) { $postok = array($forumlista[forumid] => 0); } if ((($users[num] == $clan[founder]) || ($users[num] == $clan[asst]) || ($users[num] == $clan[fa1]) || ($users[num] == $clan[fa2])) && ($forumlist[clanonly] = 1)) { $postok = array($forumlista[forumid] => 2); } if (($forumlista[adminonly] != 1) && ($forumlista[clanonly] != 1)) { $postok = array($forumlista[forumid] => 1); } if ($users[disabled] == 2) { $postok = array($forumlista[forumid] => 3); } ?> <hr width=50% size=3 color=#360000> <? if ($do_newmessage != "") { mysql_query("insert into $forumdb (posternum,message,parentid,forumid,subject,timestamp,postername,clantag,adminflag,lastpost) values (\"$users[num]\",\"$message\",\"$parentid\",\"$forumid\",\"$subject\",\"$time\",\"$users[empire]\",\"$users[clan]\",\"$users[disabled]\",\"$time\");"); if ($parentid != "") { mysql_query("update $forumdb set lastpost=$time where msgid=$parentid;"); } print "<i><b>Message Posted</b></i>"; } if ($do_delete != "") { if (($forumlista[clanonly] == 1) && ($postok[$forumid] >= 2)) { if ($post) { $postid = $post; mysql_query("delete from $forumdb where msgid=$post"); } if ($thread) { $postid = $thread; mysql_query("delete from $forumdb where parentid=$thread or msgid=$thread"); } print "Post ID $postid deleted!"; } if ($postok[$forumid] == 3) { print "Post ID $postid deleted!"; } } ?> <table border=1 width=100% class="scores"> <? $foruminfo = mysql_fetch_array(mysql_query("select name,clanonly from $forumnamedb where forumid=$forumid;")); ?> <caption align=top>Browsing <?=$foruminfo[name]?>... (Most recent thread displayed first)</caption> <tr><th width=30%>Subject</th><th width=30%>Poster</th><th width=10%># of posts</th><th width=30%>Last Post (in <?=date("T");?>)<br>Last Poster</th></tr> <? if (($foruminfo[clanonly] == 1) && ($users[disabled] != 2)) { $messagelst = mysql_query("select * from $forumdb where forumid=$forumid and (clantag=$users[clan] or adminflag=2) and parentid is not null and parentid = 0 order by lastpost desc;"); } else { $messagelst = mysql_query("select * from $forumdb where forumid=$forumid and parentid is not null and parentid = 0 order by lastpost desc;"); } while ($messagelist = mysql_fetch_array($messagelst)) { # $lastpost = mysql_fetch_array(mysql_query("select timestamp from $forumdb where (parentid=$messagelist[msgid] or msgid=$messagelist[msgid]) order by timestamp desc limit 1")); $lastpost = date("D, F j, Y g:i:s a",$messagelist[lastpost]); $threadnum = mysql_num_rows(mysql_query("select timestamp from $forumdb where (parentid=$messagelist[msgid] or msgid=$messagelist[msgid]) order by timestamp desc")); $lastpostinfo = mysql_fetch_array(mysql_query("select adminflag,posternum,postername,clantag from $forumdb where (parentid=$messagelist[msgid] or msgid=$messagelist[msgid]) order by timestamp desc")); $msgstamp = date("D, F j, Y g:i:s a",$lastpost[timestamp]); $clantag = ""; $clantagb = ""; if ($messagelist[clantag] > 0) { $clantaga = mysql_fetch_array(mysql_query("select tag from $clandb where num=$messagelist[clantag];")); $clantag = " - $clantaga[tag]"; } if ($messagelist[adminflag] == "2") { $clantag = " - <font class=\"cbad\">Administrator</font>"; } if ($lastpostinfo[clantag] > 0) { $clantagba = mysql_fetch_array(mysql_query("select tag from $clandb where num=$messagelist[clantag];")); $clantagb = " - $clantagba[tag]"; } if ($lastpostinfo[adminflag] == "2") { $clantagb = " - <font class=\"cbad\">Administrator</font>"; } if (($forumlista[clanonly] == 1) && ($postok[$forumid] >= 2)) { $deleteok = " - <a href=$config[main]?action=forums&forumid=$forumid&do_delete=1&thread=$messagelist[msgid]>Delete</a>"; } if ($postok[$forumid] == 3) { $deleteok = " - <a href=$config[main]?action=forums&forumid=$forumid&do_delete=1&thread=$messagelist[msgid]>Delete</a>"; } print "<tr><td><a href=$config[main]?action=forums&forumid=$forumid&read=$messagelist[msgid]>$messagelist[subject]</a></td><td>$messagelist[postername] (#$messagelist[posternum])$clantag</td><td>$threadnum$deleteok</td><td>$lastpost<br><i>$lastpostinfo[postername] (#$lastpostinfo[posternum])$clantagb</i></td></tr>\n"; } ?> <? if ($read != 0) { $messagedis = mysql_fetch_array(mysql_query("select * from $forumdb where msgid=$read and forumid=$forumid")); if (($users[clan] != $messagedis[clantag]) && ($foruminfo[clanonly] == 1) && ($users[disabled] != 2)) { print "Message unreadable!"; } else { ?> </table> <table border=0 width=100% class="scores"> <? $threadlst = mysql_query("select * from $forumdb where forumid=$forumid and (parentid=$read OR msgid=$read);"); while ($threadlist = mysql_fetch_array($threadlst)) { $messagetext = eregi_replace("<","&lt;",$threadlist[message]); $messagetext = eregi_replace("\n","<br>",$messagetext); $messagetext = eregi_replace("\cM","<br>",$messagetext); $msgstamp = date("D, F j, Y g:i:s a",$threadlist[timestamp]); $clantg = ""; if ($threadlist[clantag] > 0) { $clantga = mysql_fetch_array(mysql_query("select tag from $clandb where num=$threadlist[clantag];")); $clantg = " - $clantga[tag]"; } if ($threadlist[adminflag] == "2") { $clantg = " - <font class=\"cbad\">Administrator</font>"; } if (($forumlista[clanonly] == 1) && ($postok[$forumid] >= 2)) { $deleteok = " - <a href=$config[main]?action=forums&forumid=$forumid&do_delete=1&post=$threadlist[msgid]>Delete</a>"; } if ($postok[$forumid] == 3) { $deleteok = " - <a href=$config[main]?action=forums&forumid=$forumid&do_delete=1&post=$threadlist[msgid]>Delete</a>"; } print "<tr><td width=25%><b><i>$threadlist[subject]</b>$deleteok</i></td><td>$threadlist[postername] (#$threadlist[posternum])$clantg</td><td><b>Posted at:</b> $msgstamp</td></tr>\n"; print "<tr><td bgcolor=#993300 colspan=3>&nbsp;</td></tr>\n"; print "<tr><td colspan=3>$messagetext</td></tr>\n"; print "<tr><td colspan=3>&nbsp;</td></tr>\n"; } ?> <? } } ?> </table> <? #$forumlista = mysql_fetch_array(mysql_query("select * from $forumnamedb where forumid=$forumid;")); #if ($forumlista[adminonly] == 1) { $postok = array($forumlista[forumid] => 0); } #if ($forumlista[clanonly] == 1) { $postok = array($forumlista[forumid] => 1); } #if (($users[clan] == 0) && ($forumlist[clanonly] = 1)) { $postok = array($forumlista[forumid] => 0); } #if ((($users[num] == $clan[founder]) || ($users[num] == $clan[asst]) || ($users[num] == $clan[fa1]) || ($users[num] == $clan[fa2])) && ($forumlist[clanonly] = 1)) { $postok = array($forumlista[forumid] => 2); } #if (($forumlista[adminonly] != 1) && ($forumlista[clanonly] != 1)) { $postok = array($forumlista[forumid] => 1); } #if ($users[disabled] == 2) { $postok = array($forumlista[forumid] => 3); } if ($postok[$forumid] != 0) { if (($users[disabled] != 2) && ($forumlista[adminonly] == 1)) { TheEnd("Only Administrators may post here!"); } if ($read != 0) { print "Reply to this thread<br>\n"; } else { print "Post new thread<br>\n"; } print "<form method=post action=Global-Wars.php>\n"; print "<input type=hidden name=action value=forums>\n"; print "<input type=hidden name=forumid value=$forumid>\n"; if ($read != "") { print "<input type=hidden name=parentid value=$read>\n"; } print "Subject: <input type=text name=subject size=25 maxlength=25><br>\n"; print "<textarea rows=15 cols=60 name=message></textarea><br>\n"; print "<input type=submit name=do_newmessage value=\"Post Message\">\n"; print "</form>\n"; } [/code] can anyony see why it just says the query was emtpy???? theres nothing in the forum table but the forumname table there is.... and even if i insert in to the forum table it still comes up emtpy????? please any help?
  12. ;D ok I got it. [code] <form method="post" action="<?=$config[main]?>?action=country"> [/code] needed to change to [code] <form method="post" action="<?=$config[main]?>?action=vote"> [/code] oops ..... I cant believe how many times i over looked that!
  13. very simple, get visual cron http://www.visualcron.com/ i ran into the same problem as you and found this. its set up real nice and easy. i cant recall the cost but you can try it free. youll have to download the program and set up your jobs through it on your computer, just add the url to the cron script on your site and the times to run, then the sever from visual cron does it.
  14. thanks for the reply ,but it hasnt helped  >:( [code] $result = mysql_query( ... ) if ($result === false) die("Mysql error " . mysql_error());[/code] fisrt i tried this, and got an error. wouldnt load my page. also $member_vote is not a table in my db, just the name of the selection to my dropdown selection box. now i could very well be wrong,as im just now learning php, but using this this way has worked before as in this code with $signup_country [code] if ($do_signup) { mysql_query("INSERT INTO $playerdb (num) VALUES (NULL);"); $users = loadUser(mysql_insert_id()); $users[country] = $signup_country; <? EndNow(""); } ?> <form method="post" action="<?=$config[main]?>?action=signup"> <table class="inputtable"> <tr><th class="aright">Your Country: <a href=countrys.html>Help</a></th>     <td><select name="signup_country" size="1"> <? $countrys = mysql_query("select id,name from $countrydb;"); while ($country = mysql_fetch_array($countrys)) { ?>     <option value="<?=$country[id]?>"<?if ($country[id] == 1) print " selected";?>><?=$country[name]?></option> <? } ?>     </select></td></tr> <tr><td colspan="2">&nbsp;</td></tr> <tr><td><input type="submit" name="do_signup" value="Sign Me Up!"></td>     <td class="aright"><input type="reset" value="Reset Form!"</td></tr> </table> </form> <? HTMLendcompact(); ?> [/code] and as far as checking the values of $playerdb and $member_vote to make sure they are valid.??? well i know the $playerdb values and the dropdown box is loading the correct users from $playerdb to the page so $member_vote value should be right, its just not updating the $playerdb. as it should be adding 1 to pvote  in $playerdb ( -- SET pvote=(pvote+1) -- ) the query should be doing this in the  $playerdb where num value in $playerdb matches the num value of $member_vote. how can i check the value of $member_vote as its not really in the db,well not under that name anyway. so i ask agian, any idea why this is not working????
×
×
  • 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.