
aeonsky
Members-
Posts
120 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
aeonsky's Achievements

Member (2/5)
0
Reputation
-
Please disregard my question. I forgot I can use toString on each object and store it in a string. In class B's toString, I can just return that string.
-
How do I make this simple example work, with multiple toString methods. In class A, you instantiate class B, and print a B object using B's toString method. However, the B object contains multiple instantiated class C objects. Class C has its own toString method. Here's what I did, in class B I just System.out.print() all class C objects (thus using C's toString method) and returned "" at the end of B's toString method. Is there a better way to do it?
-
Seems I missed a few... 5. Abstract classes 6. Interfaces
-
Hello, I'm studying for my ZCE exam and had this question. Is this list correct, that I compiled, in describing the major changes in OOP from PHP4 to PHP5. 1. Visibility (PPP) 2. Inheritance 3. __construct && __destruct 4. Static methods and properties None of the books I read, gave a straight list (wasn't really expecting to find one) and couldn't find something like this on the web.
-
Hello! Since I'm currently training for my PHP certification exam, I decided to try out Ruby on Rails. I'm somewhat familiar with Ruby (wrote few dozen scripts), but I have never tried to use Rails yet. I setup Ruby, RubyGems, MySQL, and can run WEBrick fine. I followed this tutorial: link. When I get to: http://localhost:3000, the main page shows up correctly. Link. However, when I try to view my application by visiting http://localhost:3000/hello, I get an error page. Link. Anyone know why this might be happening, maybe the tutorial is wrong? Thanks for the time.
-
[SOLVED] Would like my first oop object to be checked
aeonsky replied to Potatis's topic in PHP Coding Help
Can't you just use 'or die();' when connecting? @ is significantly slower. -
I just made one... index.php <?PHP include("ClassOne.php"); ClassOne::function_two_in_Class_One("test"); ?> ClassOne.php <?PHP class ClassOne { public function function_one_in_Class_One($lol) { print $lol; } public function function_two_in_Class_One($hmm) { $this->function_one_in_Class_One($hmm); } } ?> It everything correct? I think it is, but it does not work. This works... ClassOne::function_two_in_Class_One($hmm); Gives me this error... Fatal error: Using $this when not in object context in C:\Users\Skynorth\Desktop\Localhost\bug\ClassOne.php on line 13 What do you think? P.S. - I think I got what the problem is. I think once you use a Paamayim Nekudotayim, it treats the related function as if it was outside the class and thus, all the function inside the class are not accessible anymore. I read the page on www.php.net on Paamayim Nekudotayim, but it doesn't not say anything about this issue.
-
I have this in Content.php (Content class)... public function get_adj_menu_width($full_url) { $dim = Viewer::get_dim_img($full_url); $adj_width = $dim[0] + 2; return $adj_width; } get_dim_img() exists only in one class - Viewer class. I call get_adj_menu_width() in the same Content class... public function print_menu_header($manga, $chapter, $page, $menu_array) { if(!$page) echo '<div class="usual" style="width: '.$_SESSION['default_width'].'px"><ul class="idTabs snow">'; else { $adj_width = $this->get_adj_menu_width("$manga/$chapter/$page"); if($adj_width < 600) $adj_width = "600"; echo '<div class="usual" style="width: '.$adj_width.'px"><ul class="idTabs snow">'; } It is not terribly important to me, but I've always used $this-> when I'm in the same class. I guess just a matter of being consistent. By the way, thanks for looking into this problem. P.S. -> I'm thinking its a PHP bug because I read of stories that when people used a lot of function calls in function calls in another classes (I know it sounds random, and it is) they get the same kind of error that I did. And I went through the code 50 times, I do not believe that any of it is wrong.
-
class Viewer { public function get_dim_img($full_url) { $size = getimagesize('./'.$_SESSION['manga_directory'].'/'.$full_url); return $size; } public function print_image_with_black_div($picture) { $dim = $this->get_dim_img($picture); //LINE 16 $width = $dim[0]; $height = $dim[1]; print "\n\n<div style=\"width: {$width}px; height: {$height}px\" class=\"black_b\">"; echo "<img src=\"index.php?p=$picture\" border=\"0\">"; echo '</div>'; } } This works... Viewer::get_dim_img($picture); But this doesn't... $this->get_dim_img($picture); I get this error... Fatal error: Call to undefined method Content::get_dim_img() in /home/sorascan/public_html/smv/code/classes/Viewer.php on line 16 The only place where I call print_image_with_black_div is in viewer.php (different file, not Viewer.php)... if($page) Viewer::print_image_with_black_div("$manga/$chapter/$page"); else Viewer::print_default_text(); I am very frustrated and do not know why $this doesn't work when calling another function within the same class. Any help would be appreciated, thank you!
-
You may have magic_quotes enabled. http://us3.php.net/magic_quotes
-
Ok then, but its you didn't set it to anything... How about... $color_user = $_POST['color_user']; I'd also would like to discourage you from using globals. In higher level languages they are forbidden (from my experience anyways).
-
Where do you get $color_user in check(){} ?
-
The reason why I asked if it could be exploited, well not exploited, but made things to that it shouldn't is because its not regex (less control). And I just found one... Take this line for example: lol:9cdfb439c7876e703e307864c9167a15* By the way md5("lol") equals "9cdfb439c7876e703e307864c9167a15" If you enter "ol" as username and "lol" as password, you still get entered as user "lol". Can anyone help with a solution (without using regex)? Now that I think about it, it is not terrible that it does that since if there was a user called "ol" he would have a different password anyways. But if they somehow ended up with same passwords, all these users have same privileges. However, I still like for it to somehow be solved. Thank you!
-
I have a login script that checks for a correct username and password from a flat-file database. I was using preg_match, but I realized stripos should do the same thing but much faster. And I was wondering if this can be exploited in anyway. I tried a combination of things, but they weren't successful. public function check_login($u, $p) { $p = md5($p); $pos = stripos(file_get_contents($this->users_db), "{$u}:{$p}*"); if($pos !== false) return true; else return false; } Flatfile db <?PHP die(); ?>* lol:9cdfb439c7876e703e307864c9167a15* test:098f6bcd4621d373cade4e832627b4f6* admin:21232f297a57a5a743894a0e4a801fc3* Thanks for the time!