PHP - Find Out Which Files Are Called
Hello
I have a php website. I am trying to trace (find out) which files are called when a page is displayed. For example on certain pages that get displayed it may call up to 6-7 files. I would like to know the name of the files and the order they are called. As through out the code there is a lot of include_once("global/global.libs.php"); Is there any may to easily trace this without having to go through page by page on the code and try to figure out what is happening. Essentially I just want the file name eg global/global.libs.php logged somewhere Thanks in advance Similar TutorialsHi all, I want to be able to have one file (configuration file i guess) where i set the phone number, address, staff names and positions, etc. and then have them display at different places on various pages. I thought they were inc files, but all i can find is the likes of headers and footers. Any help much appreciated. I just don't know what it's called, if someone can point me in the right direction, thanks. MsKazza Hey, friends. I have some trouble on the server front. My sites have been hacked, and I need to make sure I've eradicated every trace of this exploit. I'm looking for a way to search for any and all php files contained in multiple directories with specific names. For instance, I have found a commonality in relation to where these malicious files are placed, such as: Code: [Select] /some/dir/img/somename.phpor: Code: [Select] /some/dir/js/somename.php Is there a way I can easily (e.g. using ssh and the "find" command) locate all files ending in php but only found in directories named "img"? I can't seem to find anything that would allow me to do this with find, or with a combination of find and grep. I can't go directory by directory, as some of these img directories are created many levels deep, some even in .svn directories. Any and all help is appreciated. Hackers suck. I've been trying to find tutorials/coding today related to controlling the ability to download files. The problem I think I'm having because I know it exists is I don't actually know what it's called. Below is kind of a basis for a tutorial or describing what I'm trying to do. I'm trying to find a tutorial or a how to on storing downloadable files either in a Mysql Database &/or on the file server system. I want to make it so that only users that are stored within the user database who have certain rights or a field can be able to download a file. Those users who don't have the proper permissions in the user table will not be able to and those who do when they go to download a file, will be able to. I know these scripts use PHP but am not really sure where to begin on my search because I don't even know what file permissions coding they are using. It's a little difficult for me to explain but, when a website loads another site (For example with Curl or something) How is the site able to keep a header or some part of original site 'attached' to the site they loaded..for example, say you're redirected, the site you redirected to loads, but you still see the site you redirected from header on at the top of the page. How is this done? What is it called? Do you need me to clear it up a bit better? I can try to find an example. I have 2 forms on a page, 1 with a selection of newly registered accounts and another that displays the information on the user. What I need to happen is when a user is selected from the first form, the second form is populated with the data. I'm trying to do this with a combination of php and javascript, however whenever a user is selected the function isn't being called at all as far as I can tell. Can anyone help me get this working please? Code: [Select] <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Fearless Bandits :: Admin Control Panel</title> </head> <body> <?php //Check for config file and initiate session. require("config.php"); session_start(); //Connect to DB if(!$con) die('Could not connect: ' . mysql_error()); mysql_select_db("$dbname") or die("Cannot select DB"); //Check user authorisation if(!isset($_COOKIE['user'])) { echo "Error: Cookies must be enabled. Please enable cookies in your browser and try again.<br>"; return; } else { $user=$_SESSION['user']; $sql="SELECT * FROM users WHERE username='$user' and access='2'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count == 0) { echo "Error: Unauthorised access detected."; return; } } include("header.php"); echo "Admin Control Panel<br>"; //Check for mode, if no mode set to 0 if(isset($_GET['mode'])) $mode=$_GET['mode']; else $mode=0; //Display information based on mode switch($mode){ //Check for new applications case 1: echo "<a href=\"admin.php?mode=0\">Back</a><br>"; $sql="SELECT * FROM users WHERE newreg='1'"; $result=mysql_query($sql); $count=mysql_num_rows($result); $newuser = NULL; $newuid = NULL; $newapi = NULL; $newmember = 0; //If there is more than one load results into an array if($count > 0) { echo "There is at least 1 new user:<br>"; $i = 0; while($row=mysql_fetch_array($result)) { $newaccounts[$i] = $row['username']; $i++; } for($i=0; $i < $count; $i++) { echo "User " . $i . ": " . $newaccounts[$i] . "<br>"; } //Select user echo "<form name=\"selectuser\" action=\"\">"; echo "<select name=\"username\" onChange=\"newaccntsUpdate(this);\">"; echo "<option value=\"\" selected=\"selected\"></option>"; for($i=0; $i < $count; $i++) { echo "<option value=\"" . $newaccounts[$i] . "\">" . $newaccounts[$i] . "</option>"; } echo "</select><br>"; echo "</form>"; //Output array into form. echo "<form name=\"newaccnts\" method =\"post\" action=\"verify_admin.php?form=1\">"; echo "Username: <input name=\"newuser\" type=\"text\" id=\"newuser\" value=\"" . $_SESSION['newuser'] . "\">"; echo "UID: <input name=\"newuid\" type=\"text\" id=\"newuid\" value=\"" . $_SESSION['newuid'] . "\">"; echo "API: <input name=\"newapi\" type=\"text\" id=\"newapi\" value=\"" . $_SESSION['newapi'] . "\">"; if($newmember == 0) echo "Member: <input name=\"newmember\" type=\"checkbox\" id=\"newmember\" value=\"1\"><br>"; else echo "Member: <input name=\"newmember\" type=\"checkbox\" checked= \"checked\" id=\"newmember\" value=\"1\"><br>"; echo "<input name=\"submit\" type=\"submit\" value=\"Submit\">"; echo "</form>"; } break; //Select a mode default: echo "Please select a function below:<br>"; echo "<ul>"; echo "<li><a href=\"admin.php?mode=1\">Check for new applications</a></li>"; echo "<li><a href=\"admin.php?mode=2\">Modify an existing account</a></li>"; echo "<li><a href=\"admin.php?mode=3\">Reset a password</a></li>"; echo "<li><a href=\"admin.php?mode=4\">Delete an account</a></li>"; echo "<ul>"; break; } mysql_close($con); //Update newaccnts function. Pull user info from databse and then run javascript function newaccntsUpdate() { echo "newaccntsUpdate executed<br>"; //Error checking //Identify username $newuser=identifyUser(); //If username is NULL or blank return if($newuser == NULL || $newuser == "") return; $sql = ("SELECT * FROM users WHERE username='$newuser'"); $result = mysql_query($sql); $row = mysql_fetch_array($result); $_SESSION['newuser'] = $newuser; $_SESSION['newuid'] = $row['uid']; $_SESSION['newapi'] = $row['api']; $_SESSION['newmember'] = $row['member']; //Update form with details updateForm(); return; } ?> <script language = "Javascript"> //Identify which user has been selected function identifyUser() { $newuser = document.selectuser.username.value; alert('identifyUser executed'); //Error checking return($newuser); } //Update form function updateForm() { document.newaccnts.newuser.value = $newuser; document.newaccnts.newuid.value = $_SESSION['newuid']; document.newaccnts.newapi.value = $_SESSION['newapi']; alert('updateForm executed'); //Error checking return; } </script> </body> </html> I apologise if I've butchered the code, I'm still learning. Hey guys, I am still kinda new to php and I can't seem to get this to work. Basically I am calling a script and first I need it retrieve certain values which is working fine, but then after that is called I need it to clear those values it just displayed. To do that I am using UPDATE but it doesn't seem to be calling the UPDATE part. Any ideas? Here is the code: Code: [Select] @mysql_select_db("$db_name") or die ("No DataBase Found"); $result = mysql_query("SELECT * FROM members WHERE id='$_POST[id]'"); while ($row = mysql_fetch_array($result)) { $message = $row['message']; $sender = $row['sender']; echo $message . "\n" . $sender; } mysql_query("UPDATE memebers SET message='' WHERE id='$_POST[id]'"); //These never get mysql_query("UPDATE memebers SET sender='' WHERE id='$_POST[id]'");//called or so it seems Here's some of my code. The fault is when AJAX sends the dataString to sendpm.php, it should call the function. But nothing is happening. If i put the sendprivatemessage query in sendpm.php page, the data is sent to mysql. What is the solution, so i don't have to put the query on sendpm.php? jquery - some of it Code: [Select] $.ajax({ type: "POST", url: "/sendpm.php", data: dataString, success: function() { window.location.href = 'http://www.stackway.com/cp/messages=outbox'; } }); sendpm.php Code: [Select] include "database.php"; $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['subject']; $body = $_POST['body']; $database2 = new Database(); $database2->opendb(); $database2->sendprivatemessage($to,$from,$subject,$body); $database2->closedb(); sendprivatemessage function Code: [Select] function sendprivatemessage($to,$from,$subject,$body) { $insert = mysql_query("INSERT INTO privatemessage VALUES ('','$subject','$body','$to','$from','1',NOW(),'','','')",$this-connect); } hi, i just wanted to know... $arr[0] $arr[1] $arr[2] also this $arr[1] would be called a value, but how are the numbers 0,1 and 2 called? are that keys? didn't know where else to post this question. Hi guys, What is it called when you have a long paragraph shoretend, With php of course, To make it like haljh;lajbsdg... For example, I have this paragraph: Code: [Select] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus placerat consequat enim, pretium viverra massa cursus nec. Sed in pharetra magna. Aliquam egestas vehicula mi, sed pellentesque ligula suscipit a. Donec lectus velit, luctus sed lobortis vitae, sollicitudin in sem. Ut facilisis, velit in accumsan porttitor, libero neque molestie leo, ac vulputate eros libero eget mauris. Ut nec justo augue. How to I make it so PHP detects if it is too long and trims it down like: Code: [Select] Lorem ipsum dolor sit amet, consectetur adipiscing elit... If I can find what this is called then I can google it to find it and use it on my site. Thanks in advance! ERROR 0 Fatal error: Call to a member function execute() on a non-object ... i've tested the $mysqli and $stmt, both are objects, i have other requests that work well and are built the same way (copy - paste) all vars on the query are also ok. There are working functions over and under this part of my code, if i remove it everything works fine. Code: [Select] $query2 = "INSERT INTO TABLE_NAME(accountSmtp, passwordSmtp, merchantID, adsPrice, adsWidth, adsHeigh, adsAmount, email, emailFrom, adsSense) VALUES('$gmailUser', '$gmailPassword', '$merchantID', '$prix', '$width', '$height', '$adsAmount', '$email', '$from', '$sense')"; if (!$stmt = $mysqli->prepare($query2)) { printf("Erreur : %d.\n", $stmt->errno); print_r($query2); } /* execute statement */ $stmt->execute(); //close statement $stmt->close(); This might be more than just a php question but here goes anyways. I have designed a php chat room page on my home Apache server just for a few friends & family. The problem I have is the only way for me to know if anyone is on the chat room page is if I'm actually viewing the php page. Is there a way that I can have the page alert me when someone accesses it? I was thinking something like activating a popup in my browser or even a beep so as long as I'm at my computer with my browser open that I will know someone has accessed the page. Here is my code which i use to recieve uploaded files.
$filepath = $_SERVER['DOCUMENT_ROOT'] . "file/"; $fileunzippath = $filepath."unzipped/"; $exclude_list = array(".", "..", "...", "index.php", ".php", ".htaccess"); if($_FILES["zip_file"]["name"]) { $filename = $_FILES["zip_file"]["name"]; $source = $_FILES["zip_file"]["tmp_name"]; $type = $_FILES["zip_file"]["type"]; $name = explode(".", $filename); $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'); foreach($accepted_types as $mime_type) { if($mime_type == $type) { $okay = true; break; } } $continue = strtolower($name[1]) == 'zip' ? true : false; if(!$continue) { $message = "The file you are trying to upload is not a .zip file. Please try again."; } $string = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $filename); $clean_name = strtr($string, array('Š' => 'S','Ž' => 'Z','š' => 's','ž' => 'z','Ÿ' => 'Y','À' => 'A','Á' => 'A','Â' => 'A','Ã' => 'A','Ä' => 'A','Å' => 'A','Ç' => 'C','È' => 'E','É' => 'E','Ê' => 'E','Ë' => 'E','Ì' => 'I','Í' => 'I','Î' => 'I','Ï' => 'I','Ñ' => 'N','Ò' => 'O','Ó' => 'O','Ô' => 'O','Õ' => 'O','Ö' => 'O','Ø' => 'O','Ù' => 'U','Ú' => 'U','Û' => 'U','Ü' => 'U','Ý' => 'Y','à' => 'a','á' => 'a','â' => 'a','ã' => 'a','ä' => 'a','å' => 'a','ç' => 'c','è' => 'e','é' => 'e','ê' => 'e','ë' => 'e','ì' => 'i','í' => 'i','î' => 'i','ï' => 'i','ñ' => 'n','ò' => 'o','ó' => 'o','ô' => 'o','õ' => 'o','ö' => 'o','ø' => 'o','ù' => 'u','ú' => 'u','û' => 'u','ü' => 'u','ý' => 'y','ÿ' => 'y')); $clean_name = strtr($clean_name, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); $clean_name = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $clean_name); $target_path = $filepath.$clean_name; // change this to the correct site path if(move_uploaded_file($source, $target_path)) { echo "Source: ".$source."<br/>"; echo "Type: ".$type."<br/>"; echo "Filename: ".$filename."<br/>"; $zip = new ZipArchive(); $x = $zip->open($target_path); if ($x === true) { $zip->extractTo($fileunzippath.$clean_name); // change this to the correct site path $zip->close(); $exclude_list; $dir_path = $_SERVER['DOCUMENT_ROOT']; $dir_path .= "/file/unzipped/"; $directories = array_diff(scandir($fileunzippath.$clean_name), $exclude_list); foreach($directories as $entry) { if(is_dir($dir_path.$entry)) { if($entry != 'part0' || $entry !='part1') { rmdir($entry); } } } } $message = "Your .zip file was uploaded and unpacked."; } else { $message = "There was a problem with the upload. Please try again."; } }Specifically i want to highlight this part: $exclude_list; $dir_path = $_SERVER['DOCUMENT_ROOT']; $dir_path .= "/file/unzipped/"; $directories = array_diff(scandir($fileunzippath.$clean_name), $exclude_list); foreach($directories as $entry) { if(is_dir($dir_path.$entry)) { if($entry != 'part0' || $entry !='part1') { rmdir($entry); } } }When I upload a zip file containing 2 directories(one called 'part0', and one called 'bad'), they get unzipped correctly and it gives no errors, however the fake directories(not called part0 or part1) I put in there are still there. Any Help? Getting a bit desperate as I've tried a lot of things, so any help very appreicated! The concept im struggling with works like this: 1.) There are graphics of people on a page. There is a textbox to the right of the screen which outputs data that corresponds to the tutor. 2.) What i want is that when a user rolls his mouse over the picture, the data in the textbox immediately updates, which is done via php 3.) The issue is thus calling a php function within onmouseover="" from a javascript command. 4.) The function only changes the values that should be displayed (but doesnt work anyway) - is there a way to test whether a php function is being called correctly? And do i need to include some kind of page refresher? Thanks a lot for your help ****************************************** The code as I have it currently is this. ... Code: [Select] // Default setting to display a random persons data at page startup <? $username="removedforprivacy"; $password="removedforprivacy"; $database="tutors"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM tutors"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=rand(0,5); $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$i,"name"); $degree=mysql_result($result,$i,"degree"); $ib=mysql_result($result,$i,"ib"); $subjects=mysql_result($result,$i,"subjects"); $experience=mysql_result($result,$i,"experience"); $style=mysql_result($result,$i,"style"); $pic=mysql_result($result,$i,"pic"); ?> //This bit outputs all the graphics. Only the first immage calls the php updater function. $whichpic defines the flag for the person, which is passed to the updater function. </p> <p class="bodytext"><a href="" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="<? php updater($whichpic=1); ?>"><img src="../Tutors/Photos/tim2.gif" name="Image15" width="100" height="100" border="0" id="Image15" /></a><a href="max.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','../Tutors/Photos/max1.gif',1)"><img src="../Tutors/Photos/max2.gif" alt="max" name="Image16" width="100" height="100" border="0" id="Image16" /></a><a href="nico.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','../Tutors/Photos/nico1.gif',1)"><img src="../Tutors/Photos/nico2.gif" alt="nico" name="Image17" width="100" height="100" border="0" id="Image17" /></a><a href="sasha.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image18','','../Tutors/Photos/sasha1.gif',1)"><img src="../Tutors/Photos/sasha2.gif" alt="sasha" name="Image18" width="100" height="100" border="0" id="Image18" /></a> </p> //Where the php data is output <p class="sideheader">FEATURED TUTOR</p> <p><img src="<? echo " $pic"; ?>" width="200" height="200"></p> <p><strong>Name: </strong> <? echo "$name"; ?></p> <p><strong>Degree: </strong> <? echo "$degree"; ?></p> <p><strong>IB: </strong> <? echo "$ib"; ?></p> <p><strong>Subjects Taught: </strong> <? echo "$subjects"; ?></p> <p><strong>Teaching Experience: </strong> <br /> <? echo "$experience"; ?> </p> <p><strong>Teaching Style:<br /> </strong><? echo "$style"; ?> .</strong> </p> <p><!-- end .sidebar2 --></p> </div> // The updater function to call, which changes the information displayed <? php function updater($whichpic) { $i = $whichpic; $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$i,"name"); $degree=mysql_result($result,$i,"degree"); $ib=mysql_result($result,$i,"ib"); $subjects=mysql_result($result,$i,"subjects"); $experience=mysql_result($result,$i,"experience"); $style=mysql_result($result,$i,"style"); $pic=mysql_result($result,$i,"pic"); } ?> Hello I have a simple question about file handling... Is it possible to list all files in directories / subdirectories, and then read ALL files in those dirs, and put the content of their file into an array? Like this: array: [SomePath/test.php] = "All In this php file is being read by a new smart function!"; [SomePath/Weird/hello.txt = "Hello world. This is me and im just trying to get some help!";and so on, until no further files exists in that rootdir. All my attempts went totally crazy and none of them works... therefore i need to ask you for help. Do you have any ideas how to do this? If so, how can I be able to do it? Thanks in Advance, pros So far I have managed to create an upload process which uploads a picture, updates the database on file location and then tries to upload the db a 2nd time to update the Thumbnails file location (i tried updating the thumbnails location in one go and for some reason this causes failure) But the main problem is that it doesn't upload some files Here is my upload.php <?php include 'dbconnect.php'; $statusMsg = ''; $Title = $conn -> real_escape_string($_POST['Title']) ; $BodyText = $conn -> real_escape_string($_POST['ThreadBody']) ; // File upload path $targetDir = "upload/"; $fileName = basename($_FILES["file"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); $Thumbnail = "upload/Thumbnails/'$fileName'"; if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){ // Allow certain file formats $allowTypes = array('jpg','png','jpeg','gif','pdf', "webm", "mp4"); if(in_array($fileType, $allowTypes)){ // Upload file to server if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){ // Insert image file name into database $insert = $conn->query("INSERT into Threads (Title, ThreadBody, filename) VALUES ('$Title', '$BodyText', '$fileName')"); if($insert){ $statusMsg = "The file ".$fileName. " has been uploaded successfully."; $targetFilePathArg = escapeshellarg($targetFilePath); $output=null; $retval=null; //exec("convert $targetFilePathArg -resize 300x200 ./upload/Thumbnails/'$fileName'", $output, $retval); exec("convert $targetFilePathArg -resize 200x200 $Thumbnail", $output, $retval); echo "REturned with status $retval and output:\n" ; if ($retval == null) { echo "Retval is null\n" ; echo "Thumbnail equals $Thumbnail\n" ; } }else{ $statusMsg = "File upload failed, please try again."; } }else{ $statusMsg = "Sorry, there was an error uploading your file."; } }else{ $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, mp4, webm & PDF files are allowed to upload.'; } }else{ $statusMsg = 'Please select a file to upload.'; } //Update SQL db by setting the thumbnail column to equal $Thumbnail $update = $conn->query("update Threads set thumbnail = '$Thumbnail' where filename = '$fileName'"); if($update){ $statusMsg = "Updated the thumbnail to sql correctly."; echo $statusMsg ; } else { echo "\n Failed to update Thumbnail. Thumbnail equals $Thumbnail" ; } // Display status message echo $statusMsg; ?> And this does work on most files however it is not working on a 9.9mb png file which is named "test.png" I tested on another 3.3 mb gif file and that failed too? For some reason it returns the following Updated the thumbnail to sql correctly.Updated the thumbnail to sql correctly. Whereas on the files it works on it returns REturned with status 0 and output: Retval is null Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif' Failed to update Thumbnail. Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif'The file rainbow-trh-stache.gif has been uploaded successfully. Any idea on why this is? Hello all, I have been working with PHP for almost a year now, so somewhat still new to it all. OK, this may be an Apache issue, but this involves a php script I wrote that tries to execute on pages that do NOT call it (via the include command). So, here is a little info on how I have set things up. I use WAMP Server to test php and MySQL code for myself (for fun and for practice) and for clients and their web sites. I run WAMP Server off of my laptop, so I can code on the go and because it is on my laptop, I decided to create a PHP & MySQL user authentication setup to keep out unwanted visitors, but allow trusted friends and fellow developers to view my work on client web sites. Let's say the authentication script is called "auth.php" and for all of the pages I want private, I include that script at the top of those pages, if the visitor is not logged in, redirect them to the login page, otherwise, let them view the page (provided their permission level is adequate). Now, for the client web sites that I am working on, I do not call auth.php anywhere on those pages. Now, the problem I notice is that when I visited a client's web site that I am working on (on my WAMP Server), I reviewed my Apache error log and it gave me a PHP error stating the following: Code: [Select] Maximum execution time of 60 seconds exceeded in E:\\wamp\\www\\assets\\auth.php on line 3, referer: http://192.168.1.4/Web_Projects/NCCCLP/home.php Of course I am able to view the client web site pages without having to login, however, the auth.php script tries to run nonetheless. So my question is, does anyone know why this is happening and if and how I can stop it? This is not a serious (urgent) issue, but it does clog up my error logs and so forth and I prefer to have as few errors as possible. Plus, I would just like to know why and how it is running without being called. Any and all help is greatly appreciated and if I need to provide anymore details or be more specific, please let me know. Also, if an issue like this has already been solved and I missed that thread, please let me know and have my apologies. Thanks in advance. Hi All, I am using the uploadify script available at http://uploadify.com/ Now I can get the file uploads working fine with the script below: Code: [Select] <?php session_start(); ?> <link href="/uploadify/uploadify.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/uploadify/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/uploadify/swfobject.js"></script> <script type="text/javascript" src="/uploadify/jquery.uploadify.v2.1.0.min.js"></script> <input id="fileInput" name="fileInput" type="file" /> <script type="text/javascript">// <![CDATA[ $(document).ready(function() { $('#fileInput').uploadify({ 'uploader' : '/uploadify/uploadify.swf', 'script' : '/uploadify/uploadify.php', 'cancelImg' : '/uploadify/cancel.png', 'auto' : true, 'folder' : '<?php echo $_SESSION['filepath']."/downloads/"; ?>', 'multi' : true }); }); // ]]></script> The problem that I am having is that I also store the mysql connection details in session vars (they change depending on who logs in). I have tried a number of ways of "passing" these session vars to the uploadify.php file which does the grunt work of the uploading, but I can never seem to access them. I obviously dont want to pass them to the uploadify.php script through the js because that will show my credentials in the source code. So, the question is, how can I access these session vars in the called file. I assume its a combination of session_write_end() and session_start() but I havent got the right combination yet. Hi I call a function with values of 51 and 100 but the function receives values 1 and 50
<?php // EmilyMoor Version 1.0.0 05-07-2019 Desmond O'Toole. ini_set('display_errors', 1); error_reporting(E_ALL); require("../secure/SecureFunctions.php"); require("secure/SecureFunctionsEmilyMoor.php"); $page = "Emily Moor"; session_start(); $Browser = $_SERVER['HTTP_USER_AGENT']; if (!isset($_SESSION["PageValue"])) $_SESSION["PageValue"] = '1'; $_SESSION["PageValue"] = 2; // Keeps going back to 1 if($_SESSION["PageValue"] == 1) { $_SESSION["StartValue"] = 1; $_SESSION["EndValue"] = 50; } if($_SESSION["PageValue"] == 2) { $_SESSION["StartValue"] = 51; $_SESSION["EndValue"] = 100; } if($_SESSION["PageValue"] == 3) { $_SESSION["StartValue"] = 101; $_SESSION["EndValue"] = 150; } if($_SESSION["PageValue"] == 4) { $_SESSION["StartValue"] = 151; $_SESSION["EndValue"] = 200; } if($_SESSION["PageValue"] == 5) { $_SESSION["StartValue"] = 201; $_SESSION["EndValue"] = 250; } if($_SESSION["PageValue"] == 6) { $_SESSION["StartValue"] = 251; $_SESSION["EndValue"] = 300; } echo $_SESSION["PageValue"] . " - " . $_SESSION["StartValue"] . " - " . $_SESSION["EndValue"] . "<br>"; $qStationDetails = GetChanelInfo($_SESSION["StartValue"],$_SESSION["EndValue"]); $rs = mysql_fetch_array($qStationDetails) or die ("E3001-101A"); $Name = $rs['Description']; ?> function GetChanelInfo($StartCH, $EndCH) // E2004 { echo "Channels = " . $StartCH . " " . $EndCH . "<br>"; // values are 1 and 50 $sqlChanelInfo = "SELECT * FROM TV_EmilyMoor WHERE ID >= $StartCH and ID <= $EndCH"; echo $sqlChanelInfo . "<br />"; $qChanelInfo = mysql_query($sqlChanelInfo) or die ("E3004-01A"); return $qChanelInfo; }
This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=346692.0 |