
maxudaskin
Members-
Posts
628 -
Joined
-
Last visited
Everything posted by maxudaskin
-
What are the other benefits other than that?
-
So basically, if you know C++, it is just like having a set of curly brackets, it is for namespace issues?
-
Ok I Went to Die This Var and I got an Error In my DB_CONNECT
maxudaskin replied to Dethman's topic in PHP Coding Help
The game could have created the function getSysteminfo -
Why would $A->Foo work but not A::Foo?
-
Sorry... didn't post the code... <?php class A { function foo() { if (isset($this)) { echo '$this is defined ('; echo get_class($this); echo ")\n"; } else { echo "\$this is not defined.\n"; } } } class B { function bar() { A::foo(); } } $a = new A(); $a->foo(); A::foo(); $b = new B(); $b->bar(); B::bar(); ?>
-
In this PHP.NET code, does the A::Foo not work because you are calling foo without... umm -> allows for $this to be used while :: does not?
-
What other benefits are there?
-
I did. So the only reason to have a class is to allow for the variable to be used again without worries?
-
I still don't get it. Can you give me a practical use?
-
I still don't see the point. Why not just set the variables in the page?
-
I still do not understand what a class does and why it should be used. Please explain it's use(s) and if needed, compare it to other PHP functions and features. Max
-
Try this: <?php function validateusername($val){ global $continueSubmit ; $result = mysql_query("SELECT * FROM `user` WHERE `username` = '$val' LIMIT 1"); $numrows = mysql_num_rows($result); $userlen = strlen($val); //check for blank username if($val == ''){ $continueSubmit = false; echo "<img src=\"/images/bad.gif\" alt=\"Bad\"> Field Required"; } else if($numrows > 0){ $continueSubmit = false; echo "<img src=\"/images/bad.gif\" alt=\"Bad\"> Username in use"; } else if($userlen > 50){ $val = false; echo "<img src=\"/images/bad.gif\" alt=\"Bad\"> Username Too Long. Please enter a username between 5 and 50 characeters."; } else if($userlen < 5){ $val = false; echo "<img src=\"/images/bad.gif\" alt=\"Bad\"> Username Too Short. Please enter a username between 5 and 50 characeters."; } else { //everything ok with username echo "<img src=\"/images/good.gif\" alt=\"Good\">"; } } ?>
-
you spelled mysql_num_rows as mysql_numrows
-
Change usernameTaken to: function usernameTaken($val){ $result = mysql_query("SELECT * FROM `user` WHERE `username` = '$val' LIMIT 1"); return (mysql_numrows($result) > 0); }
-
Nvm... I can just add in another if statement...
-
<?php if(isset($_POST['login'])){ // If Login Form was Sent if(empty($_POST['user'])){ echo "You have not provided a username."; } if(empty($_POST['pass'])){ echo "You have not provided a password."; } // If user or pass are empty, exit if statement // More code including if statements } ?>
-
Is it possible to break out of an if statement? I cannot use die because it finishes the execution of the whole page. How can I exit from one if statement?
-
I don't understand... ???
-
Russian showing up as ???? in php from mysql
maxudaskin replied to Looktrne's topic in PHP Coding Help
htmlspecialchars_decode() http://ca.php.net/manual/en/function.htmlspecialchars.php http://ca.php.net/manual/en/function.htmlspecialchars-decode.php -
I take a one week break from PHP and look what happens. <?php include("./constants.php"); $stylesheet; // Set Variable for Later Use if(!file_exists("styles/style.txt")){ echo "<strong>An Error Has Occured: Cascading Style Sheet Setup File is Corrupt or missing. Reverting to default style.</strong>"; // Output Warning $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default }else{ $style_text = preg_split("/\-\-\-/",implode('',file("styles/style.txt"))); // Get file contents and Split it up $folder = trim($style_text[1]); // Set the folder name $file = trim($style_text[3]); // Set the file name echo ROOTURL . "include/styles/" . $style_text[1] . "/" . $style_text[3] . ".css<br /><br />"; if(file_exists(ROOTURL . "include/styles/" . $folder . "/" . $file . ".css")){ // If the specified file exists $stylesheet = ROOTURL . "include/styles/" . $folder . "/" . $file . ".css"; // Set Style Sheet as Specified }else{ if($secondary == "default"){ $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default }else{ $folder = trim($style_text[5]); // Set the folder name $file = trim($style_text[7]); // Set the file name if(file_exists(ROOTURL . "include/styles/" . $folder . "/" . $file . ".css")){ $stylesheet = ROOTURL . "include/styles/" . $folder . "/" . $file . ".css"; // Set Style Sheet as Specified }else{ $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default } } } } ?> Style.txt This file was written by Max Udaskin. Please refer to the users manual before attempting to edit this file. Standard Folder Name --- standard --- File Name --- red --- =============== Secondary Folder Name --- standard --- File Name --- white --- Output http://www.virtualzoom.net/pirepdemo/include/styles/ standard / red .css Note the spaces. What I want it to do is: http://www.virtualzoom.net/pirepdemo/include/styles/standard/red.css
-
Russian showing up as ???? in php from mysql
maxudaskin replied to Looktrne's topic in PHP Coding Help
When inserting, try using HTMLSPECCHARS. http://ca3.php.net/manual/en/function.htmlspecialchars.php -
I want it to get a proper URL for later use. Source Code: Constants.php define ( "ROOTURL" , "http://www.virtualzoom.net/pirepdemo/" ); // Root URL <?php include("./constants.php"); $stylesheet; // Set Variable for Later Use if(!is_readable("styles/style.txt")){ echo "<strong>An Error Has Occured: Cascading Style Sheet Setup File is Corrupt or missing. Reverting to default style.</strong>"; // Output Warning $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default }else{ $style_text = preg_split("/\-\-\-/",implode(" ",file("styles/style.txt"))); // Get file contents and merge it; Split it up $standard = $style_text[1]; // Set The Standard Style Sheet $secondary = isset($style_text[2]) ? $style_text[2] : "default"; // Set The Backup Style Sheet (Optional) $folder = preg_replace("/\{folder_name\}\=\"(.*)\"/","$1",$standard); // Set the folder name $file = preg_replace("/\{file_name\}\=\"(.*)\"/","$1",$standard); // Set the file name echo ROOTURL . $folder . "/" . $file . ".css"; echo "<br />"; if(is_readable(ROOTURL . $folder . "/" . $file . ".css")){ // If the specified file is readable $stylesheet = ROOTURL . $folder . "/" . $file . ".css"; // Set Style Sheet as Specified }else{ if($secondary == "default"){ $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default }else{ $folder = preg_replace("/\{folder_name\}\=\"(.*)\"/","$1",$secondary); // Set the folder name $file = preg_replace("/\{file_name\}\=\"(.*)\"/","$1",$secondary); // Set the file name echo ROOTURL . $folder . "/" . $file . ".css"; echo "<br />"; if(is_readable(ROOTURL . $folder . "/" . $file . ".css")){ $stylesheet = ROOTURL . $folder . "/" . $file . ".css"; // Set Style Sheet as Specified }else{ $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default } } } } echo $stylesheet; ?> style.txt This file was written by Max Udaskin. Please refer to the users manual before attempting to edit this file. --- <standard>{ {folder_name}="standard" {file_name}="red" } --- <secondary>{ {folder_name}="standard" {file_name}="white" } Output http://www.virtualzoom.net/pirepdemo/ { {folder_name}="standard" {file_name}="red" } / { {folder_name}="standard" {file_name}="red" } .css http://www.virtualzoom.net/pirepdemo/ { standard {file_name}="white" }/ { {folder_name}="standard" white }.css http://www.virtualzoom.net/pirepdemo/include/styles/default/default.css I think it is my parsing in Preg_Replace.
-
It may be disabled on your server.
-
No, it is not a mid-term. I am in summer. I am trying to figure out how to use classes.