Jump to content

Trium918

Members
  • Posts

    883
  • Joined

  • Last visited

Posts posted by Trium918

  1. So - how long does a user have to respond to a challenge? Can he just ignore it or must he respond in a certain time?

     

    From what you say, you will have challenges stored in your db with a userid. That user logs in and runs a query script that pulls up a set of challenges containing his id. The script outputs a display of the challenges with enough info for the targeted user to decide what to do and he then clicks an Accept or Decline button next to that row's data.(An html table would be nice here.) Or you could just run the query for the oldest challenge and respond to it and then let the script produce the next challenge.

    2 hrs. Also would a loop be necessary for multiple challenges

  2. I'm trying to allow the user to accept/decline challenges from other users through submit buttons. I have it where the initial user submit his or her challenge to the database, but how do I go about retrieving the data from the database and sending it to user who is being challenged, so that they are allowed to accept or decline? I just need to be pointed in the right direction, thanks.

  3. The method 'FileStorage' is the constructor for the class. It has two parameters: $path and $shoutLog. The $path parameter is required. When you instantiate the class you must pass at least that first parameter. It looks like it is used as a sub-path within the folder 'logs' for storing the log files.

    I am having problems writing to the file called logs.

  4. I'm assuming that's not your entire class definition. Does your complete class have a __construct() method? If not, the FileStorage() method may be used as the constructor and be called twice. Also note that the echo statement isn't going to do anything since FileStorage() doesn't return a value.

    <?php
    
    class FileStorage {
    
    	function FileStorage($path, $shoutLog = false) {
    		$this->shoutLog = $shoutLog;
    		$folder = 'logs';
    		if (!is_dir($folder)) $folder = '../' . $folder;
    		if (!is_dir($folder)) $folder = '../' . $folder;
    	
    		$this->path = $folder . '/' . $path . '.txt';
    	}
    	
    	function open($lock = false) {
    		$this->handle = fopen($this->path, 'a+');
    
    		if ($lock) {
    			$this->lock();
    			return $this->load();
    		}
    	}
    
    	function close(&$array) {
    		if (isset($array))
    			$this->save($array);
    				
    		$this->unlock();
    		fclose($this->handle);
    		unset($this->handle);
    	}
    
    	function load() {
    		if (($contents = $this->read($this->path)) == null)
    			return $this->resetArray();
    
    		return unserialize($contents);
    	}
    
    	function save(&$array, $unlock = true) {
    		$contents = serialize($array);
    		$this->write($contents);
    		if ($unlock) $this->unlock();
    	}
    
    	function unlock() {
    		if (isset($this->handle))
    			flock($this->handle, LOCK_UN);
    	}
    	
    	function lock() {
    		if (isset($this->handle))
    			flock($this->handle, LOCK_EX);
    	}
    
    	function read() {
    		fseek($this->handle, 0);
    		//return stream_get_contents($this->handle);
    		return file_get_contents($this->path);
    
    	}
    
    	function write($contents) {
    		ftruncate($this->handle, 0);
    		fwrite($this->handle, $contents);
    	}
    
    	function resetArray() {
    		if ($this->shoutLog)
    			$default = array(
    				'info' => array(
    					'latestTimestamp' => -1
    				),
    	
    				'posts' => array()
    			);
    		else
    			$default = array();
    
    		$this->save($default, false);
    		return $default;
    	}
    
    }
    
    ?>
    

    Here is the complete class. I am trying to figure out why this class isn't writing to the log file.

  5. <?php
    
    class FileStorage {
    
    	function FileStorage($path, $shoutLog = false) {
    		$this->shoutLog = $shoutLog;
    		$folder = 'logs';
    		if (!is_dir($folder)) $folder = '../' . $folder;
    		if (!is_dir($folder)) $folder = '../' . $folder;
    	
    		$this->path = $folder . '/' . $path . '.txt';
    	}
    $show_path= new FileStorage;
    echo $show_path ->FileStorage();
    ?>
    

    What is the correct way to call the class FileStorage's object? I am trying to test the class to see if it is working.

  6. What problems are you having? From what I see you extract the contents of the download and upload that to your site. To integrate it in your website you use one of the examples provided in the example directory.

     

    Edit. Just found out that yShout uses short open tags (<? ?>). You need to make sure PHP short open tags is enabled in order for yShout to function. This is a bad programming choice by the developers. You maybe able to enable short open tags by adding the following within a .htaccess file in the root of the yShout folder

    php_value short_open_tag 1
    

    Otherwise you will need to convert all <? to <?php in all  the .php files

    Ok, something happen. I am not able to log into the control panel after changing all short tags.

  7. Have you tried googling "php shout box". The first link for me gives a tutorial and the second link provides a php script.

     

    Thanks! I was searching shout box only without the php...

  8.  <form name=matchSelect method=post action=post.php onSubmit="if(this.amount=='Amount $') {alert('You must specify an amount!'); return false;} ">
    <select name="systems" onChange="updategamesmatchSelect(this.selectedIndex)" style="width: 150px" class="tourn_input" id="console">
    <option>Select A Console</option>
    <option value="6" >Nintendo Wii</option>
    <option value="7" >PC</option>
    <option value="3" >Playstation 3</option>
    <option value="15" >Playstation 4</option>
    <option value="5" >Xbox 360</option>
    <option value="16" >XBox One</option>
    </select><select name="game" style="width:170px" class="tourn_input" id="game_input">
    </select>
    <script type="text/javascript">var systemlistmatchSelect=document.matchSelect.systems
    var gameslistmatchSelect=document.matchSelect.game
    var gamesmatchSelect=new Array()
    gamesmatchSelect[0]=""
    gamesmatchSelect[1]=["Mario Kart Wii|987"];
    gamesmatchSelect[2]=["Call of Duty: Black Ops II |1695","Dota 2|1737","FIFA 13|1718","League of Legends|1705","Starcraft II|1429","Team Fortress 2|1156"];
    gamesmatchSelect[3]=["Battlefield 4|1729","Call of Duty Ghosts|1733","Call of Duty: Black Ops II |1693","FIFA 13|1685","FIFA 14|1725","Grand Theft Auto V|1731","Injustice: Gods Among Us|1711","Madden NFL 13|1678","Madden NFL 25|1721","Major League Baseball 2K13|1700","MLB 13: The Show|1702","Mortal Kombat vs DC Universe|1146","NBA 2K13|1687","NBA 2K14|1727","NCAA Football 13|1672","NCAA Football 14|1716","NHL 13|1681","NHL 14|1723","Pro Evolution Soccer 2014|1750","Street Fighter IV|1167","Tekken Tag Tournament 2 |1683","Tiger Woods PGA Tour 14 |1707","WWE 2K14|1735"];
    gamesmatchSelect[4]=["Battlefield 4|1741","Call of Duty Ghosts|1739","FIFA 14|1745","Injustice: Gods Among Us Ultimate Edition|1755","Madden NFL 25|1738","NBA 2K14|1743","NBA Live 14|1748","Need For Speed Rivals|1756"];
    gamesmatchSelect[5]=["Battlefield 4|1730","Call of Duty Ghosts|1734","Call of Duty: Black Ops II |1694","FIFA 13|1686","FIFA 14|1726","Grand Theft Auto V|1732","Halo 4|1692","Injustice: Gods Among Us|1712","Madden NFL 13|1679","Madden NFL 25|1722","Major League Baseball 2K13|1701","Mortal Kombat vs DC Universe|1147","NBA 2K13|1688","NBA 2K14|1728","NCAA Football 13|1673","NCAA Football 14|1717","NHL 13|1682","NHL 14|1724","Pro Evolution Soccer 2014|1751","Street Fighter IV|1168","Tekken Tag Tournament 2 |1684","Tiger Woods PGA Tour 14 |1708","WWE 2K14|1736"];
    gamesmatchSelect[6]=["Battlefield 4|1742","Call of Duty Ghosts|1740","FIFA 14|1746","Forza Motorsport 5|1754","Madden NFL 25|1747","NBA 2K14|1744","NBA Live 14|1749","Need For Speed Rivals|1757"];
    function updategamesmatchSelect(selectedgamesgroup){
    gameslistmatchSelect.options.length=0
    if (selectedgamesgroup>0){
    for (i=0; i<gamesmatchSelect[selectedgamesgroup].length; i++) 
    gameslistmatchSelect.options[gameslistmatchSelect.options.length]=new Option(gamesmatchSelect[selectedgamesgroup][i].split("|")[0], gamesmatchSelect[selectedgamesgroup][i].split("|")[1])
    }
    }
    </script>
    
    <input name="amount" value="Amount $" size="8" maxlength="10" class="tourn_input" onFocus="this.className='tourn_input_focus'; if (this.value='Amount $') { this.value=''};" onBlur="this.className='tourn_input'"/><p style="padding:12px 0 0 0;">Comments:</P><textarea name="comments" rows="3" cols="57" class="tourn_input" id="comments" onFocus="this.className='tourn_input_focus'; if (this.value='Use this box to talk about rules, game play settings, preferred game time and availability. (i.e., Prefer to play Monday from 2-4 p.m.)') { this.value=''};" onBlur="this.className='tourn_input'">Use this box to talk about rules, game play settings, preferred game time and availability. (i.e., Prefer to play Monday from 2-4 p.m.)</textarea><br><input name=recipient value='BUMPGOOD904' type=hidden class=button /><input type='hidden' name='subject' value='Superian has challenged you.' class="button" /><p style="padding:12px 0 0 0;">
    <input type="image" src='images/but_send_challenge.gif' class="button" onmouseover="this.src='images/but_send_challenge_ON.gif'" onmouseout="this.src='images/but_send_challenge.gif'" />
    </p>
    
    
    
    									</form>
             									
    

    I am needing someone to point me in the right direction. I am trying to use Ajax to populate the drop down menu similar to what the programmer used in the code above. Correct me if I am wrong, but wouldn't the site load faster if the data for the (gamematchSelect) array is stored and pulled from the database? I just need to know how to populate the second drop down menu after the first Select Console is selected which is generated by the updategamesmatchSelect function when called.

  9. phpfreaks has changed since the last time I have been on here. It's been some time, but I have a quick queston for you all. On the home page of phpfreaks I noticed that the navagation loads into the same content div or whatever while the remaining of the site remains static. What is this called and could you all lead me into the right direction? Thanks!

  10. So you are basically creating an e-commerce site where users add music files to their cart and can download them once they have paid for them. Am I correct? If so, have a look at osCommerce. This is an e-commerce script that has file download functionality. http://www.oscommerce.com/

    You can study and re-create the parts you need for your own site. This is too big a project to give a simple answer to. You need to break the project into smaller parts before asking for help.

    So you are basically creating an e-commerce site where users add music files to their cart and can download them once they have paid for them. Am I correct? If so, have a look at osCommerce. This is an e-commerce script that has file download functionality. http://www.oscommerce.com/

    You can study and re-create the parts you need for your own site. This is too big a project to give a simple answer to. You need to break the project into smaller parts before asking for help.

     

    No mixtapes are free. http://livemixtapes.com

  11. I've search google and found bit and pieces of code, but unfortunately my head is still cloudy. I am looking for someone to point me in the right direction. I am going to attempt to write a php script that will allow the user to download free music such http://www.livemixtapes.com which is using php as well. I am looking for functions, headers, and whatever else I  would need to complete this task of mines. How to step up structure of the <dir> etc... Thanks.

  12. I was wondering was a website's logo copyrighted by default, or do I have to go through some type of legal process to get it copyrighted? I would like to do more with the logo like printing it to some t-shirts for profit.

     

    Can someone shine some light on this and point me in the right direction?

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