Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by TJMAudio

  1. So I come here for help, and all I get is figure it out yourself?
  2. That's the general idea, yes. Back to my question; how would I do it?
  3. How would I make it so a page would only be displayed once every 24 hours if a user has clicked a link?
  4. [quote author=jesirose link=topic=123853.msg512461#msg512461 date=1169659084] Then you'll need to use the correct host...Or were you just trying to hide your host info? [/quote] That was the problem, it's fixed now.
  5. How do I use mysql_connect in PHP5.1.5? Here is my code: [code] <?php define('HOST', 'localhost'); define('USER', 'username'); define('PASS', 'password'); mysql_connect(HOST, USER, PASS) or die(mysql_error()); [/code] It gives me this error: [quote] Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /h/web8/b13/pow/htdocs/index.php on line 10 [/quote]
  6. I have another question, now.  Thanks for the help with the classes and xml, I am finally getting that set up and going. I was wondering how I would track and affiliate click, then track if it was paid.  Would this just use cookies?  I have a general idea on how to track the clicks (and match them to the user who clicked them), but I don't know at all how to track if the payment was made to me.
  7. [quote author=thorpe link=topic=119599.msg490014#msg490014 date=1166762415] 1/ Sometimes it comes in handy to instantiate an object with some default values. 2/ Look at the example sin the manual entry for the [url=http://php.net/simplexml]simplexml[/url] extension. They don't get much simpler. [/quote] I don't understand them even more now..  People's tutorials I look at have them set like this: [code] var $name; var $time; var $date; [/code] They don't have any values set..
  8. Alright, I am decently skilled with PHP, however I am trying to learn some of the more advanced programming methods.  What I am trying to learn now is XML parsing and OOP.  Question 1: What is the point of setting vars in a class beforehand?  Do they set up the $this->var for the functions?  I cannot find a very good tutorial for classes, they are all either too simple, or too advanced. Question 2: Is there a simple way to parse an xml file?  I keep finding really, really in-depth huge classes that are multi-function used to process XML files, such as news feeds, etc.  Are these huge classes required?  Again, I can't find a good tutorial for these. Thanks guys.
  9. To make it so I could have $config['Database'] and $config['Site'], etc, would I just do this: [code]$config = array('Database', 'Site' => array());[/code] Thanks guys.
  10. So if I were to make my own to hold data, I would write it like this? [code]$config = array("Database" => array("type", "host", "user", "pass")); // Set Database Information, do not edit database type $config['Database']['type'] = 'MySQL'; $config['Database']['host'] = 'localhost'; $config['Database']['user'] = ''; $config['Database']['pass'] = ''; ?>[/code] Do I have it right?  Also, what are some benefits (or needs) to use multidimensional arrays?  I understand that you gave me an example, but it went right over my head.
  11. I was just reading through a popular script and I noticed something about it, it seems to use "double arrays".  How do these work?  Here is an example.. [code]$config['Database']['host'] = 'localhost'; $config['Database']['user'] = ' ';[/code] Can you just define these, without calling an array?  They are just like that, they don't have a $config = array() in the script that I can see.
  12. I am wondering how to program functions that can track users that click my ads, then automatically edit the database with the designated payment when the affiliate click is confirmed, like TreasureTrooper.com.  Are there any good tutorials or could anyone give me a brief explanation as to how it works and a good source on where to learn? Thanks guys, much appreciated.
  13. This is not the first time this has happened.  My actual code is being displayed on a white page... www.shleem.com/stuff/ Here is the code: [code]<? $url = @fsockopen("big.oscar.aol.com", 80, &$errno, &$errstr, 3); fputs($url, "GET /spoonosupport?on_url=online&off_url=offline HTTP/1.0\n\n"); while(!feof($url)) { $feofi++; $page .= fread($url,256); if($feofi > 10) { $page = "offline"; break; } } fclose($url); if(strstr($page, "online")) { echo "the user is online"; } else { echo "the user is offline"; } ?>[/code]
  14. Hi everyone, Alright I have a table that is "dlnum".  This contains file names and how many times they have been downloaded.  How would I go about looping a query and adding each "dlnum" so I can echo out the total amount of downloads (for all files combined)? Thanks
  15. I have a function that checks to make sure everything in the form is valid and filled out and I want to make it so if all passes, then it calls another function to create the user account... is this possible?  Do I have to create a class to do this? Thanks.
  16. http://www.worldofbotcraft.com Here is the temp login info for you guys: Username: phpfreak Password: test Thanks guys :)
  17. What? I just want part of my script to execute every 30 minutes, not a program.
  18. Hi everyone, I would like to make a function that lasts 30 minutes, then adds a set amount to a variable, then starts the countdown over again.  How would I make this?  Thanks.
  19. Then I was browsing php.net.  I came across some function, I forget what it was, but then it contained a very complex, almost C# looking, PHP script.  I was just wondering what it did?  Mainly one function it used a lot, and that was "interface".  Here is the script: [code]<?php interface INamed {   public function getName(); } interface ISon {   public function getFather(); } interface IFather {   public function getSons(); } abstract class Named implements INamed {   protected $name;   public function __construct($name)   {       $this->name = $name;   }   public function __destruct()   {}   public function getName()   {       return $this->name;   } } abstract class Son implements ISon {   protected $father;   public function getFather()   {       return $this->father;   }   public function __construct(IFather $father = null)   {       $this->father = $father;   }   public function __destruct()   {} } abstract class Father implements IFather {   protected $sons = array();   public function getSons()   {       return $this->sons;   }   public function __construct($sons = array())   {       $this->sons = $sons;   }   public function __destruct()   {} } class Man implements INamed, ISon, IFather {   public function __construct($name, IFather $father = null, $sons = array())   {       // note: these are just __construct() calls - not real class initializations       Named::__construct($name);       Son::__construct($father);       Father::__construct($sons);   }   public function __destruct()   {       Named::__destruct();       Son::__destruct();       Father::__destruct();   }   public function getFather()   {       return Son::getFather();   }   public function getSons()   {       return Father::getSons();   }   public function getName()   {       return Named::getName();   } } $siarhej = new Man('Siaroh', new Man('Adas'), array(new Man('Seva'))); var_dump($siarhej->getName()); var_dump($siarhej->getFather()->getName()); $siarhejSons = $siarhej->getSons(); var_dump($siarhejSons[0]->getName()); ?>[/code]
  20. JUST the big image in the center of the page.  The problem I am seeing is the fact that there is no full image link, it's just /directory/imagename.jpg, not the full website.  But, I was thinking, I could just use echo "http://www.blahblah.com/$imgURL"; after I found it.  Could I use the strpos() function to find the image link he used? I think it'd be something like this: [code] <?php include("url"); $string = include("url"); $str = "/directory/image"; strpos($string, $str); ?> [/code] The only problem with that is, I can't have a set image##.jpg, as it changes every 30 seconds.  Is there any way to only search for /directory/image and then 2 extra spaces, then add .jpg at the end of that?
  21. Hi everyone, not sure if this is doable, but I would like to believe it is. Here is my problem.  I want to include a small part of another site on my website.  I only want to include the big image seen here in my site: http://www.freegamecam.com/users/viewuser.php/WorldOfBotcraft .. Is there any way to include only a section of their script?  The problem with just linking their image is that a new image is displayed every 30 seconds.  I am sorry if I didn't explain this very well, but is there any way to do that?
  22. Alright, here is a copy of the code that is having the problems: [code] <dl> <dt> <a onclick="switchmenu('first');" class="proftop" style="cursor:pointer;"> <img src="images/firstmenu.gif" /> <?php $cat1maxlvl = $maxlvl / 4; ?> <span class="proftop"> <?php echo $faction; ?> <?php echo "$minlvl - $cat1maxlvl"; ?> Profiles</span> </a> </dt> <dd id="first"> <?php $get1 = "SELECT * FROM `profile` WHERE `minlvl`>='$minlvl' AND `maxlvl`<='$cat1maxlvl' AND `faction`='$faction' ORDER BY profileid AND minlvl DESC"; $q1 = mysql_query($get1) or die(mysql_error()); while($r1 = mysql_fetch_array($q1)){ $p1id = $r1['profileid']; $p1name = $r1['profilename']; $p1link = $r1['profilelink']; ?> <a href="<?php echo $p1link; ?>" class="f1"> <img src="images/profilemenu.gif" border="0" /></a> <a href="<?php echo $p1link; ?>" class="f1"><?php echo $p1name; ?></a> <br /> <?php } ?> </dd> </dl> [/code] This part of the code is giving me a headache.  Here are the variables used in this: $minlvl = 1 $maxlvl = 20 $cat1maxlvl = 5 $faction = alliance and then so on and so forth. I have 4 of these being called as it runs down the script, going from levels 1-5, 5-10, 10-15, and 15-20.  The thing is, this one is getting something that has a maxlvl of 10.  Is my SQL wrong?  If you need to see the full script just let me know. Thanks. 
  • 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.