premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Are you wanting to have it login you in on your computer, or to just simply log you in to keep an account active? Because if you are wanting it to log you in on your local computer, I doubt you can do it, unless you possible use cURL and can tell a browser locations to search for cookie files (which I do not know if it will do). But you may want to look into cURL, which should have more functionality and provide you with better means of controlling / receiving data getting sent to the site.
-
Well, the multiple str_replaces do not work because you never assign the replaced variable back to $Garage. The first one does not work because you have [ ] around the words in the replace array. Remove those brackets and it should work just fine for ya.
-
You will notice that I switched the double quotes to single quotes. This takes the $ character literally and does not try to evaluate it to a variable.
-
define("Crypt_Pass", '$1$5qnOJOnp$l9I4JFRt/a42BRqjrede5.'); Should fix it. $ inside of double quotes gets eval'ed. Your other server just didn't report notice errors, this one does.
-
How I would do it: Each student as a login, they must login before they upload. When they upload the data is stored in "their folder" a custom php.ini should be used in the "upload" folders which limits what functions are allowed to use, IE: deny them to use cURL / fopen / file_get_contents / open_basedir / chdir / fwrite / fputs / fgets / exec / system / eval / set_time_limit / ini_set / file_open_url should be false (to prevent including of remote files) There may be others you want to add to that list, but as long as the server supports custom php.ini for a folder it should trickle down (test before going live obviously). The issue, as you are well aware of it seems, is that an infinite loop (accidental or maliciously) can cause the server to crawl / hault. You may want to set the script execution / timeout limit to be 20s instead of the default 30s for this reason. But this probably will effect the majority of the students, so be aware of that. As for the harmful being only to that directory, well as long as you take the precautions to not allow them to read in any file data, write any file data, change directories...then yes, technically speaking (given no other loop holes) it "should" be fine. But this will limit to what the students are being taught / are able to test. Along with all that, you can also setup each student with their own "directory root" or "Location" I am not sure which one is the one you want but googling can help, using the httpd.conf / virtualhosts file. This way when they browse to say Webserverip/studentname they are locked to that directory and it acts as a root to prevent malicious file manipulation. The main thing is though to keep a running log on the server of who logs in etc (which should be done by default in apache) then you can get the IP / what action was taken by the users etc / who uploaded what code. (You could even code this into the upload portion). But in the end it all depends on how proactive you want to be.
-
You have to provide us with better feed back rather than: "I tried but still not working" How are we suppose to help debug something we cannot see? What is the source code of the page the images are being echo'ed on? Is the img tag getting structured properly? Is that img code I posted above in the same php script (or a script that accessed via include?) Too many unknown variables for us to give you accurate further help.
-
Well the SMTP could be auto setup to append an email address to anything with an invalid from address. But if it is coming from a form, why not do a "fake" no-reply email address IE: $headers = "From: $name <no-reply@yourdomain.com>"; // .... $result = mail($to, $subject, $msg, $headers, "-fno-reply@yourdomain.com"); Given that they should not reply to the email. If you want them to, then put your real email in there or something. But putting in a place holder like that is common, and tends to work just fine. But I do not know what your needs are so yea. Just an idea.
-
No, it is not possible. I would not try to re-create it, instead I would sulk because you cannot re-recreate it. (/sarcasm)
-
$headers = "From: $name <emailshouldbe@here.com>"; Maybe if you have a valid email address in there it may work alright for ya. It is optional, but given that he is using $name, and $name probably is not a valid email address. That is probably why that makes the email never send. The -f should be followed by a valid email address, not a name etc. As an FYI to the OP
-
....wow. CV Admitting he was wrong to scold a user...must be a forum first / milestone. Wheres the beer?!?!?!
-
PHP 5 not loading with apache
premiso replied to bmw57's topic in PHP Installation and Configuration
A few questions: 1. Are you browsing through Localhost? 2. Is the file in question located in the htdocs folder? 3. Is the file extension .php or .phtml? 4. After modifying the httpd.conf did you restart the server? From the sounds of it you are doing everything right but not knowing or having access to the server it is hard to say what you could be doing wrong. -
Database will be faster than a textfile, as that is what they were designed for...to store data. Flatfiles will be loads slower as they are not designed to be used as a database.
-
Automatically sending variables when submitting a form?
premiso replied to zartzar's topic in PHP Coding Help
Why not just use an auto_increment attribute on the id column field of the table? That is sort of the point of them. -
<img src='<?php echo $hbanner; ?>' width='723' height='306' alt='Center 4 IVF' border='0'> Would be the proper way to echo a variable in the html body.
-
syntax error unepected t constant encapsulated string
premiso replied to jeff5656's topic in PHP Coding Help
$qq = "select service from services where id = '". $userarray['id'] ."' LIMIT 1"; You forgot the = after $qq -
http://www.php.net/manual/en/language.variables.scope.php Variable Scope is what you want to read up on.
-
How is the css formating being displayed, via inline css or a linked css?
-
Have you tried running the script on your own (given that you have ssh access) to make sure that it runs and parses just fine. You could have an error in the script and that is why. You can "redirect" the output from that into a log file to test this as well: */5 * * * * /usr/bin/php -q /home2/aircborg/crons/cron-backup.php > /tmp/cron_log.log Which should redirect the output to that log file where you can view it to see if there was an error etc.
-
You could, but people tend to not do this in that it is a potential security issue. Given that you should know exactly how your data is suppose to be passed to the script, so why have a "catch-all" to retrieve it? Better to code it to your needs. In an instance where you are expecting $_POST or $_GET data, as in confirmation email hashes, $_REQUEST is fine because you expect either or. But if your form is POSTing, you do not want to grab the data from $_REQUEST, because you know it should be posted and this helps "validate" (I use this term loosely as forms are easy to fake) the code and it also helps debugging so you know what form it is potentially coming from etc. Also, $_REQUEST contains more than just the $_POST / $_GET data. It also includes $_COOKIE data, which can be overwritten by $_POST / $_GET(or vice versa see the link below for the order in the 3rd notation) and, as stated above, create a potential security hole in your script. Hence why they have them broken out into separate arrays and why you should stick to using the superglobal array where you expect the data to be coming in from. http://www.php.net/manual/en/reserved.variables.request.php
-
Ereg is depreciated. It is better to use preg_match which would be the equivalent. As for what the special characters are, well see my signature for links to resources on Regular Expressions. if (!preg_match('~^[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,10}$~', $phone)) { Would be the "equivalent" to what you are doing. The ~ are delimiters, it does not have to be ~ it could be # / etc depending on your taste. The $ denotes the end of a string and the ^ denotes the start (when not used inside of parans). So the start of the string has to start with 3 numbers 0-9 and the end has to end with 1-10 numbers 0-9 or else it is not matched.
-
Calling PHP script through shell (won't use GD)
premiso replied to trix21's topic in PHP Coding Help
You can do that, or just create a Symbloic link to the php5 folder. Since that is not working, you can just copy the php.ini that the browser uses to the cli location and use that instead. Which should point to the correct extension DIR etc. Not sure if this is a good "idea" to do, but should work none the less. -
Calling PHP script through shell (won't use GD)
premiso replied to trix21's topic in PHP Coding Help
Never encountered. http://www.somacon.com/p447.php Plus other google searches for that may help you figure it out. -
Calling PHP script through shell (won't use GD)
premiso replied to trix21's topic in PHP Coding Help
It is using a different php.ini file for the CLI. Find out where your browser is point to (ie which .ini file using phpinfo then use this to call the script: php -c /path/to/for/browsers/phpini/ myscript.php The -c does: -
That's why the word was wrapped in double-quotes! Oh! Well to answer the OP's question, you should really look at the filemtime in that script, I think that is the problem!