Jump to content

mem0ri

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by mem0ri

  1. Also, if your file-size is exceeding the maximum limit currently set, you might want to set a higher limit in your PHP.ini file.
  2. I believe you're going to be stuck with a pay-for product, which will be worth it in the long run.
  3. If you're pointing to a separate server, you'll want to work with an 'absolute' link rather than a 'relative' link.
  4. If you're intending to have the same "layout" for your pages, you can always load each new page 'inside' of the index page...kind of like: <?php require_once('header.php'); if(!isset($_REQUEST['page'])) $page = 'main'; else $page = $_REQUEST['page']; require_once($page.'.php'); require_once('footer.php'); In that fashion, you can reference every page on the site through index.php?page=x As far as including file and sid... You'd just be adding another layer of $_GET variables that would either trigger (or not trigger) additional file-loads...
  5. One solution is to store dates as a "timestamp" and then translate them through php before showing them on-screen to users. Doing so allows you the greatest flexibility and allows you to store day, month, year, hour, minute, and second all at once.
  6. It is possible to have both a created-image and text on the same page, but my guess is that with the current coding, your picture is over-writing the area in which "text" was printed. Try some html or css separation of the image from the text...you'll be fine.
  7. Depends on your personal goals with each of the 10 sites, the performance hit you're willing to take in loading from a separate server (and whether that server is in the same datacenter or across the world will play a factor there), the security settings of each site (some server-configs won't allow remote-file loading), and whether or not you're willing to have all 10 sites go down at once if your 'main' server goes down.
  8. Looks like you have a doubling-up of variables... while($row = $db->fetchObject($result)) //Notice the variable '$result' { $result[] = $row; //Notice the same variable '$result' } Basically...you're fetching the first row, and then setting your "result-set" to be = to the first row...thereby destroying your result-set and making the next iteration of the while statement 'stop'.
  9. 448191 is correct in stating that you don't need an "or die()" with require_once(), but I would venture to say that your $filePath is somehow incorrect inside the __autoload(). Try something like: $filePath = $_SERVER['DOCUMENT_ROOT'].'/lib/'.$classname.'.php';
  10. I'm attempting to run a singleton-pattern on my MySQL Database Class and I'm running into problems referencing over to it...example: On the login page itself: $user = new User; // loading through the __autoload function and does work //...IRRELEVANT PHP CODE... $validate = $user->login($_POST['email'], $_POST['password']); Within the User->login function: public function login($email, $pass) { echo("INSIDE LOGIN"); $sql = MySQL::getinstance(); die("CREATED MYSQL INSTANCE"); //...ADDITIONAL IRRELEVANT CODE... Within the MySQL::getinstance(); function: public static function getinstance() { if(self::$instance == NULL) self::$instance = new MySQL; return self::$instance; } The "echo" and "die" within the User->login() function are just for debugging. I will always reach the echo, but never reach the die...therefore, the problem is definitely in the MySQL::getinstance() line... ...thing is...I can't figure out what's wrong with the structure? The MySQL class and User class are in separate files...but that shouldn't matter with the __autoload function, correct?
  11. Yes, sorry...I was being vague...probably had to do with having been up and in front of code for about 20 hours straight. Anyway...I did mean altering a value from within a page that defines constants. Thank you for the answers...going to mark this topic solved.
  12. Thank you...I ended up taking a look at cron and my server 'crontabs' per your suggestion. I think my next query along this line needs to be...if I call a PHP page that includes the "CONSTANTS" page and change a constant...will that changed constant persist? I believe it should...I guess the best way is to try it out. Thank you.
  13. Why don't you do the initial sorting at the INSERT end instead of running a cleanup after the fact? Just make the USER_IP a 'key' and run an INSERT......ON DUPLICATE KEY UPDATE... Of course...if you already have the database, then that's not an option for the current clean-up need. I'm actually not sure how to search the table to only get duplicated rows.
  14. I'm sure people are just gonna laugh at me...but...I'm wondering if there's even a way to run a persistent PHP page that counts ever tick on a timestamp...and when it reaches certain points makes a call to a MySQL database?
  15. Syntax: DELETE FROM table WHERE condition For more info, go to http://www.mysql.com, click 'documentation', and search for "DELETE SYNTAX"
  16. Thanks...I've got it working now and thought I'd post up the result just for anyone who searches these forums later. SELECT t1.x, t1.y, t1.z, t2.x FROM table1 t1 LEFT JOIN table2 t2 ON t2.t1id = t1.id AND t2.y = 0 WHERE t1.user = '$user' AND t1.a = 0 AND $cols LIKE '%$searchtxt%' ORDER BY t1.x ASC
  17. Thank you...the reference and quick answer are both appreciated. Guess I'll have to do an initial search through, then insert/update.
  18. This question isn't so much on a MySQL syntax (that's already working fine), but on a 'what happens if' type situation. I'm using an: INSERT INTO table (cols) VALUES (vars) ON DUPLICATE KEY UPDATE cols=vars However...in my table I have TWO key values...and I'm wondering how the table would react if I had a table with: KEY 1 | KEY 2 x1 x2 x2 x1 And I made this call: INSERT INTO table (key1, key2) VALUES (x1, x1) ON DUPLICATE KEY UPDATE key1 = x1, key2 = x1 Wouldn't two rows call a 'duplicate'? Now...my ideal result would be for them to fold into one row containing the new information...but I know life can't be that easy...
  19. Sorry about that Fenway...let me try to say it in a bit more readable fashion. (btw...still actively working on the problem...this is a frustrating one) I have TABLE1 from which I want to gather * on all rows where userid = x; I have TABLE2 from which I want to join a couple columns of info to TABLE1 on t2.joinid = t1.id; ...for each TABLE1 row there could be multiple TABLE2 rows... ...but for each TABLE1 row I want to only join the LAST (most recent) TABLE2 row available. I've been trying to work with sub-queries...but they're not workin' for me...mostly due to some unfamiliarity with doing them.
  20. I think that's gettin' me there...thank you. I think I'm lookin' at a situation where I need to throw a sub-query in the mix. Workin' on a solution now and I'll post it if/when it works. Thanks for steerin' me toward the right answer!
  21. Here's the story... I've got a SELECT statement pulling from two tables simultaneously...and it works beautifully... SELECT (stuff) FROM table1 t1 LEFT JOIN table 2 t2 ON t1.id = t2.t1id WHERE (stuff) AND $cols LIKE '%$searchtxt%' ORDER BY (stuff) ASC It's beautiful with a 1 to 1 relationship on both tables...but what I need...is... Pull from table 1 a single entry... ...that dissects multiple entries from table 2 and LEFT JOINs with only the most recent... Something like (and I know this syntax isn't valid at all) SELECT (stuff) FROM table1 t1 LEFT JOIN table 2 t2 ON t1.id = t2.t1id ORDER BY t2.id DESC LIMIT 1 WHERE (stuff) AND $cols LIKE '%$searchtxt%' ORDER BY (stuff) ASC I'm a little lost on how to put it all together....basically... table 1 | table 2 1 1, 1 2 1, 2 3 1, 3 1, 4 I need the SQL to return table 1 (1) and table 2 (1,4)...while skipping over (1,1 and 1,2 and 1,3 and 1,4) and join those two...AND the SQL needs to still pick up table 2 and 3 even though there is no corresponding data with table 2.
  22. Sounds like you need to add some form validation to your registration form... ...when someone submits their e-mail address, check it against the e-mail addresses already stored and if there's no duplicate, o.k. it. You should be able to do this work through PHP mostly with a simple MySQL: SELECT email FROM users WHERE email = '$newemail' Or something of the sort. Secondly, an MD5 encryption requires that you have at least a 32 character VARCHAR on your database for storing it...as all MD5 encrypted strings are 32 characters long. Finally...if you have a lost password form...the person submits their e-mail address to your form...you search the database for their e-mail address (see example simple SELECT above)...and then use the PHP mail() function to send them a new password. You won't be able to pull out their old password if you're using MD5...so you'll have to use an UPDATE SQL statement to update the password and send a new one.
  23. Appreciated frost. Sometimes...it's late...and I forget all about doin' a drill-down in the right way...start lookin' for error messages...heh. It's an old habit that I need to break out of. Anyway...after drilling down the exact problem, it seems that: If I attempt to change the 'from' portion of the header, my send fails. Otherwise, it succeeds. Is there any type of setting I should be looking for that forces a send from a particular address and causes a failure if there is an attempted change?
  24. Here I go again...mail() seems to be the hardest PHP function in the world to get working right (at least for me)... Here is my code for the entire page: <?php $terms = explode(",",$_POST['terms']); //a CSV from a form previous $sendto = explode(",", $_POST['boxarray']); //another CSV from a form previous if(!$terms[0]) $terms[0] = 0; //fixing the terms array to always send at least a 0 for receiving code if(!$terms[1]) $terms[1] = 0; if(!$terms[2]) $terms[2] = 0; if(!$terms[3]) $terms[3] = 0; $csvlist = $_POST['intvl'].",".$_POST['price'].",".$terms[0].",".$terms[1].",".$terms[2].",".$terms[3].",". $_POST['prop'].",".$_POST['integrate'].",".$_POST['auto'].",".$_POST['index']; $eol="\r\n"; $fromaddress = "my@address.com"; //I actually have my email in there...just takin' it out for everyone. ini_set ("sendmail_from","my@address.com"); $headers = 'From: Co<'.$fromaddress.'>'.$eol; $headers .= 'Reply-To: Co<'.$fromaddress.'>'.$eol; $headers .= 'Return-Path: Co<'.$fromaddress.'>'.$eol; $headers .= "Message-ID: <".$now." Server@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $notice = "Configuration changes sent to: "; for($x = 0; $x < count($sendto); $x++) { $key = $sendto[$x]; $sendaddress = $key."@myaddress.com"; if($key != "" && $key != NULL) $sent = mail($sendaddress,$av,$csvlist,$headers); //I know it's redundant, but I wanted to be sure anyway. $notice.=$key."@myaddress.com "; if($sent == FALSE) $notice.=" SEND FAILED "; } ?> No matter where I try to send my e-mail, it fails automatically. I should also note that the $av subject variable is not 'blank'...it's defined on an Index page that calls this function page with an include. Hosted on a Bluehost.com server... PHP 5.1.6 Linux Apache 1.3.37 PERL 5.8.7 Default sendmail path.
  25. Thank you. I'll try that out. Actually...it ended up being that the word 'interval' is a reserved word for MySQL...plus the date quote. FUN...haha! Thanks for lookin' over that and catching the date quote. Definitely appreciated.
×
×
  • 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.