PHP - Javascript Can't Find File 404
I have short urls on the same page that this javascript code is on. the problem is that the code now can't find the poll.php. I have tried the full path and full url to the poll.php, but the code still outputs file not found. how to get this code working?
$.post('poll.php', $(this).serialize(), function(data, status){ Similar TutorialsHow can i find out parent (including) file of included file? Lets imagine that we want to for example auto_prepend file to each file on our server that would write out the name of file its being executed. I know, i can use PHP_SELF but what if i want to write name of file which is already included? I have a web page and i want on it show its name even if it was included, but not the included page itself is showing name but auto_prepend file to each php file, its duty of this auto_prepend_file to write it out i dont want myself to echo it on each page? do you feel me? Is it pasible to find all occurrences of strings "North" and "North-East" in some txt file and save number of occurrences in some variables?? Say I have... Code: [Select] <? echo("do something"); include("include_file.php"); echo("do something else"); ?> include_file.php Code: [Select] <? $a_$string = "a string"; echo($a_string); ?> I have put an error in the include_file.php an extra $ in the variable name. The first script would kick up an error that there is a problem with file include_file.php as line 3 or what ever the line may be. How can I have it so I can choose what the error message is, say a cryptic code and the line number without having the file names show as this is showing up my hidden includes folder and the file name which means that someone may try to visit this page alone and this can cause security issues. Adding in extra lines to every file to see if it is being use correctly a bit like sessions is not an option although I have looked at it as I have houndreds of files to alter in this case. I have just tried this instead of the top script but I does not show the secret code on error Code: [Select] <? echo("top"); @include("dummy.php") or die("secreterrorcode123"); echo("bottom"); ?> Why smarty won't find my template file?
Fatal error: Uncaught --> Smarty: Unable to load template file 'test.tpl' <-- thrown in C:\xampp\htdocs\testing\includes\smarty\sysplugins\smarty_internal_templatebase.php on line 129also did testinstall $smarty->testInstall(); Smarty Installation test... Testing template directory... C:\xampp\htdocs\testing\templates\frontend\default\tpl is OK. Testing compile directory... C:\xampp\htdocs\testing\templates_c\frontend is OK. Testing plugins directory... C:\xampp\htdocs\testing\includes\smarty\plugins is OK. Testing cache directory... C:\xampp\htdocs\testing\cache is OK. Testing configs directory... C:\xampp\htdocs\testing\configs is OK. Testing sysplugin files... ... OK Testing plugin files... ... OK Tests complete.And get template dir var_dump($smarty->getTemplateDir());array(1) { [0]=> string(55) "C:/xampp/htdocs/testing/templates/frontend/default/tpl\" } File schema htdocs -- testing -- incluses -- smarty plugins sysplugins Smarty.class.php SmartyBC.class.php -- configs configs.php -- db connect.php db.php -- configs -- cache -- templates -- frontend -- default -- css -- mages -- js -- tpl test.tpl -- backend -- templates_c -- frontend index.phpindex.php <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('display_startup_errors', TRUE); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); ob_start(); session_start(); require 'includes/smarty/Smarty.class.php'; require 'includes/db/db.php'; require 'includes/configs/configs.php'; $page = isset($_GET['do']) ? $_GET['do'] : ''; switch($page){ case 'home'; include 'pages/home.php'; break; default: include 'pages/test.php'; break; } ob_flush(); ?>configs.php <?php $smarty = new Smarty(); $smarty->compile_check = true; $smarty->debugging = false; $smarty->cache = 1; $smarty->setTemplateDir('C:/xampp/htdocs/testing/templates/frontend/default/tpl'); $smarty->setCompileDir('C:/xampp/htdocs/testing/templates_c/frontend/default'); $smarty->setCacheDir('C:/xampp/htdocs/testing/cache'); $smarty->setConfigDir('C:/xampp/htdocs/testing/configs'); ?>test.php <?php //$success = 'Success Message'; //$error = 'Error Message'; $errors[] = 'Error one'; $errors[] = 'Error two'; $smarty = new Smarty; //$smarty->assign('success', $success); //$smarty->assign('error', $error); $smarty->assign('errors', $errors); $smarty->display('test.tpl'); ?>test.tpl {if !empty($errors)} <div id="errors"> {section name=i loop=$errors} {$errors[i]}<br /> {/section} </div> {/if} Hi, Everyone! I have an issue and I'm not even sure if it can be done with PHP, but even this info would help me (to stop looking for an answer). I need to populate a (MySQL) database with stuff which is now written in a (HTML formatted) file. Here are my options: 1. Copy/paste each single field via PHPMyAdmin . 2. Write a little script to extract the necessary parts of text from these files to create a CSV-like content which I would then easily INSERT into the db. Example The files look like this: Code: [Select] <!-- SEPARATOR (same throughout the file(s) --> <tr><td> <div style="something"><img src="img/what_i_need_to_extract_1.png"></div> </td><td> <div style="something else"><b>What I need to extract 2</b></div> <div style="something else">What I need to extract 3</div> </td></tr> <!-- SEPARATOR (same throughout the file(s) --> etc ... and it goes like... 100 times in each file in the same standard pattern with the "What I need to extract" parts being completely different each time. Since it's possible to tell when each part required for extraction begins and ends, I would expect the script to look for these key-points (according to the example, it would be: img/ to "></d then "><b> to </b>< and else"> to </div>) and return a result like this (acc. to the example): ('what_i_need_to_extract_1.png', 'What I need to extract 2', 'What I need to extract 3'), (and so on...). Is it possible? Is there a function/option/way to look for a start/end-point like this and fetch the part between these two set points? If so - how? Any help would be appreciated, I'm not expecting a full code, obviously, just a point to the right direction or where to look at would be nice. Thanks in advance. I wanted to replace a strings in a large text file .. what would be the fastest way ?! e.g the text file contains .. INSERT INTO `subjects` VALUES (1, 'some text here', 'some text here', 'some text here'); INSERT INTO `subjects` VALUES (2, 'some text here', 'some text here', 'some text here'); INSERT INTO `subjects` VALUES (3, 'some text here', 'some text here', 'some text here'); INSERT INTO `subjects` VALUES (4, 'some text here', 'some text here', 'some text here'); INSERT INTO `subjects` VALUES (5, 'some text here', 'some text here', 'some text here'); I wanted to replace the string " VALUES (1, " with "VALUES (" in each line .. I'm new in PHP so any response would be much appreciated .. thanks Seems this should be easy, but I'm not finding the solution. Functions like scandir, readdir, and glob that I've been looking at all seem to need me to actually know more about my directory path than I can ahead of time. Here's what I want to do: 1. expand a .tar file (consists of directory, subdirectories, files, and is variable) that I've uploaded to the server 2. look through that expanded directory for a subdirectory named ".pn" -- (note that all my .tar files will have this folder deep in several subdirectories that will be variable in number and have different names depending on the original .tar file) 3. copy the entire contents of the .pn folder to another folder already on my server The hosting company, no doubt, has likely blocked some of the functions I'll need as well, but if someone can point me in the right direction to start, it would be greatly appreciated. Thanks! Satre This is probably an easy one, but I can't figure it out and it's pretty much not searchable. on a linux-machine i have installed filezilla the filezilla runs pretty well and all is ok. now i need to have the passwd that i have stored years ago. The passprhase is stored in a plain in a file called sitemanager.xmlfile I want to find that file and open it with a terminal command. find . -name *.sitemanagerwell i thought that this will return the file I'm looking for. Now how do I open it automatically, without typing the name? find . -name *sitemanager.xm | openThis doesn't work. It says it doesn't found the open command. question: why it does not work on opensuse? should i use any other command - eg the following: find . -name *xyz | xargs openor find . -name *sitemanager.xml | xargs openor find . -name *.xyz -exec open {} \;and find . -name *.xyz -exec open {} \; .any and all help will be greatly appreciate again: what is wanted and needet is to find out the passphrase in the filezilla-configuration can i add php variables into a js file? i have tried this: document.location = <?php echo $_SESSION['fwd_page']; ?>; but it doesnt work. Code works when...
<script type="text/javascript"> var currenttime = '<?php print gmdate('F d, Y H:i:s', time() + (1 * 60 * 60))?>' var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var serverdate=new Date(currenttime) function padlength(what){ return (what.toString().length==1)? "0"+what : what } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1) var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) document.getElementById("servertime").innerHTML=datestring+" "+timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script>Code not works when... <script type="text/javascript" src="clock.js">I want to use second option. Any help? Hi, I am using Mouseflow analytics in a phpbb forum. In my specific application, I need to add their application's javascript code inside php code. How do I properly add Javascript code inside a php code. Thanks This is how I would add it to an html file <script type="text/javascript"> var _mfq = _mfq || []; (function () { var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true; mf.src = "//cdn.mouseflow.com/projects/b22343cd9-0049-4443-8326-954444462d6515.js"; document.getElementsByTagName("head")[0].appendChild(mf); })(); </script> This is my website http://www.rahulkadukar.info/ As you can see I have the blue navigation bar on top and on mouse hover you can see a drop down menu. The contents of the drop down menu can change and I wanted to write a script that would populate the contents of the drop down menus. Which of these is a better option 1. Use JavaScript along with a text file and use JavaScript to populate the drop down 2. Use a SELECT in PHP to populate the drop down menu I am expecting that the 10 main columns would have at the most 20 entries each. I believe this is a PHP problem rather than a javascript one, but stand to be corrected. The following code shows two echo statements, with the second one commented out. The uncommented statement inside the javascript will not work, because while it calls up the check.php file it does not send the associated parameters correctly. I have left the commented echo in because it works perfectly. What's wrong? I know that javascript works client side, but the relevant php code has already run so the javascript should work. Code: [Select] <?php // code associated with a database query precedes this if ("{$row['passState']}" == 0) { ?> <script language="javascript" type="text/javascript" > <-- var newwindow; function popup() { newwindow = window.open('check/check.php?quizTitle=".urlencode($quizTitle)."','_blank','scrollbars=yes,top=0,left=0,width='+screen.width+',height='+screen.height); if (window.focus) {newwindow.focus()} } //--> </script> <?php echo '<form><input type="button" onClick="popup()" value="Check your answers"></form> '; //echo "<A HREF=\"check/check.php?quizTitle=".urlencode($quizTitle)."\" onClick=\"return popup(this, 'thoughts', 'scrollbars=1'); window.moveTo(0,0); window.resizeTo(screen.width,screen.height-100);\">Check your answers</A>."; } ?> My justification for presenting a full screen popup for students is so that they can see answers they have given in an earlier quiz. I find that if their popup is just a window over their working page, they can use the popup to just fill in their answers on a second attempt. Full screen mode will limit this. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320945.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=358359.0 The issue I'm having is that this query won't find a max value record if it has less than 5 votes. It'll only show the results of an entry has 5 or greater votes. Why is that? $contest_id = 5; $category_id = 8; $find_entries = $db->prepare("SELECT entry_id, user_id, votes FROM contest_entries WHERE contest_id = :contest_id AND category_id = :category_id AND e_status = :e_status AND votes = (SELECT MAX(votes) FROM contest_entries) LIMIT 1"); $find_entries->bindParam(':contest_id', $contest_id); $find_entries->bindParam(':category_id', $category_id); $find_entries->bindValue(':e_status', 0); $find_entries->execute(); $result_entries = $find_entries->fetchAll(PDO::FETCH_ASSOC); if(count($result_entries) > 0) { foreach($result_entries as $row) { $entry_id = $row['entry_id']; $user_id = $row['user_id']; $votes = $row['votes']; } echo $entry_id; } else { echo 'nothing'; } Edited June 26, 2019 by imgrooot Hi I downloaded a PHP script, copied at localhost and when I run it, it will not display all results instruction says that Globals should be off in PHP.ini and scripts should work while Globals are off. but I can't find php.ini in XAMPP. I tried xampp/apache/bin but I didn't find php.ini what should I do? Hey, What function / how would I find if a string has something? Say I have a string like: $string = 'Hello their! This is my post :) btw, my name is Justin.'; Say I wanted to find out if my name "Justin" is inside that string.. so: whateverfunction('Justin', $string) So I think you should get my idea now though Thanks a lot! Hi,
sorry if there already is a topic regarding my question.. I probably didn't find the right words to describe it properly.. would appreciate a link if anybody knows
I'm making a search form for an archive and my problem is that the labeling says e.g. "1400-3500 A-C".. Now i don't want to make thousands of entrys for 1 file.. How do i find that one file while searching for a number in between, like "1420" or "B"?
Thanks in advance!
Greetings localhobo
Edited by localhobo, 13 October 2014 - 01:28 PM. |