Jump to content

Dusaro

Members
  • Posts

    63
  • Joined

  • Last visited

    Never

Everything posted by Dusaro

  1. elaborate what you mean by "not working"? any errors? etc.
  2. I believe that the <marquee> tag is no longer valid(W3C Compliant) html. FYI. then why am i still using it xD
  3. echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want?
  4. Access the database and display all table names found. In the form use the POST method. On the second page after the table has been selected and the first form submitted, use $table = $_POST['Dropdown Value']; if ($table == 0) { Do This } elseif ($table == 1) { Do This } etc etc. I know this is not the best way and i have not tested it.
  5. I didn't know i was using a header to stop it displaying errors?
  6. Well, I have been tryna figure this out for days but it wont seem to work. The base image appears fine but it wont write the text or the avatar on it. <?php //Do Not Cache header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); //Getting Variables $user = "Dusaro"; $rank = "Administrator"; $a = "0"; if(isset($_GET['a'])) { if(!empty($_GET['a'])) { $a = $_GET['a']; } } if(isset($_GET['u'])) { if(!empty($_GET['u'])) { $user = $_GET['u']; } } if(isset($_GET['r'])) { if(!empty($_GET['r'])) { $rnk = $_GET['r']; } else{$rnk='Administrator';} } else{$rnk='Administrator';} if(isset($_POST['u'],$_POST['r'],$_POST['a'])) { if(!empty($_POST['u'])) { $user=$_POST['u']; } if(!empty($_POST['r'])) { $rnk = $_POST['r']; } if(!empty($_POST['a'])) { $a = $_POST['a']; } } //Setting up Image $image = imagecreatefrompng("base.png"); $avatar = imagecreatefrompng($a.".png"); $font = "US101.TTF"; imagecopymerge($image, $avatar, 0, 0, 0, 0, 100, 100, 100); $color = imagecolorallocate($image, 0,0,0); ImageTTFText ($image, "15", 0, 230, 0, $color, $font,$user); ImageTTFText ($image, "14", 0, 257, 96, $color,$font,$rnk); //Displaying Image header("Content-type: image/png"); imagepng($image); imagedestroy($image); imagedestroy($avatar); ?> can any1 help?
  7. Well, the reason is that the game's script they were using was discontinued and had to use a different one. Just ignore the func.inc.php file. I wont be needing it again since that is the only thing i can remember using mysql. and i moved all the stuff i need from it to the signature.php file.
  8. Well, I had this working perfectly until they stopped using a mysql database and started using a flatfile. What it should do: Grab data from the flatfile, trim the unwanted parts and set it in an array. With the received data display as an image. I am very confused about how I would do this. My current code: signature.php: <?php //GET AND TRIM $fileName="accounts.txt"; $fileHandle = fopen($fileName,"r"); $filecontents = fread($fileHandle,filesize($fileName)); $exploded = explode(" ",$filecontents); $name=""; $balance=""; $accounts=array(); $num=0; for($i=0;$i<count($exploded);$i++) { $line = explode("\t",$exploded[$i]); for($a=0;$a<count($line);$a++) { if(trim($line[$a])=="player") { }elseif($line[$a]=="money") { }elseif($line[$a]=="type") { }elseif(trim($line[$a])=="{") { }else { $subline = explode("\r",$line[$a]); for($e=0;$e<count($subline);$e++) { if(trim($subline[$e])=="}") { } elseif(is_numeric(trim($subline[$e]))) { $balance=trim($subline[$e]); } else { $name=trim($subline[$e]); } if($name!=""&&$balance!="") { $temp=array($name=>$balance); $accounts[$num]=$temp; $num++; $name=""; $balance=""; } } } } } //Image Generation require_once('../func.inc.php'); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); $font = "minecraft.ttf"; $user=""; if(isset($_GET['u'])) { if(!empty($_GET['u'])) { $user = $_GET['u']; } } if(isset($_GET['i'])) { if(!empty($_GET['i'])) { $img = $_GET['i']; } else{$img='1';} } else{$img='1';} if(isset($_POST['u'],$_POST['i'])) { if(!empty($_POST['u'])) { $user=$_POST['u']; } if(!empty($_POST['i'])) { $img = $_POST['i']; } } if(in_array($user, $accounts)) { //Info Grabs $money = get_balance($user); //End Info Grabs } else { die("That is an invalid player."); } //Display Image $user = ucfirst($user); $image = imagecreatefrompng("images/".$img.".png"); $color = imagecolorallocate($image, 255,255,255); if ($_GET['i'] >= '8') { ImageTTFText ($image, "8", 0, 100, 13, $color, $font,"Name:"); ImageTTFText ($image, "8", 0, 138, 13, $color, $font,$user); ImageTTFText ($image, "8", 0, 240, 13, $color,$font,"Money:"); ImageTTFText ($image, "8", 0, 285, 13, $color,$font,"$".$money); } else { ImageTTFText ($image, "7", 0, 246, 10, $color, $font,"Spartan Universe"); ImageTTFText ($image, "12", 0, 130, 50, $color, $font,"Name:"); ImageTTFText ($image, "12", 0, 130, 96, $color,$font,"Money:"); ImageTTFText ($image, "12", 0, 185, 50, $color, $font,$user); ImageTTFText ($image, "12", 0, 198, 96, $color,$font,"$".$money); } //End Image Display header("Content-type: image/png"); imagepng($image); imagedestroy($image); ?> accounts.txt: arkangel011 { type player money 23.47 } chemicalbacon { type player money 203.89 } func.inc.php <?php function get_players() { $con = mysql_connect("host","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("minecraft",$con); $query = "SELECT * FROM `lb-players` ORDER BY `lb-players`.`playername` ASC "; $res = mysql_query($query,$con); while($row = mysql_fetch_assoc($res)) { echo "<option value='".$row['playername']."'>".$row['playername']."</option>"; } } function is_valid_player($user) { $con = mysql_connect("host","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("minecraft",$con); $query = "SELECT COUNT(playername) AS count FROM `lb-players` WHERE `playername` = '".$user."'"; $res = mysql_query($query,$con); $row = mysql_fetch_assoc($res); if($row['count']==1) { return true; } else { return false; } } function get_balance($name) { $con = mysql_connect("host","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("iconomy",$con); $query = "SELECT * FROM `iconomy` WHERE `iconomy`.`username` = '".$name."'"; $res = mysql_query($query,$con); $row=mysql_fetch_array($res); //echo $row['balance']; mysql_close($con); return $row['balance']; } function update_economy() { $con = mysql_connect("host","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("iconomy",$con); $fileName="accounts.txt"; $fileHandle = fopen($fileName,"r"); $filecontents = fread($fileHandle,filesize($fileName)); $exploded = explode(" ",$filecontents); $name=""; $balance=""; $accounts=array(); $num=0; for($i=0;$i<count($exploded);$i++) { $line = explode("\t",$exploded[$i]); for($a=0;$a<count($line);$a++) { if(trim($line[$a])=="player") { //unset($line[$a]); }elseif($line[$a]=="money") { //unset($line[$a]); } elseif($line[$a]=="type") { //unset($line[$a]); } elseif(trim($line[$a])=="{") { //unset($line[$a]); } else { //echo $line[$a]."<br>"; $subline = explode("\r",$line[$a]); for($e=0;$e<count($subline);$e++) { //echo $subline[$e]."<br>"; if(trim($subline[$e])=="}") { //unset($subline[$e]); } elseif(is_numeric(trim($subline[$e]))) { //echo $subline[$e]."<br>"; $balance=trim($subline[$e]); } else { //echo $subline[$e]."<br>"; $name=trim($subline[$e]); } if($name!=""&&$balance!="") { $temp=array($name=>$balance); $accounts[$num]=$temp; $num++; $name=""; $balance=""; } } } } } foreach($accounts as $account=>$balance) { foreach($balance as $name=>$dollar) { $query = "UPDATE `iconomy`.`iconomy` SET `balance` = '".$dollar."' WHERE `iconomy`.`username` ='".$name."'"; mysql_query($query,$con); //echo "Name: ".$name; //echo ": Balance: ".number_format($dollar,2); //echo "<br>"; } } } ?>
  9. The Name and Description are returning values when it is echoed.
  10. Well, I am not sure where to post this since it is using php and javascript. I am using OSFlvPlayer to stream the videos, the information for each video is in a mysql database. Using the $_GET php variable I am getting a value called id, I am then comparing the $id variable with the value called ID in the mysql database. The problem i am having is that it will not get the correct directory to get the videos, it is simply setting it as "/videos/.flv" instead of say "/videos/mario.flv" <?php //disabling cache header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past //getting id of video $id = $_GET[id]; // Connects to your Database mysql_connect("localhost", "user", "pass") or die(mysql_error()) ; mysql_select_db("database") or die(mysql_error()) ; //Retrieves data from MySQL $data = mysql_query("SELECT * FROM Videos WHERE ID= '$id'") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<b>Name:</b> ".$info['Name'] . " <br>"; ?> <script src='AC_RunActiveContent.js' language='javascript'></script> <!-- saved from url=(0013)about:internet --> <script language='javascript'> AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '400', 'height', '325', 'src', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'id', 'flvPlayer', 'allowFullScreen', 'true', 'allowScriptAccess', 'always', 'movie', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'FlashVars', 'movie=/videos/<?php $info["Name"] ?>.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=<?php $info["Name"] ?>&showTitle=yes'); </script> <noscript> <object width='400' height='325' id='flvPlayer'> <param name='allowFullScreen' value='true'> <param name="allowScriptAccess" value="always"> <param name='movie' value='OSplayer.swf?movie=<?php $info["Name"] ?>.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=<?php $info["Name"] ?>&showTitle=yes'> <embed src='OSplayer.swf?movie=/videos/<?php $info["Name"] ?>.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=<?php $info["Name"] ?>&showTitle=yes' width='400' height='325' allowFullScreen='true' type='application/x-shockwave-flash' allowScriptAccess='always'> </object> </noscript><br/> <?php Echo "<b>Description:</b><br/> ".$info['Description']; } ?>
  11. This is what I did. I went into phpmyadmin, went into my tables, operations, copy tables. It then gave me those.
  12. well, I just copied the table structure and used the query it gave me.
  13. You Mean these? CREATE TABLE `a2186214_hbclan`.`table_members` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name` VARCHAR( 15 ) NOT NULL , UNIQUE KEY `id` ( `id` ) , UNIQUE KEY `name` ( `name` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1; CREATE TABLE `a2186214_hbclan`.`application` ( `ID` INT( 11 ) NOT NULL AUTO_INCREMENT , `Name` VARCHAR( 30 ) NOT NULL , `Email` VARCHAR( 30 ) NOT NULL , `Clans` VARCHAR( 30 ) NOT NULL , `Xfire` VARCHAR( 30 ) NOT NULL , `Invited` VARCHAR( 30 ) NOT NULL , `Skills` VARCHAR( 255 ) NOT NULL , `Status` VARCHAR( 30 ) NOT NULL , `Date` DATE NOT NULL , `Rules` VARCHAR( 30 ) NOT NULL , `Ip` VARCHAR( 50 ) NOT NULL , `Old` INT( 30 ) NOT NULL DEFAULT '0', `fuser` VARCHAR( 50 ) NOT NULL , UNIQUE KEY `ID` ( `ID` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1;
  14. well, i had a thread bout 1 or 2 weeks ago about this but people stopped answering... INSERT INTO table_members(name) SELECT application.Name FROM application WHERE application.ID = '$member' ON DUPLICATE KEY UPDATE table_members.name = application.Name Will not update, still makes a new entry... Table Structures In table_members I have "id","name". "id" being the unique index. and name being unique. In application I have "ID","Name","Email","Clans","Xfire","Invited","Skills","Status","Date","Rules","Ip",Old","fuser". "ID" being the unique index. and Name being unique.
  15. After setting table_members.name and application.Name as Unique, i'm still getting error "Unknown column 'application.Name' in 'field list'"?
  16. Well, when inserting I want it to check if the name exists, as each member will have their own unique id, not the same id as the applications.
  17. In table_members I have "id","name". "id" being the unique index. In application I have "ID","Name","Email","Clans","Xfire","Invited","Skills","Status","Date","Rules","Ip",Old","fuser". "ID" being the unique index. Is that what you wanted?
  18. This gives me: Unknown column 'application.Name' in 'field list' Not sure because my table is called application and the field is called Name...
  19. I have this but it will not update, it inserts the entry still! <?php $member=$_POST['memberid']; $status=$_POST['Status']; $con = mysql_connect("host","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a2186214_hbclan",$con); $sql="UPDATE application SET Status = '$status' WHERE ID = '$member'"; $sql1="INSERT INTO table_members(name) SELECT application.Name FROM application WHERE application.ID = '$member' ON DUPLICATE KEY UPDATE table_members.name = application.Name"; if ($status == 'ACCEPTED') { if(mysql_query($sql, $con) or die(mysql_error())) { if(mysql_query($sql1, $con) or die(mysql_error())) { echo 'Status Changed.<br /><a href="../applications.php">Return To Members List</a>'; } } else { die('Could not submit: ' . mysql_error()); } } else { if(mysql_query($sql, $con) or die(mysql_error())) { echo 'Status Changed.<br /><a href="../applications.php">Return To Members List</a>'; } else { die('Could not submit: ' . mysql_error()); } } mysql_close($con); ?>
×
×
  • 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.