
ChemicalBliss
Members-
Posts
719 -
Joined
-
Last visited
Never
Everything posted by ChemicalBliss
-
It sort of tells you on that page but you would edit the "src" attribute. Wherever you put your video page, must have a relative path to your video from that page. For ex. Video page will be called "index.php" Video will be "test.mpeg" /index.php /some/path/to/test.mpeg If you have a relative path such as: some/path/to/test.mpeg It will work fine. However, If you index was in another folder for ex. /mysubwebsite/index.php /some/path/to/test.mpeg The relative path would need to be: ../some/path/to/test.mpeg --------- To actually insert the path, you would use an echo, with the variable that holds that path: <?php // This code goes BEFORE the player code $mypathtovids = "/some/path/to/"; $myvid = "test.mpeg"; ?> ... player code... src="<?php echo $mypathtovids, $myvid; ?>" .. the rest of the player code...
-
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
ChemicalBliss replied to cactus's topic in PHP Coding Help
Notices are informational, they are not errors as such. They can however point towards a logic error you may have overlooked. Anything like: "Notice: Undefined ..." This means that what it says (in this case the "index" named "username") does not exist before that point/line. To get rid of the error, you have two options in all of these cases: 1. Declare the index/variable before hand (create it) 2. Check if that variable/index actually exists using "isset()" I would use the latter in this case as the variable needs to come from a user, so a simlpe check will do: In your IF statements for the username and passwd, check if they are set (isset()) BEFORE you check what their value is, and this can be in the same if statement. This is good practice to do this. I am glad you have notices turned on though and good job for wantnig to get rid of them even though (im assuming..) this code works fine. -
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
ChemicalBliss replied to cactus's topic in PHP Coding Help
Is that when you submit data through the form? (the page it gives you after you click submit) If it is, are you using any other files or forms other than the single code you posted above? if not, and you still have a problem, can you give us the exact error copy+paste? -
I would ask this question in an ubuntu specialist forum, maybe someone there can shed some light on this. I know it's not the code, it is definitely something with your system software/configuration.
-
I don't know but if that is indeed the code I garuntee 110% it is not that script. Perhaps google some info about those browsers and how they store passwords. Btw, i hope by "history" you mean "data", since history in browsers is usually just the page caches and not stored cookies or passwords etc.
-
There are no value attributes in your html so it is _not_ the html (php output) that is creating those stored values. It must be your browser. You can implement this feature using cookies (more permanent session for example) for every browser using php to save form data or w/e from that user (could be lengthy and mysql reccommended). or if you go the other route you can blank all fields by a) putting value="" in each input text/password element and b) add no-cache headers to the response via php header(). Note* also, the reason it only works on certain "routes" to the website (ip's for example), is because you have only submitted the data via the domain that it works on (in this case you have only logged-in on localhost, or, logged in AND chose to save the user/pass - usually browsers give you this option). To test this, login on a browser you know it works on localhost, go to the ip equivalent (127.0.0.1), and log in, now once you logout and refresh it should save the data for that domain too.
-
Sorry, just for clarification; Do you mean localhost stores usernames and passwords from forms (like firefox and ie etc on pc's)? Or are you saying that you do not need to specify a user/pass when using mysql_connect() on a localhost request, rather than a direct IP request? Former: Browser dependant, try different browsers. Latter: Specify the user/pass, or alternatively: [*]check your php.ini for the default user/pass it uses and make sure that user/pass exists and has access [*]check that mysql allows the user mentioned in php.ini access mysql via those ip-addresses - (host,user,pass) Usually though for the latter, php would use the default "root" account, for which usually only "localhost" is allowed as a hostname. Perhaps your trying to specify an ip-address in the mysql_connect() call, just use localhost if so and it should be fine. To add hostnames to a mysql user, check google. it is only a few commands but I dont know them off-by-heart.
-
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
ChemicalBliss replied to cactus's topic in PHP Coding Help
Read my post more carefully and understand what i told you to do Tell us what the print_r gives. (easier to read in page source) -
Hmm.. Well using all of the input from all the users on this topic it works for me: /index.php <?php include "objects/classloader.php"; $obj1 = new object1(); $obj2 = new object2(); $obj3 = new object3(); ?> /objects/classloader.php <?php //DEFINE AUTOLOADER function __autoload($className) { $file = 'objects/' . $className . '.php'; if (file_exists($file)) { require_once $file; return true; } return false; } ?> /objects/object1.php <?php class object1{ public function __construct(){ echo(get_class($this)); } } ?> /objects/object2.php <?php class object2{ public function __construct(){ echo(get_class($this)); } } ?> /objects/object3.php <?php class object3{ public function __construct(){ echo(get_class($this)); } } ?> Does this work for you?
-
I see no variables in your query, your query therefor never changes and so your data is always the same regardless of what forum. How are you using this? ie. Are you putting it in the actual forum list generation code? or template code? you need to know which forum you want to get the topics from (WHERE clause).
-
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
ChemicalBliss replied to cactus's topic in PHP Coding Help
Always debug your code so you know that it is working exactly how you want, ie - all the variables should be exactly what you expect them to be. use combinations of echo and print_r calls. eg: <?php session_start(); print_r($_POST); // This will appear at the top of this page. It will contain every variable passed via a form that used the POST method. if (isset($_REQUEST['logout'])) { session_unset(); } if (isset($_POST['submitUpdate'])) { if (get_magic_quotes_gpc()) { $_POST = array_map('stripslashes',$_POST); } $fc = file_get_contents($_POST['file']); // truncate file $fw = fopen($_POST['file'], 'w+'); $text = explode("<!-- EDITABLE -->",$fc); $newText = $text[0]."<!-- EDITABLE -->".htmlentities($_POST['content'])."<!--EDITABLE ->".$text[2]; if (fwrite($fw, $newText)===FALSE) { die("Cannot write to file."); } fclose($fw); exit("<div><span class='redText'>The file has been updated. Click <a href=\"index.php\">here</a> to go back to admin page.</div>"); } if (isset($_POST['Submit'])) { if (($_POST['username'] == 'admin') && ($_POST['passwd'] == 'xyz')) { $_SESSION['username'] = 'login'; } else { echo "<b>You login details is not correct. Pls login again</b>"; } } if ($_SESSION['username']=='login') { if (isset($_REQUEST['file'])) { $fc = file_get_contents($_REQUEST['file']); $text = explode("<!-- EDITABLE -->",$fc); echo "<form method='post' action=''><textarea name='content'>$text[1]</textarea>"; echo "<p><input type='hidden' name='file' value='".$_REQUEST['file']."' /><input name='submitUpdate' type='submit' value='Update Page'></form>"; } else { // edit to link to your own static html files echo "<p align='center'> <a href='body/recentnewsbody.html'>Recent News</a><br/> <a href=''>Parents</a><br/> <br/> <em>Click on the links above to edit the files.</em><br/> <a href='staff.php'>logout</a></p>"; } } session_destroy(); ?> <form method="post" action=""> <table width="400" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td>Username: </td> <td><input type="text" name="username"></td> </tr> <tr> <td>Passwd: </td> <td><input type="password" name="passwd"></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </form> -
Check your paths. <?php //DEFINE AUTOLOADER function __autoload($className) { if (file_exists('objects/'.$className . '.php')) { require_once 'objects/'.$className . '.php'; return true; } return false; } ?>
-
What program do you write your php code in?
ChemicalBliss replied to cunoodle2's topic in Miscellaneous
In your opinion. I use vim, and all changes are tracked and branched through Git. Yes all opinions of course. Every IDE is slightly different, and you usually have to learn the interface to use it fully, finding features as simple as search/replace can be longer than expected in an otherwise unknown IDE. Notepad++ is a very neat and small package with limited features, it helps new users learn simply because it has less features - coding manually instead of auto-completion will help a lot in the long run. If you're making a guestbook etc, use a lightweight editor, else if your looking to build a sizable project such as a forum or content management system then you should use a more extensive IDE. Most features of advanced IDE's will seem completely unknown to you until you learn more PHP such as OOP concepts and MVC style Frameworks etc. Try them all, and find one your comfortable with, there are plenty of sites on google that has tables of the latest IDE's with a feature-set to compare what you want/need. hope this helps -
It depends on exactly how "unique" your code is and how reproducable it is. There is no point in patenting a binary operation for example, or even a guestbook that allows people to mark tgheir location on a map - these things are too "general" and can be implemented uniquely almost infinite ways. Copyrighting code should be enough. If you find someone else has "copied" your idea, you check their binary/code to see if it is similar to your own, tehre are analysts that can do this for you and if you find that certain parts were copied then you can sue for copyright infringement - which will show any other would-be copyier that you mean business. Basically - You can't patent something that inherently cannot be unique. (code/software). You can copyright and protect it. Through enforcement and legal processes. hope this helps
-
What program do you write your php code in?
ChemicalBliss replied to cunoodle2's topic in Miscellaneous
Depends entirely on your project size and complexity. for small simple projects or learning to code: notepad++ for larger projects with maybe 2 or more people involved you'll want a complete IDE package such as eclipse to organise the project and keep it clean. -
the "mb_" part of the name denotes it is part of the "Multi-Byte" extension: php.net/mb_string The MultiByte Extension needs to be enabled in the PHP.ini. hope this helps