Jump to content

dmallia

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by dmallia

  1. So i am building an admin page as part of a project for the course I am doing. I want to execute the remote command "top" (it doesn't matter if i execute it by php ssh connection) on linux and than I want to store the output of the command in a variable called $data. Is that possible? I tried doing it with shell_exec() and exec() but couldn't get it to work. Thanks before hand.

  2. what's the best solution to secure it? should i only run the script if the page is a page that exists in the directory of the web? file_exists() or i store all the page names in an array and check if it exists in the array?

  3. so i made this script and it seems to be working fine. index.php

    <?phpecho '<a href="/index.php?page=news">News</a>';echo '<a href="/index.php?page=about">About Us</a>';if (empty($_GET['page']))  {   $inc = 'news.php';  }else  {   $page = $_GET['page'];   $inc = $page.'.php';   if (file_exists($inc))	{	 include $inc;	}   else	{	 $inc="news.php";	 include $inc;	}  }?>

    about.php

    <?phpecho '<p>About US</p>';?>

    news.php

    <?phpecho '<p>News</p>';?>

    do you think it's secure? what do you think i can add to be more secure?

  4. I don't want to do seperate pages using the include. I want to have an index.php than inside of it I include the content according what the user chose from the menu. I want a script that will be in the index.php file, that gets the information of the page the user chose from the menu and than includes it in the index.php file.

  5. I would like to do a script that includes content from pages according what the user chooses. Example If the users chooses Contact us from the menu I would like to have the index page displayed with the contact us content( www.website.com/index.php?page=contact-us ). I know it is done by GET requests but don't know how to do it or what is it called. Does anyone have a script or a tutorial on how to do it? Or at lest what is it called so I find a tutorial. Thanks before hand.

    • Like 1
  6. I have this php script stop.php

    <?phpinclude('ssh_con.php');$stop = 'screen -S testapplication -X quit';ssh2_exec($con, $stop);mysql_query("UPDATE servers SET Online=0 WHERE Owner='".$_SESSION['Username']."'");echo "<meta http-equiv='refresh' content='0;index.php'>";?>

    now i want to execute/call/get this page/script using javascript onclick to execute the code and the page refreshes itself. Can anyone guide me to do this? Thanks before hand.

  7. So i have these 2 forms.

    <form method="post" enctype="multipart/form-data"><input type="submit" name="start" value="Start" /></form>

    and

    <form method="post" enctype="multipart/form-data"><input type="submit" name="stop" value="Stop" /></form>

    now i need a script that when the start button in form no.1 is pressed the page refreshes and includes form no.2 with the stop button and than if the stop button is pressed it includes the start button. I tried to made this script.

    if ($server['Online'] == 0)	 {		  echo "<meta http-equiv='refresh' content='0;url=start.php'>";	 }else	 {		  echo "<meta http-equiv='refresh' content='0;url=stop.php'>";	 }

    but it is only including the forms, I would like to stay on the index.php and change the content in the div. The scripts needs to fit in the script below

    <?php	    if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))			    {   include('db/get_data.php');					   //**SCRIPT HERE**//			    }	    elseif(!empty($_POST['username']) && !empty($_POST['password']))			    {					    $username = mysql_real_escape_string($_POST['username']);					    $password = md5(mysql_real_escape_string($_POST['password']));   					    $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'");   					    if(mysql_num_rows($checklogin) == 1)							    {									    $row = mysql_fetch_array($checklogin);									    $email = $row['Emailaddress'];									    $_SESSION['Username'] = $username;									    $_SESSION['Emailaddress'] = $email;									    $_SESSION['LoggedIn'] = 1;									    echo "<meta http-equiv='refresh' content='0;index.php'>";							    }					    else							    {									    echo "<h1>Error</h1>";									    echo "<p>Sorry, your account could not be found. Please <a href=\"index.php\">click here to try again</a>.</p>";							    }			    }	    else			    {?>					    <h1>Member Login</h1>					    <p>Please login below.</p>   					    <form method="post" action="index.php" name="loginform" id="loginform">							    <fieldset>									    <label for="username">Username:</label><input type="text" name="username" id="username" /><br />									    <label for="password">Password:</label><input type="password" name="password" id="password" /><br />									    <input type="submit" name="login" id="login" value="Login" />							    </fieldset>					    </form>   <?php			    }

    any ideas on how i can do it? Thanks before hand

×
×
  • Create New...