PHP - Problem Using Defined Document_root
Hey,
I'm in the process of making a site that involves multiple layers of folders. I have a form that uploads an image which i then try to move to the image folder using a define function using the document root + image folder but the image never gets saved to the defined location and the location isnt inserted into the sql query. Its a simple thing I want to do but since Im making a bigger site I want to maximize includes to reduce duplicate code. Include File - defines the document root Code: [Select] srvRoot = $_SERVER['DOCUMENT_ROOT']; $serverRoot = str_replace('/', '\/', $serverRoot); define('SRV_ROOT', $srvRoot); Image Upload Code: [Select] $image = $_FILES["catImage"]["name"]; $image = addImage($image, SRV_ROOT . "images/shop/img_cat"); function addImage($image, $path){ // FIX FIX FIX $fileExtension = getExtension($image); //this function works fine have tested in previous scripts so not needed $image = substr(md5(rand() * time()), 0, 10).".".$fileExtension; $imgDestination = $path.$image; if($_FILES['catImage']['type'] != "image/gif" && $_FILES['catImage']['type'] != "image/jpg" && $_FILES['catImage']['type'] != "image/jpeg" && $_FILES['catImage']['type'] !="image/png" ){ echo "You may only upload image files"; }else{ //Moves the uploaded file to destination folder via the variable which includes image filename if(move_uploaded_file($_FILES["catImage"]["tmp_name"],$imgDestination)){ return($imgDestination); }else{ header("Location: ../../home.php"); } echo $imgDestination; } } Similar TutorialsI am having trouble with passing values with a POST to another php file. I am getting the error : undefined index : productID and undefined index: filename. I have also tried : <form method = \"POST?pdib=$processID&filename=$filename\" action = \"upload2.php\" > When I look at the array of superglobals, they are both defined. Thank you! Here is the code : drawfirsttwoforms: $sql = "SELECT ProductFilename, ProductName, ProductID, ProductDescription,ProductCost,ProductQuantity, ProductCatTitle FROM products INNER JOIN customers ON customers.CustomerID = products.CustomerID WHERE ((products.ProductKeyWord1 = ?) OR (products.ProductKeyWord2 = ?) OR (products.ProductKeyWord3 = ? )) AND (products.ProductCatTitle = ?) "; $stmt = $dbo->prepare($sql); $stmt->bindParam(1, $keyword1); $stmt->bindParam(2, $keyword1); $stmt->bindParam(3, $keyword1); $stmt->bindParam(4, $titleOfSelectedDropDown); $stmt->execute(); while ($row = $stmt->fetch()) { //these variables do have values here $productID = $row['ProductID']; $filename = $row['ProductFilename']; $string1 .= " <div class = \"A\" id = \"$mainDiv\"> <p id = \"link1\">product id :$productID</p> <p>category id :$category</p> <div class = \"A\" id = \"endz\"></div> <div class = \"A\" id = \"startz\"></div> <div class=\"container\"> <div id = \"testing\" >testing <div> <div id = \"$displayID\" > </div> <div class=\"row\" > <div class=\"col\"> <form method = \"POST\" action = \"upload2.php\" > <input type=hidden id='$productID' name= '$productID' value=\"A\"> <input type=hidden id=\"$filename\" name=$filename value=\"B\"> <button value = \"Submit\" type = \"submit\" >submit it</button> </form> <iframe id=\"upload_target\" name=\"upload_target\" style=\"width:0;height:0;border:0px solid #fff;\"></iframe> <img width=\"120\" height =\"120\" id = \"$imageID\" src=\"../php proj/uploads/$filename?<?php echo filemtime($filename)?>\"> <button onclick = \"imageRefresh( '{$filename}', '{$imageID}', '{$_SESSION["msg"]}' )\" >Display</button> </div> AFTER: if (!isset($myObj) && isset($string1)) { $myObj = new stdClass(); $myObj->htmlstuff = $string1; //Encode the data as a JSON string $jsonStr = json_encode($myObj); echo $jsonStr; }
function printHTML1(keyword){ const element = document.getElementById("dropDown1"); //const checkValue = element.options[element.selectedIndex].value; const checkText = element.options[element.selectedIndex].text; var val1 = checkText; var xmlhttp = new XMLHttpRequest(); var keyword1 = keyword; var url = "drawfirsttwoforms.php?keyword=" + keyword.value + "&" + "val1=" + val1; xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var jsonData = JSON.parse(this.responseText); var answerHtml = jsonData.htmlstuff; document.getElementById("codehere").innerHTML = answerHtml; createAndModifyDivs(); } }; xmlhttp.open("GET", url , true); xmlhttp.send(); }
upload2.php <?php session_start(); $productID = $_POST['productID']; $filename = $_POST['filename'];
Hi i call $_SERVER['DOCUMENT_ROOT'] which returns C:/xampp/htdocs how would i make it return C:/xampp/ instead? Hi I have this bit of code: Code: [Select] defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); That i'm using so all systems can always find my class and important files. This works fine on on of my websites, but I have just moved it over to another website (exact setup & on same server) and it is not working!!! I'm getting the error: Warning: require_once(/includes/functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/a/d/adele/web/public_html/includes/initialize.php on line 9 Fatal error: require_once() [function.require]: Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/a/d/adele/web/public_html/includes/initialize.php on line 9 Basically, all my important files are in the initialize.php file. So I only need to call that one file on any of my html pages. I know it's DOCUMENT_ROOT, as when I remove this and link direct it works fine. Thanks for any help I am trying to figure out the exact path to my file. Right now I've been using: $_SERVER['DOCUMENT_ROOT'] This works if my file is currently uploaded into the root directory. However document root doesn't take into account any extra folders my file location might be loaded. For example: /home/users/web/b888/nf.vbpointmarketcom/public_html/forum/admin Printing out the $_SERVER['DOCUMENT_ROOT'] would only show me: /home/users/web/b888/nf.vbpointmarketcom/public_html Is there any premade function or way that I can quickly figure out what the subdirectories are as well so I can output it or assign it to a variable? Hi there, I am working on a website which has a sub-domain set as a folder and not an actual sub-domain (as my client does not want to do this which is another story). Anyway, all of my links which relate to the DOCUMENT_ROOT are not working. Example below: www.website.com www.website.com/admin - my sub-domain in a folder I can access a page within www.website.com/admin however all links to files, css files etc will not work because the DOCUMENT_ROOT does not inlcude the /admin/. My question is therefore is there some way of adding in this /admin/ step or fooling php/apache to include this in all files within the /admin/ folder. Many thanks Sim Hi I run versions of sites on a local server. For these the path to a mysql connection script is pretty simple: mysql_connec.php On my live server, I put things out of the public directory - so this time the path is ../mysql_connect.php I therefore have to have sections like this in my files = and whilst not complex, its a pain having to uncomment/comment lines depending on which server I am working because I keep forgetting! Code: [Select] // require_once('../../workRecord/mysql_connect.php'); //online require_once('mysql_connect.php'); //local Is there some way I can identify which server I am on so I don't keep having to do this. I was thinking of using something like this: Code: [Select] if ($_SERVER['DOCUMENT_ROOT']=="c:/web_root/blah/blah"){ require_once('mysql_connect.php'); }else{ require_once('../../workRecord/mysql_connect.php'); } I am pretty sure this would work, but does this method present any security issues??? Hi all. Working on a nav system using the document_root variable. I can't figure out why the links won't execute when I click them. When I mouse over a link, it shows the correct URL, but nothing happens when I click the links. The browser remains on the same page. The page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>vCTO-Home</title> <link rel="stylesheet" type="text/css" href="css/style.css" media="screen" /> <?php include($_SERVER['DOCUMENT_ROOT'] . '/php/var.php');?> </head> <body> <?php include($_SERVER['DOCUMENT_ROOT'] . "/php/t1.php");?> </body> </html> t1.php <div class="tier"> <a href="<?php echo $docroot;?>/index.php">Home</a> <a href="<?php echo $docroot;?>/demand_management.php">Demand Management</a> <a href="<?php echo $docroot;?>/engineering.php">Engineering</a> <a href="<?php echo $docroot;?>/steady_state.php">Steady State</a> <a href="<?php echo $docroot;?>/communications.php">Communications</a> <a href="<?php echo $docroot;?>/business_management.php">Business Management</a> <a href="<?php echo $docroot;?>/risk_management.php">Risk Management</a> <a href="<?php echo $docroot;?>/other.php">Other</a> </div> var.php <?php $docroot=$_SERVER['DOCUMENT_ROOT']; ?> Hi, I have a small CMS I coded and developped on my local WAMP server and everything worked fine but when I decided to export everything to my hostgator server I realized that the constants I define in some of my includes are not being defined.. Here is one of the errors I get : Code: [Select] Fatal error: require_once() [function.require]: Failed opening required 'LIB_PATHDSdatabase.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/nethox/public_html/photo_gallery/includes/photograph.php on line 2 You can see that LIB_PATH is not defined and even the .DS. is not working.. Here is a sample of the code I made : Code: [Select] <?php // Defining core paths // Defining them as absolute paths to make sure that require_once works as expected // DIRECTORY_SEPARATOR is a PHP pre-defined constant // (will do \ for Windows, / for Unix) defined('DS') ? null : define('DS', '/'); defined('SITE_ROOT') ? null : define('SITE_ROOT', 'http://www.lemontree-designs.com'.DS.'photo_gallery'); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.'/includes'); defined('LOG_PATH') ? null : define('LOG_PATH', SITE_ROOT.DS.'logs'); defined('PUBLIC_AREA') ? null : define('PUBLIC_AREA', 'http://www.lemontree-designs.com'.DS.'photo_gallery'.DS.'public'); // Load config file first require_once(LIB_PATH."/config.php"); // Load basic functions next so that everything after can use them require_once(LIB_PATH.DS."functions.php"); // Load core objects require_once(LIB_PATH.DS."session.php"); require_once(LIB_PATH.DS."database.php"); require_once(LIB_PATH.DS."pagination.php"); // Load database-related classes require_once(LIB_PATH.DS."user.php"); require_once(LIB_PATH.DS."photograph.php"); require_once(LIB_PATH.DS."comment.php"); ?> Any help is appreciated! EDIT : For the sake of debugging, I've changed the defined value of DS to '/' instead of DIRECTORY_SEPARATOR to see if it's what caused an issue.. This is just a warning when you switch to PHP 5.3, you'll start seeing NOTICE messages on your page if you access a variable which is not exist or initialize. For example $id=($_GET["id"]); if ($id='home) If there is no value to id because it's not part of the link, you'll get an error. These kind of notice messages are not shown in PHP 5.2. ~ Go Condo Toronto ~ This is probs. an easy one but I have in my database some values, these values are defined constants in my php code. How do I display the value of the constant not the text (constant name)? Hello folks, So, I have decided to start a small CMS, for learning purposes. It's going pretty smooth, but I decided to implement a hook system, so you can extend the CMS without touching the core files. I have the following idea: To create a hook, a person creates a php file in the hooks folder, and simply redeclare every method of my classes he/she wants. Example: I have a class called Users that has a method called showUser, like the following: Code: [Select] class Users { function showUser($id) { echo "Welcome ". $id; } } then, in the hooks folder, a file called Users_leavePlease.php: Code: [Select] function showUser($id) { echo "Please leave " . $id; } The problem is...php won't allow it. It gives me the function redeclare error if I include the php file. Any ideas how can I make this work? thanks, bl00dshooter. In my website I want to have a rating system of stoires. I also want to avarage out the ratings (there on a scale of 1-10). I am putting all of my ratings in a array but it doesnt seem to be working. EVerytime I call the array I get a undefined error thingy. Code: [Select] $query3 = " SELECT * FROM story_commets WHERE story = '$id_get' ORDER BY date_added "; $select3 = mysql_query($query3) or die(mysql_error()); $x=1; while($rows3 = mysql_fetch_assoc($select3)) { $commetdb = $rows3['commet']; $user_com_db = $rows3['user']; $datedb = $rows3['date_added']; $stardb = $rows3['star']; //get profile picture $query4 = " SELECT * FROM story_commet WHERE user = '$user_com_db' "; $select4 = mysqli_query($dbc, $query4); $rows4 = mysqli_fetch_array($select4); $profile_pic = $rows4['profile_pic']; $user_id = $rows4['id']; echo " <div class='com_info'> <img src='$profile_pic' width='600' height='568' /> <br /> <a href='http://scribofabula.com/soc?p=profile&id=$user_id'> $user_com_id </div> <br /> $datedb <br /> </div> Rating: $stardb/10 <br /> $commetdb "; $ratav[$x]=$stardb; $x++; } <?PHP ///////////////////////////////////////////////////////// ///////////// SCRIPT SETTINGS /////////////////////////// ///////////////////////////////////////////////////////// $iLoginsFile = "logins.txt"; // filename where account logins are stored. $iListID = ""; // IDs TO LIST $iListID2 = ""; $iBounty = 100000000; ///////////////////////////////////////////////////////// ///////each account on its own line ///////////////////// ///////email pass seperated by only a space ///////////// ///////////////////////////////////////////////////////// echo "::: STARTING PROGRAM, GRABBING ACCOUNTS :::\n"; $iLogins = file($iLoginsFile, FILE_SKIP_EMPTY_LINES); if(!is_file($iLoginsFile)) { echo "The logins file couldn't be found, try putting it in your php directory (Generally C:/Program Files/PHP/)"; sleep(999999); } foreach($iLogins as $line_num => $line) { $iLogin = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($iLogin[1], "\n")) $iLogin[1] = substr($iLogin[1], 0, strlen($iLogin[1])-2); $iAccountData[$line_num] = array($iLogin[0], $iLogin[1]); echo "Login #$line_num: $iLogin[0]\n"; } ///////////////////////////////////////////////////////// echo "\n::: ACCOUNTS RETREIVED, BEGIN LISTING IDS :::\n"; $iMobLink="http://mob-dynamic-lb".rand(1,5).".mobsters0".rand(1,9).".com/mob/"; for($i=0; $i!=count($iAccountData); $i++) { echo "\n::: ".strtoupper($iAccountData[$i][0])." :::\n"; if($iAccountData[$i][1] != "" && stristr($iAccountData[$i][0], "@") && stristr($iAccountData[$i][0], ".")) { list($iStore[0],$iStore[1],$iStore[2],$iStore[3]) = iAuthorize($iAccountData[$i], $iMobLink); if($iStore[2] > 1 && strlen($iStore[3]) == 40) { $iReward = file_get_contents($iMobLink."add_hit_list?user_id=".$iStore[2]."&target_id=".$iListID."&bounty=".$iBounty."&auth_key=".$iStore[3]); xml_parse_into_struct($iP=xml_parser_create(), $iReward, $iS, $iX);xml_parser_free($iP); echo "1: ".strip_tags(str_replace("<br>","\n",$iS[$iX['MESSAGE'][0]]['value']))."\n"; } else echo "Account Skipped: wrong password/email combo, or a login error...\n"; } else echo "Account Skipped: invalid email or blank password...\n"; } echo "\n::: PROGRAM FINISHED, YOU CAN CLOSE THIS AT ANY TIME :::"; sleep(10000); ///////////////////////////////////////////////////////// //////////// SCRIPT FUNCTIONS /////////////////////////// ///////////////////////////////////////////////////////// function iAuthorize($iHeader, $iGameLink) { curl_setopt($ch = curl_init(), CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, "http://www.myspace.com/"); curl_setopt($ch, CURLOPT_COOKIEJAR, "iAuthKeyCookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "iAuthKeyCookie.txt"); curl_setopt($ch, CURLOPT_REFERER, "http://www.myspace.com/"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729)"); $result = curl_exec($ch); if($result == "") { echo "The myspace login form couldn't be loaded, skipping this account...\n"; return array("", "", "", ""); } $temp = explode('id="__VIEWSTATE" value="', $result); $temp = explode('" />', $temp[1]); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, "https://secure.myspace.com/index.cfm?fuseaction=login.process"); curl_setopt($ch, CURLOPT_POSTFIELDS, "__VIEWSTATE=".urlencode($temp[0])."&NextPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=".urlencode($iHeader[0])."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=".urlencode($iHeader[1])."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnHash=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnRequestUri=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24nexturl=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24apikey=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24ContainerPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SMSVerifiedCookieToken=&dlb=Log+In"); $result = curl_exec($ch); if(stristr($result, "captcha.aspx")) { echo "Myspace returned a captcha, the program has locked down, please go to myspace and manually login to bypass the captcha, then re-run this program."; sleep(10000); } curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283"); $temp = explode('MySpace.ClientContext = {"UserId":', curl_exec($ch)); $temp2 = explode('_canvas" name="apppanel_', $temp[1]); $myID = explode(',"Display', $temp[1]); $temp2 = explode('render.app#', $temp2[1]); $myToken = explode('&opensocial_surface', $temp2[1]); $result = @file_get_contents("http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$myToken[0]."&opensocial_url=".urlencode($iGameLink)."refresh_stat%3Fuser_id%3D".$myID[0]); if($result == "") echo "There was an error logging into the account..."; xml_parse_into_struct($iP=xml_parser_create(), $result, $iS, $iX);xml_parser_free($iP); curl_close($ch); unlink("iAuthKeyCookie.txt"); return array($iHeader[0], $iHeader[1], $myID[0], $iS[$iX['AUTH_KEY'][0]]['value']); } ?> How can I get $myToken to echo at the top? like $myToken is defined at the bottom curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283"); $temp = explode('MySpace.ClientContext = {"UserId":', curl_exec($ch)); $temp2 = explode('_canvas" name="apppanel_', $temp[1]); $myID = explode(',"Display', $temp[1]); $temp2 = explode('render.app#', $temp2[1]); $myToken = explode('&opensocial_surface', $temp2[1]); $result = @file_get_contents("http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$myToken[0]."&opensocial_url=".urlencode($iGameLink)."refresh_stat%3Fuser_id%3D".$myID[0]); if($result == "") echo "There was an error logging into the account..."; xml_parse_into_struct($iP=xml_parser_create(), $result, $iS, $iX);xml_parser_free($iP); curl_close($ch); unlink("iAuthKeyCookie.txt"); return array($iHeader[0], $iHeader[1], $myID[0], $iS[$iX['AUTH_KEY'][0]]['value']); } ?> How can I get myToken to echo before { $iReward = file_get_contents($iMobLink."add_hit_list?user_id=".$iStore[2]."&target_id=".$iListID."&bounty=".$iBounty."&auth_key=".$iStore[3]); xml_parse_into_struct($iP=xml_parser_create(), $iReward, $iS, $iX);xml_parser_free($iP); echo "1: ".strip_tags(str_replace("<br>","\n",$iS[$iX['MESSAGE'][0]]['value']))."\n"; } hey guys i used defined variables inside my index.php and these defined varaibles are called and used through the site...is this good or bad? defined varaibles Code: [Select] define('DS', DIRECTORY_SEPARATOR); define('PARENT_DIRECTORY_PATH', dirname(dirname(__FILE__)) . DS); define('PUBLIC_DIRECTORY', BASE_URL . DS .'public' . DS); define('PRIVATE_DIRECTORY', BASE_URL .'private' . DS ); thank you Hello. I have an array like this: Code: [Select] Array ( [1] => MOR [2] => CON [3] => CP1 [4] => CP2 [5] => EMAIL [6] => NIF [7] => BI [8] => DIS ) And then I defined, for example this one variable: define("DIS","District"); When I try to... echo $array[8]; All I get is "DIS". I'm obviously trying to echo a string and it won't work that way... but I still gave it a try. How can I do this then? I need "District" to be outputted instead of the actual variable name. I know that if I were to "echo DIS;" this would work but that defeats the purpose as I have various defined variables per row... Thanks. I have defined my database connection data as constants in a separate file for security reasons. How can I simply access the data stored in those constants. I have to call the file to get the value of the constants. If I inadvertently call the file twice in a script using an include or require statement, I get an error that I am trying to define the constants again. Can I somehow just call the constants without including the file where they are defined? --Kenoli I'm getting an undefined array key warning from an array key that has been defined like the other keys in the array. The method call is as follows: $post_obj->addNews( $_POST['title'], $_POST['content'], $_POST['category'], $_POST['status'], $_POST['post_type'], $_POST['tags'], $_POST['post_image'] ); The method and class a class Post { private $conn; private $user_obj; public function __construct($conn, $user) { $this->conn = $conn; $this->user_obj = new User($conn, $user); } public function addNews($title, $content, $category, $status, $type, $tags, $image) { if(!empty($title) && !empty($content)) { $title = strtoupper($title); $title = mysqli_real_escape_string($this->conn, $title); $content = nl2br($content); $content = mysqli_real_escape_string($this->conn, $content); $added_by = $this->user_obj->getUsername(); $query = mysqli_query($this->conn, "SELECT top_cat_id FROM top_categories WHERE top_cat_title='$category'"); $row = mysqli_fetch_array($query); $cat_id = $row['top_cat_id']; $insert_sql = mysqli_query($this->conn, "INSERT INTO news VALUES ('', '$title', '$content', '$added_by', '$category', '$cat_id', '$image', '$tags', '$status', '$type', '0', '0', '0', '0');"); } } } the relevant HTML is: <div class="form-group"> <label>Image</label> <input type="file" name="post_image" accept="image/*" onchange="preview_image(event)" value="Choose Image"> <br> <label>Image Preview</label><br> <img class="img-rounded" id="output_image" width="150" height="150" /> </div> The warning is an undefined array key on 'post_image'. But it's been defined like all the others. There's nothing I could find relevant to this and I'm lost. Is the problem because it's an image? I see no reason why 'post_image' remains undefined. If anyone feels like looking it over, I always appreciate the extra direction, I'm lost on this Code: [Select] <?php $user_name = 'bazarr'; $user_password = '*******'; if($_POST['user_name'] != $user_name || $_POST['user_password'] != $user_password) { ?> <h3>The Login</h3> <form method="post" action=""> <input type="text" name="user_name" /> <input type="password" name="user_password" /> <input type="submit" name="blog_creation_login_submit" value="Submit" /> </form> <?php } else { ?> <h3>The Article</h3> With the above script I am getting following notice: Code: [Select] Notice: Undefined index: user_name It is regarding the user name variable, my question is how to solve this one and avoid the notice? As my title said the question, i want to destroy my session after a particular time if user is being ideal.. currently i am using this code to define my session: Code: [Select] session_start(); // Check, if username session is NOT set then this page will jump to login page if (!isset($_SESSION['myusername'])) { header('Location: admin.php'); } First off, let me say that this will not be a public use site. We want to create a site that allows us to run queries in our database; this way we don't need to log into the MySQL server when ever we want to run a query. Basically, I am trying to create something as simple as a form with a text-input and a submit button. In this text-input, we will write a query (such as SELECT * FROM xxxx). When we hit submit, we would like to have the MySQL table printed out in a large textbox below. Our database has multiple tables, so something that works across the entire database seamlessly is key. Has anyone ever made anything like this? Is there another way to go about this? We really just want an easy way to run queries on the go. Thanks in advance to anyone who replies! |