Jump to content

Fadion

Members
  • Posts

    1,710
  • Joined

  • Last visited

Posts posted by Fadion

  1. Basically, HTML uses <br /> while the textarea uses \n. When for ex u enter some text from a textarea in a database, retrieving that data from the db u would have smth like 'text\ntext\ntext'. To convert all the newlines in html brakes u can use the nl2br function. Pretty easy:

     

    echo nl2br('this is some\ntext');

  2. It is an extension not a class or smth so it has to be install. If u have a shared host theres no way for your hosting provider to install it, only if they already have it installed which i doubt to be the case. U need a server for this. Also i never had the need to use it so i cant tell, but from what i read in their website, it also supports quick time, so im guessing it has a vast format support.

  3. U can do it simple with mysql so why chosing another method. Maybe a flat file (.txt) can make the work and im sure u can find a lot of good tutorials in the net. Still i'd prefer the database method.

  4. Actually i was experimenting with this script and thought to expand its capabilities a bit. Anyway u guys gave me some great ideas.

     

    Thorp, im not a linux pro, but i tried 'whoami' and the user is 'apache' who doesnt have write privileges. Also im not going to realease this script to the end user  :)

  5. Thnx for the reply m8, but actually it cant work like that. exec() passes its lines to an array and what it shows is just plain text, so using is_file over a string cant get any results. Anyway thnx, hope someone has got any idea.

  6. I am making a simple php script using exec() to execute commands in my linux host. When i execute 'ls' it shows the right content on that directory, but what i want to know if there is a way i can distinguish between folders and files. In this way i can lets say make folders show in black and files in grey. Also when i execute a wrong command i wanna get any system error message. If these are possible it would be great if someone helped me.

     

    The actual code im using, just to give an idea:

     

    if(array_key_exists('command', $_POST) and strlen($_POST['command']) > 0){
    $command = $_POST['command'];
    exec($command, $arr);
    foreach($arr as $value){
    	echo $value . "<br />";
    }
    }
    

  7. $sql="INSERT INTO flights (CompanyName, PilotName, FlightID, FlightDate, AircraftName, NbrPassengers, CargoWeight, DepartureIcaoName, ArrivalIcaoName, TotalDistance, TotalBlockTime) VALUES ('None', '$valid_user', '$fltnbr', '$fltdate', '{$_POST['plane']}', '{$_POST['passengers']}', '{'$_POST['cargo']}', '{$_POST['depart']}', '{$_POST['arrival']}', '{$_POST['distance']}', '{$_POST['hour']}' . '{$_POST['minute']}')";
    

     

    also mysql_query should be mysql_query($sql)

  8. There's no way u can decrypt it. First i thought u were going to hash only the file extension and like that u can do it comparing the hash with md5('gif'), md5('jpg') etc. Dont know any way to handle this and i cant think of why u are hashing the filename.

  9. No the $_FILES superglobal is for file uploads, in this case u must use $_GET. Take this sample code:

     

    $id = $_GET['id'];
    $query = mysql_query("SELECT * FROM table WHERE id='$id'");
    $values = mysql_fetch_array($query);
    echo $values['name']; echo $values['age'];
    

     

    When u open 'edit.php?id=5', the id=5 part is a variable 'id' which is assigned the value '5'. U get that id with $_GET and just make a sql query to show the results for that row. Hope u got it now.

×
×
  • 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.