Jump to content

xcandiottix

Members
  • Posts

    330
  • Joined

  • Last visited

    Never

Everything posted by xcandiottix

  1. Sorry for the misunderstanding initially dcro2. Your way seems to work perfectly. Thank you very much for your assistance!
  2. $liveArray = array(); //Add needed data to JSON creation with required html $liveArray['ID'] = $ID; $liveArray['current'] = number_format(($checkPrice - $deduct),2); $savings = 1-@($checkPrice / $originalPrice); $savings = round($savings, 4); $liveArray['currentSavings'] = $savings*100; $liveArray['place'] = "ON"; $liveArray['buy'] = "OFF"; if($Status == "ON"){ $liveArray['pb'] = "ON"; } else{ $liveArray['pb'] = "OFF"; } $data = json_encode($liveArray); $liveArray['Stream'] = $_GLOBALS['History']; $data = json_encode($liveArray); $myFile = '../json/auctions/'.$ID.'-live.js'; $fh = fopen($myFile, 'w') or die('can\'t open file'); fwrite($fh, $data); fclose($fh); //Set file access chmod('../json/auctions/'.$ID.'-live.js', 0644); //TESTING echo $data; unset($liveArray, $data, $myFile, $fh); Sorry, I didn't show the array construction. Stream already part of the array but it's forcing quotes after the : and before the [ if that makes sense. That's the code that creates the JSON. There's some other things being added to the JSON but they don't affect the problem I'm having. To simplify my issue, I'm using php to create liveArray with a few different json object pairs (name:value). At the end I want to attach an array (name:["value 1","value 2","value 3"]). The problem is that once the array is created, there is an error in the way the array is entered into the json file. The error being that the json_encode() command is placing a double quote BEFORE the opening bracket of the array (name:"["value1...). The double quote between the : [ causes the following double quotes around the array vaules gets escaped (name:"[\"value 1\"]) therefore it cannot be parsed later on when I call it to populate a div.
  3. I'm only working with PHP 5.2 so I don't have the option to include one of the bitmask arguments while encoding an array. I was wondering if someone had a work around for this: $_GLOBALS['History'] .= '['; while($row3 = @mysql_fetch_array($result3)){ $number = $row3['db_Id']; $time = $row3['db_Timestamp']; date_default_timezone_set('America/Phoenix'); $time = date("l M j g:i:s a T Y", $time); $_GLOBALS['History'] .= '"<img src=\'../images/avatar/'.md5($row['db_UserId']).'.jpg\'>'.$row['db_UserId'].'<br>'.$time.'<br>",'; unset($alert); } $_GLOBALS['History'] .= '"0"]'; //SETS LAST RUN AS SOMETHING TO FINALIZE LAST COMMA OF WHILE LOOP I get it to the JSON like so: $liveArray['Stream'] = $_GLOBALS['History']; $data = json_encode($liveArray); $myFile = '../json/auctions/'.$ID.'-live.js'; $fh = fopen($myFile, 'w') or die('can\'t open file'); fwrite($fh, $data); fclose($fh); //Set file access chmod('../json/auctions/'.$ID.'-live.js', 0644); //TESTING echo $data; unset($liveArray, $data, $myFile, $fh); In my JSON file I'll see: {"Stream":"[\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"<img src='..\/images\/avatar\/d41d8cd98f00b204e9800998ecf8427e.jpg'><br>Wednesday Dec 31 5:00:00 pm MST 1969<br><br>\",\"0\"]"} But the proper format of a json array should be {"Stream":["item one","item two","etc"]"} instead of {"Stream":"["item one","item two","etc"]""} So how can I avoid that " after the : ?
  4. I have a jquery / json script I wrote but I'm not very good at this yet. Can anyone help me make this cleaner? <html> <script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script> <script type="text/javascript"> var items = []; var x = 0; $.getJSON('updates.js', function(data) { $.each(data, function(key, val) { items.push('<id="' + key + '">' + val + '</li>'); x++; }); }); var y = 0; var auto_refresh = setInterval( function(){ $('#sometext').fadeOut('slow', function(){ if(y < x){ $("#sometext").html(items[y]); y++; } else{ y = 0; $("#sometext").html(items[y]); } } ); $('#sometext').fadeIn('slow'); }, 2000); </script> <div id="sometext"> Hello </div> </html> The json contains: { "one": "Singular sensation", "two": "Beady little eyes", "three": "Little birds pitch by my doorstep" } I want the code to create an array from any key/value pairs in the json, count them, then for each fade it in then out of the DIV .. then replace with the next one on the the fade in. Once it has shown all of them, I;d like for it to restart. This code works right now but it seems awfully clunky to me. As a bonus, I'd like it if I could start at a random number. For example if I have 10 items in the array, it would be great to randomly start at 0 - 9 each page load. Thanks!
  5. I'm currently working on a site that has about 4 separate panels on the page that all use an include to populate. Each include is interacting with the database and I'm thinking that it might congest the databse to have each panel connecting to the same data base and getting data when the page loads. I was wondering if it would be good practice to take all the connections and functions and put them on a 5th include at the top of the page. This way the connections and functions would be available to each include. Is this a good idea? Will it be a problem for the 4 includes to ask the php function list include for data? Is it better to just let each include contain only the code it needs? Also, say I have 20 functions on the php include and one site page only needs to use 1 function. Would the php function include still loop thru and connect to the database for all 20 functions just because it is included or will it only use the bandwidth needed to execute the 1 function it is being asked to use? Hope that's not over confusing. Thanks!
  6. This script is a great improvement! Thanks so much, it works perfect across all browsers.
  7. I am trying to make a small script that counts down from server time to a specific time in the future. The time cannot be altered by the browser / timezone of the visitor. THis script works great in chrome and IE but fails on firefox. Can anyone point me in the right direction? <script language="javascript"> TargetDate = "<?php echo $time;?>"; BackColor = "palegreen"; ForeColor = "navy"; CountActive = true; CountStepper = -1; LeadingZero = true; DisplayFormat = "%%D%%:%%H%%:%%M%%:%%S%%"; FinishMessage = "JUST ENDED"; function calcage(secs, num1, num2) { s = ((Math.floor(secs/num1))%num2).toString(); if (LeadingZero && s.length < 2) s = "0" + s; return s; } function CountBack(secs) { if (secs < 0) { document.getElementById("cntdwn").innerHTML = FinishMessage; return; } DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000)); DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24)); DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60)); DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60)); document.getElementById("cntdwn").innerHTML = DisplayStr; if (CountActive) setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod); } function putspan(backcolor, forecolor) { document.write("<span id='cntdwn' class='time'></span>"); } if (typeof(BackColor)=="undefined") BackColor = "white"; if (typeof(ForeColor)=="undefined") ForeColor= "black"; if (typeof(TargetDate)=="undefined") TargetDate = "12/31/2020 5:00 AM"; if (typeof(DisplayFormat)=="undefined") DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; if (typeof(CountActive)=="undefined") CountActive = true; if (typeof(FinishMessage)=="undefined") FinishMessage = ""; if (typeof(CountStepper)!="number") CountStepper = -1; if (typeof(LeadingZero)=="undefined") LeadingZero = true; CountStepper = Math.ceil(CountStepper); if (CountStepper == 0) CountActive = false; var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990; putspan(BackColor, ForeColor); var dthen = new Date(TargetDate); var dnow = new Date("<?php echo date("Y-m-d H:i:s"); ?>"); if(CountStepper>0) ddiff = new Date(dnow-dthen); else ddiff = new Date(dthen-dnow); gsecs = Math.floor(ddiff.valueOf()/1000); CountBack(gsecs); </script>
  8. YES That worked perfectly ... thanks so much!!
  9. Okay here's the simple thing I'm trying to do. I have a time in a db on my server .. let's say its March 1st 2011 at 12:00AM. This time is dynamically set by the server, so it's on server time. Now, lets say today is Feb 28th 2011 at 12:00AM on the server. I'm trying to write a dynamic script that will count down that time .. in this case I would want to show 23:59:59. Every count down script i've found online gives me an option to use local time (browser) or server time. Each time i plug in server time it is always set to my browse time ... I echo everything out and I basically get this: Server time: Feb 28th 2011 at 12:00AM My browser time: Feb 28th 2011 at 2:00AM Script time remaining: 21:59:59 So why does this keep happening? When I echo the date() from the server it's always 2 hours ahead of my time but the script never adjusts. Any ideas or does anyone know of a good working script? I'm on eastern time and the server is on pacific. Here's my last try, you'll see I place the php date into this towards the bottom but I've also tried jquery and SSI methods too. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <script language="JavaScript"> TargetDate = "2/1/2011 12:00 AM"; BackColor = "palegreen"; ForeColor = "navy"; CountActive = true; CountStepper = -1; LeadingZero = true; DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; FinishMessage = "It is finally here!"; </script> <script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"> */ function calcage(secs, num1, num2) { s = ((Math.floor(secs/num1))%num2).toString(); if (LeadingZero && s.length < 2) s = "0" + s; return "<b>" + s + "</b>"; } function CountBack(secs) { if (secs < 0) { document.getElementById("cntdwn").innerHTML = FinishMessage; return; } DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000)); DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24)); DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60)); DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60)); document.getElementById("cntdwn").innerHTML = DisplayStr; if (CountActive) setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod); } function putspan(backcolor, forecolor) { document.write("<span id='cntdwn' style='background-color:" + backcolor + "; color:" + forecolor + "'></span>"); } if (typeof(BackColor)=="undefined") BackColor = "white"; if (typeof(ForeColor)=="undefined") ForeColor= "black"; if (typeof(TargetDate)=="undefined") TargetDate = "12/31/2020 5:00 AM"; if (typeof(DisplayFormat)=="undefined") DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; if (typeof(CountActive)=="undefined") CountActive = true; if (typeof(FinishMessage)=="undefined") FinishMessage = ""; if (typeof(CountStepper)!="number") CountStepper = -1; if (typeof(LeadingZero)=="undefined") LeadingZero = true; CountStepper = Math.ceil(CountStepper); if (CountStepper == 0) CountActive = false; var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990; putspan(BackColor, ForeColor); var dthen = new Date(TargetDate); var dnow = new Date("<!--config timefmt='%c' --><!--echo var='DATE_LOCAL' -->"); if(CountStepper>0) ddiff = new Date(dnow-dthen); else ddiff = new Date(dthen-dnow); gsecs = Math.floor(ddiff.valueOf()/1000); CountBack(gsecs); </script> <br /> <?php $now = new DateTime(); echo $now->format("M j, Y H:i:s O")."\n"; ?> </body> </html>
  10. Well, my problem isn't really the "how to" of cropping. Really what I'm trying to find out is where in this script can I grab the image ... do something to it .. and then put it back into this script. So for example: <?php $directory = $_GET['u']; // filename: upload.processor.php // first let's set some variables // make a note of the current working directory, relative to root. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // make a note of the directory that will recieve the uploaded files $uploadsDirectory = "/home/content/99/6259799/html/userdirectories/".$directory."/images/"; // make a note of the location of the upload form in case we need it $uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'upload.php'; // make a note of the location of the success page $uploadSuccess = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'success.php?u=' . $directory; // name of the fieldname used for the file in the HTML form $fieldname = 'file'; //echo'<pre>';print_r($_FILES);exit; // Now let's deal with the uploaded files // possible PHP upload errors $errors = array(1 => 'php.ini max file size exceeded', 2 => 'html form max file size exceeded', 3 => 'file upload was only partial', 4 => 'no file was attached'); // check the upload form was actually submitted else print form isset($_POST['submit']) or error('the upload form is neaded', $uploadForm); // check if any files were uploaded and if // so store the active $_FILES array keys $active_keys = array(); foreach($_FILES[$fieldname]['name'] as $key => $filename) { if(!empty($filename)) { $active_keys[] = $key; } } // check at least one file was uploaded count($active_keys) or error('No files were uploaded', $uploadForm); // check for standard uploading errors foreach($active_keys as $key) { ($_FILES[$fieldname]['error'][$key] == 0) or error($_FILES[$fieldname]['tmp_name'][$key].': '.$errors[$_FILES[$fieldname]['error'][$key]], $uploadForm); } // check that the file we are working on really was an HTTP upload foreach($active_keys as $key) { @is_uploaded_file($_FILES[$fieldname]['tmp_name'][$key]) or error($_FILES[$fieldname]['tmp_name'][$key].' not an HTTP upload', $uploadForm); } // validation... since this is an image upload script we // should run a check to make sure the upload is an image foreach($active_keys as $key) { @getimagesize($_FILES[$fieldname]['tmp_name'][$key]) or error($_FILES[$fieldname]['tmp_name'][$key].' not an image', $uploadForm); } // make a unique filename for the uploaded file and check it is // not taken... if it is keep trying until we find a vacant one foreach($active_keys as $key) { $now = time(); while(file_exists($uploadFilename[$key] = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name'][$key])) { $now++; } } // now let's move the file to its final and allocate it with the new filename foreach($active_keys as $key){ //////////////////////////////////////It seems like I should start here////////////////////////////////////////// @move_uploaded_file($_FILES[$fieldname]['tmp_name'][$key], $uploadFilename[$key]) or error('receiving directory insuffiecient permission', $uploadForm); } // If you got this far, everything has worked and the file has been successfully saved. // We are now going to redirect the client to the success page. header('Location: ' . $uploadSuccess); // make an error handler which will be used if the upload fails function error($error, $location, $seconds = 5) { header("Refresh: $seconds; URL=\"$location\""); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'."\n". '"http://www.w3.org/TR/html4/strict.dtd">'."\n\n". '<html lang="en">'."\n". ' <head>'."\n". ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n". ' <link rel="stylesheet" type="text/css" href="stylesheet.css">'."\n\n". ' <title>Upload error</title>'."\n\n". ' </head>'."\n\n". ' <body>'."\n\n". ' <div id="Upload">'."\n\n". ' <h1>Upload failure</h1>'."\n\n". ' <p>An error has occured: '."\n\n". ' <span class="red">' . $error . '...</span>'."\n\n". ' The upload form is reloading</p>'."\n\n". ' </div>'."\n\n". '</html>'; exit; } // end error handler ?> Where I noted 'i should start here' .... How do I take the image thats ran in this script so far .. and put it into a variable ... do something to it ... and then put it back. So maybe..... foreach($active_keys as $key){ $image = $_FILES[$fieldname]['tmp_name'][$key]; --I insert whatever cropping, resizing etc-- $_FILES[$fieldname]['tmp_name'][$key] = $image @move_uploaded_file($_FILES[$fieldname]['tmp_name'][$key], $uploadFilename[$key]) or error('receiving directory insuffiecient permission', $uploadForm); } Would that work in theory?
  11. I found a pretty neat script online that generates a form to upload multiple photos. It works fine and saves the image to the correct directory. What I'd like it to do, in addition, is to also generate a thumbnail that is cropped and save it into a different directory. I've reviewed some of the "how to's" and I get it but I'm not sure where to work it in to this existing code. Can anyone help point out where I could take the image file, resize it, and save it into a separate directory? Thanks! <?php $directory = $_GET['u']; // filename: upload.processor.php // first let's set some variables // make a note of the current working directory, relative to root. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // make a note of the directory that will recieve the uploaded files $uploadsDirectory = "/home/content/99/6259799/html/userdirectories/".$directory."/images/"; // make a note of the location of the upload form in case we need it $uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'upload.php'; // make a note of the location of the success page $uploadSuccess = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'success.php?u=' . $directory; // name of the fieldname used for the file in the HTML form $fieldname = 'file'; //echo'<pre>';print_r($_FILES);exit; // Now let's deal with the uploaded files // possible PHP upload errors $errors = array(1 => 'php.ini max file size exceeded', 2 => 'html form max file size exceeded', 3 => 'file upload was only partial', 4 => 'no file was attached'); // check the upload form was actually submitted else print form isset($_POST['submit']) or error('the upload form is neaded', $uploadForm); // check if any files were uploaded and if // so store the active $_FILES array keys $active_keys = array(); foreach($_FILES[$fieldname]['name'] as $key => $filename) { if(!empty($filename)) { $active_keys[] = $key; } } // check at least one file was uploaded count($active_keys) or error('No files were uploaded', $uploadForm); // check for standard uploading errors foreach($active_keys as $key) { ($_FILES[$fieldname]['error'][$key] == 0) or error($_FILES[$fieldname]['tmp_name'][$key].': '.$errors[$_FILES[$fieldname]['error'][$key]], $uploadForm); } // check that the file we are working on really was an HTTP upload foreach($active_keys as $key) { @is_uploaded_file($_FILES[$fieldname]['tmp_name'][$key]) or error($_FILES[$fieldname]['tmp_name'][$key].' not an HTTP upload', $uploadForm); } // validation... since this is an image upload script we // should run a check to make sure the upload is an image foreach($active_keys as $key) { @getimagesize($_FILES[$fieldname]['tmp_name'][$key]) or error($_FILES[$fieldname]['tmp_name'][$key].' not an image', $uploadForm); } // make a unique filename for the uploaded file and check it is // not taken... if it is keep trying until we find a vacant one foreach($active_keys as $key) { $now = time(); while(file_exists($uploadFilename[$key] = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name'][$key])) { $now++; } } // now let's move the file to its final and allocate it with the new filename //////////////////////////////////////It seems like I should start here////////////////////////////////////////// foreach($active_keys as $key){ @move_uploaded_file($_FILES[$fieldname]['tmp_name'][$key], $uploadFilename[$key]) or error('receiving directory insuffiecient permission', $uploadForm); } // If you got this far, everything has worked and the file has been successfully saved. // We are now going to redirect the client to the success page. header('Location: ' . $uploadSuccess); // make an error handler which will be used if the upload fails function error($error, $location, $seconds = 5) { header("Refresh: $seconds; URL=\"$location\""); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'."\n". '"http://www.w3.org/TR/html4/strict.dtd">'."\n\n". '<html lang="en">'."\n". ' <head>'."\n". ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n". ' <link rel="stylesheet" type="text/css" href="stylesheet.css">'."\n\n". ' <title>Upload error</title>'."\n\n". ' </head>'."\n\n". ' <body>'."\n\n". ' <div id="Upload">'."\n\n". ' <h1>Upload failure</h1>'."\n\n". ' <p>An error has occured: '."\n\n". ' <span class="red">' . $error . '...</span>'."\n\n". ' The upload form is reloading</p>'."\n\n". ' </div>'."\n\n". '</html>'; exit; } // end error handler ?>
  12. I created a test with 2 pages. Page 1 ajaxtest.php <html> <head> <script type="text/javascript"> function loadXMLDoc() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajaxINC.php",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> Standard code from W3schools except instead of a txt file I have it point to ajaxINC.php <script type="text/javascript"> document.write('<b>Hello World</b>'); </script> Now, on ajaxtest.php there's a button. If I press it, the text above the button becomes blank instead of brining in the script from ajaxINC.php. Is it impossible to import javascript script via ajax?
  13. If I grab some javascript can I include it onto a page with element.innerHTML = req.responseText? function selection(selected){ var element = document.getElementById("app1"); req.open('GET', application1, false); req.send(null); element.innerHTML = req.responseText; } document.write("<div id='app1'></div>");
  14. Well, i think you post made good points and honestly I was so focused on the individual pages tat I lost sight of where all the includes were landing. Here's the source code from the browser. Strangely in Chrome, where ever there's javascript it's in plain text .... not color coded like the HTML, CSS, etc. Is it possible that: <script type="text/javascript"> Is wrong? The page loads like so: http://www.appdilly.com/member/user_page.php -Includes in order: -/Appdilly-Logo-and-Banner-User-UP.html (an html banner with js mouse over) -/css_eval.php (dynamically generated css) -/evaluator.php (this is where the problem is) --Requests data from Kcandiotti400.xml --Kcandiotti400.xml has an element with the address for --"/applications/appfiles/3.php?u=Kcandiotti400" --/3.php (evaluator includes this page with in one of evalulator's DIV tags) --3.php includes index.php, index.php's JS does not display. -/Mlowernavbar.html (html nav bar) -/copyright.html (copyright info) I've attached the source for userpage.php evalulator.php 3.php index.php And links to the corresponding live pages: http://www.appdilly.com/member/user_page.php?u=Kcandiotti400 http://appdilly.com/applications/appfiles/3.php http://appdilly.com/applications/includes/3/index.php As you can see the JS works on the last two but not when the entire package is included on the main page. Thanks so much! [attachment deleted by admin]
  15. Well here's where it gets complicated. On the first page i have: <html> <script type="text/JavaScript"> <!-- document.write("Hello World!") //--> </script> </html> <?php echo "Goodbye World";?> Again, navigating directly to the first page gets both printed on screen. But if I navigate to the second page I get: Goodbye World. I don't understand how it can run the php, html, and css that are actually on the first page but not the js. On the second page, here's the part of the page that gets the first page's address from the xml file else{ var element = document.getElementById("app1"); req.open('GET', application1, false); req.send(null); element.innerHTML = req.responseText; } and here's how page one is brought up on the second page document.write("<td width='33%' class='LEFTappcell' align='center' valign='top'><div id='tit1'></div><br><div id='app1'></div></td>");
  16. I have a javascript page included with in a div on a second page. The 1 page has this code: <html> <script type="text/JavaScript"> <!-- document.write("Hello World!") //--> </script> </html> If i navigate directly to the first page i get "Hello world" but if i navigate to the page with the div the includes the first page I get nothing. Does the div preclude the script from running? On the second page, if i view source I don't see the above js code. Is there a way to make it work?
  17. Thank you for taking the time to review the site. I think I didn't explain very well in my initial post that appdilly is, at it's simplest, a social networking site for anyone to use. This differs from the web pages you provided because I'm not trying to only attract developers, but instead the general public. I'd like appdilly to be able to essentially 'morph' into whatever a site member needs their profile to be. So for example, some who is a blogger can just install a blogging app on to their member page. A photographer could install a gallery app on to their member page. A photo journalist could install a gallery and blog if they choose. A key point to this is that it would take me years of development to create enough apps to satisfy the site's members so I thought I would make app creation open ended. This way site users and app creators have a symbiotic relationship on the site, and the site can be ever evolving based on the needs of members and the creativity of app designers. I think it's very hard to summarize this site because it's trying to be a lot of things at once. Maybe this is even overwhelming to a new visitor to the site so I agree with you that I have to give a very clearly defined message of 'this is what it is, this is what it does.' Additionally, I viewed your "Red Dot Inc" site. In practice, if you as an app designer approached appdilly into order to provide an app .. say your app "Run Rabbit" .. your advantage would be a distribution point for your application. Users would benefit because they could install "Run Rabbit" onto appdilly and play it. Because of the UMDOT system, your application would be able to welcome users by name. For instance, if I installed "Run Rabbit" on my appdilly page, your application could communicate to the UMDOT and show "Hello Keith, ready to play?" on the opening screen. A visitor to my page would see "Hello John Doe, ready to play?". I hate to use this example, but think facebook combined with iphones app store. Maybe this makes the direction of the site a little more clear? Thanks for the critique, it really helped!
  18. Hello, I've been working on this project for about six months and I've stalled out on it for the past few weeks. I'd like to share this with the community to get some feedback in order to get that spark back. Please visit: http://www.appdilly.com The basis of this site formed from all the great apps I'd see people develop here only to have it located on www.myserver.com/tests/myapps/hiddenfolder/myawesomeapp.php. I thought maybe I could create a platform for app designs to upload their apps into a social networking environment where people could actually install apps onto their profile page. Apps could range from chat boxes, messaging, and photo albums to e-stores, blogs, and galleries. In order to protect privacy, each user has an UMDOT (Unified Member Data Output Table) .. basically a uniform location for users to share information. Applications may access the UMDOT in order to customize themselves to the user. User's may or may not input information into the UMDOT, thus keeping it private. To see a test account please use: username: test_account password: testing I'd like your opinions or criticisms regarding the entire site as well as it's possible usefulness. Anyone who would like to help populate the site with apps would also be greatly welcomed. Thanks!
  19. Here's what we've got: the form (it posts back to itself therefore no action): <?php //administration panel, change information within the quotes. $appname = "Shout"; $appcreator = "Kcandiotti400"; $versionnumber = "1.0"; ?> <?php require_once('../includes/tools/applicationframeA.php'); //$xml = simplexml_load_file("../includes/tools/testingUMDOT.xml"); ?> <!-- 3. PHP script for operation of shout box --> <?php //A. Save new post to shouts.txt echo $_SERVER['PHP_SELF']; echo "<BR>"; $myFile = "../includes/2/shouts.txt"; $input = $_POST['2input']; if($input == ""){ //echo $xml->home; } else{ echo $input; //B. Append shouts.txt with new post $username = $xml->visitor; $username = '<a href="http://www.appdilly.com/users/'.$username.'">'.$username.'</a>'; //C. Append shouts.txt or if the file is larger then 1000 bytes erase all and start over with this post. $fh = fopen($myFile, 'a'); if(filesize($myFile) > 1000){fclose($fh); $fh = fopen($myFile, 'w');} //C. End $stringData = $username." - ".$input."<br> \n"; fwrite($fh, $stringData); //B. End } //A. End //D. Open .txt and get all previous shouts $fh = fopen($myFile, 'r'); $shouts = fread($fh,filesize($myFile)); fclose($fh); //D. End ?> <!-- 1. Recent shouts holder --> <?php echo $shouts?> <!-- 1. End --> <form method="post"> <!-- 2. This is the input box for the app --> <input name="2input" type="text" size="30" maxlength="144" /><br /> <input name="2submit" type="submit" value="Shout!" /> <input name="2refresh" type="submit" value="Refresh" /> </form> <!-- 2. End --> <?php require_once('../includes/tools/applicationframeB.php'); ?> So the above, as its own page works just fine. It is included in a really big page, by which an ajax script calls it up. It's a lot of code to post on here but it's live so maybe you can see it in action to help: Just the form working by itself: http://appdilly.com/applications/appfiles/2.php Included on a page: http://www.appdilly.com/member/user_page.php?u=Kcandiotti400
  20. The way I understand posting a form to work is that when you hit submit the information is attached to the end of the url of the new page where your script can then get it and use it. I have a form that is an include on a page, like so: thepage.php include: theform.php When i fill out the form and hit submit.. the next page acts as if it has not received any of the posted information. example: echo $_POST['input1'] results in nothing If i go directly to theform.php and fill out and submit the form it works fine. example: echo $_POST['input1'] results in whatever was typed in the first box. So how can I get it to work while being included?
  21. Well, the email accounts are separate from the actual server account. So the from may be "no-reply@site.com" which doesn't really exist or might be "admin@site.com" which does exist but i'm not positive its part of the server.... rather a service included with the hosting package but may be hosted somewhere else.
  22. I'm constructing a site that has a few different areas in which an email is constructed and sent by php. So far, I've noticed that about 1 in 3 never make it to their destination. Since it would seem that the code is right, could anyone give an explanation as to why this occurs? The site i'm working on is on a godaddy linux with php 5.0. It's a paid account so I don't think they would be limiting the site from creating email. Any ideas? Here's my code just to make sure that's ok. $from = $Email; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$from."\r\n"; $headers .= "Return-Path: ".$from."\r\n"; $spamIP = $_SERVER['REMOTE_ADDR']; $to = 'me@email.com'; $subject = "Application Proposal"; $body = 'Suggestion request.'; mail($to, $subject, $body, $headers);
  23. I would have to guess that ajax is as secure as a regular form->submit->result page set up. After all you are still sending and receiving posted data. The benefit I could see is that ajax is talking to other pages "behind the scenes" but none the less data is still being passed back and forth between server and client. This would allow an attacker to intercept that data and use it maliciously. I think you could hide more tricks into an ajax solution that would make it harder to hack but it wouldn't be 100% fool proof forever. The method that you described is little more then a "normal" php form submission that's been salted. except it's called ajax. Salting seems to be the agreed upon way to add security to log in information as far as i've read elsewhere. I read that hacking a salted login encrypted with md5 could take something like 300 years to figure out. So.. bottom line ajax has nothing to do with it.. it's just a interface for the user.
  24. I have an idea for a site in which someone could submit an application (html, JS, php, flash, etc) for testing it. The site would have different variables that the application could access and use. My concern is how can I protect the rest of my site from an attack? Would having a subdomain offer any type of protection and if so how could I do it? If not, should I consider an off site solution? For example, another site which only has the files need for testing on it? I'm trying to get a good concept down before starting on the code and i was hoping i could bounce some ideas around. Obviously a big area of concern would be someone submitting a php script that erases files or a javascript that runs a malicious script. I've looked into strip_tags etc. but i don't want to limit the application designers freedom to produce something. Ideally, the application should have the freedom to access a site provided XML file to read information from and can write to an onsite text file. Aside from performing these tasks, what commands should not be allowed to be used? Any ideas would be a great help. Thank you
  25. Yes! Thank you Thorpe it works beautifully.
×
×
  • 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.