PHP - Variable In Location:
I'm trying to put a variable in a header("Location: /?p=$url");
Is this even possible? Similar Tutorialshey guys i know there is various script about to locate user (country, latitude and longitude) by ip...but can anyone suggest a good one which is free please?
thank you
I have a script that runs in the command line. Is it possible to get where the php interpreter file is? I know I have it running from "C:\php\php.exe" but If I give the script to someone else, php.exe may not be there, and it may not even be a windows operating system, so is there any command to get the location of that file? How do I find the location of the php executable? Running CentOS, and it's not at /usr/local/bin/php... This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333173.0 Hi guys, I am making a simple program which fetches an array of variables on my table. Basically, I want to map the location of a unit which is plugged into a certain location. The layout consists of 40 locations. I'll be representing them using tables. Lets say I have a table with 1 row and 40 columns which portrays the 40 locations. Lets say, collectively all 40 locations are on Area 238. So each location is labeled 238-1 ... 238-40). In my database I have a field called portNumber which has a value of say 238-11. Now I want the code to check all those data entries with the portNumber LIKE 238, and highlight all rows which return a value. Those without value will remain white. Also the highlighted values should check is the field isHistory is set to 0 otherwise, it won't return the value. Here's the code I did so far: Code: [Select] <!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>Location Mapper</title> </head> <body> <table width="800" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <th colspan="40" scope="col">SCMST 238</th> </tr> <tr> <?php $conn = mysql_connect("localhost", "root", "123456") or die(mysql_error()); mysql_select_db("orderstatus") or die(mysql_error()); $sql = mysql_query("SELECT * FROM superdome WHERE portNumber LIKE '%238%' AND isHistory='0' ORDER BY portNumber ASC") or die(mysql_error()); if(mysql_num_rows($sql) != 0) { echo " <td width=\"20\" height=\"30\" scope=\"row\"> </th> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> "; } ?> </tr> </table> </body> </html> So if the query for mysql_num_rows return 0, nothing should be highlighted as shown in the pictu but if the query for mysql_num_rows return a value, all values in the array should be highlighted as shown: Location 5 and 40 are highlighted. Really need help on this one... Thanks! hi guys , i know with link youll use the name tag to load a location on the page but i need to know how to use it in php. i have a main page with details at the top of page, half way down i have comments and then the user can add comments to them. currently if you click post a comment its ok but i want to load that comment at the top (scrolled down to location) once you click submit to post your comment as it loads the same page again. this is the views as pages loads with the comment box at bottom. this is how i want the same page to load , half where down where the comment is placed. i want it to work the same as a forum , post your message then you see your message at top of page of that thread all thought the message is actually like the 12th post in the board. I was wondering if it's possible to retain loaded files and the current error setttings after a
header("Location: xxxx.php")is issued, for example in this: // Start up the session - not used yet but there just in case session_start(1); // Enable the Autoloader and initialise it require_once 'Autoloader.php'; Autoloader::init(); // Check if the application has been installed yet ---------------------------- if(!file_exists('Engine/config.php')){ session_write_close(); header("Location: install/index.php"); die(); }And I get a class not found error when I open the install/index.php session_start(1); // @todo: Disable this in the production version .... I already did this in the main index -- do I have to do this on all pages that may error? error_reporting(E_ALL & ~E_STRICT); ini_set("display_errors",1); // Because we jumped here, we have to reinstall the autoloader -- why? require_once '../Autoloader.php'; Autoloader::init();While I can understand I wouldn't want this if I was firing off to a completely different site, is there anyway to retain the settings within the same server environment or do I have to reset everything as above. I even tried using session in the hope that this would 'remember' but it didn't work. Hi everyone, This is driving me crazy. I need to reference different files located in different folder structure. For example, I have the following file structure. /my_project/ /my_project/database/database_script.php /my_project/index.php 1. If I want to reference /my_project/index.php from /my_project/database/database_script.php, how can I reference it ? 2. From /my_project/index.php to /my_project/database/database_script.php , it's obvious all I gotta do it include("/database/database_script.php"). I use $_SERVER('DOCUMENT_ROOT"), to solve the 1. problem. It works on my XAMPP local machine but when I uplode it onto the server, there's a problem. The path becomes '/my_project/my_project/database/database_script.php". Is there a universal way (more like a standard way) to reference files in php so that I won't need to change every file path once I upload those onto the server ? Regards, I am trying to load an xml file but I can't seem to find the location to load it. Here is the location of the xml file: C:\inetpub\wwwroot\php\webphp.xml Here is the location of the file trying to load the xml: C:\inetpub\wwwroot\php\gui\guiindex.php What location would I put in he $xml = new SimpleXMLElement("XMLFILELOCATION", NULL, true); I am trying to create a script that alters the navigation div depending on the page the user is on. How do I get the current page using PHP? Hello, I am customizing a wordpress theme. It contains a Location Search that shows locations as drop down menu. But i want to show predictive search such as when user types "NE" it shows "New York, united States". It is also called autocomplete. I want a solution for a it from beginning as i am completely newbie. The Theme has admin panel where an option allow to add locations, and these location are saved in database. I just need these locations to show on predictive search. Here is the code that calls the location databsae : Code: [Select] div class="search_row clearfix"> <label> <?php _e(SEARCH_LOCATION_TEXT); ?> : </label> <select name="srch_location" id="srch_location" onchange="" class="fl select"> <option value=""><?php _e(SEARCH_ALL_LOCATION_TEXT); ?> </option> <?php echo get_location_dl($_REQUEST['srch_location']);?> <?php //echo get_category_dropdown_options(get_cat_id_from_name(get_option('ptthemes_locationcategory')),$_REQUEST['srch_location']);?> </select>I think "srch_location" is the location where all these location saved. How can i show these to predictive search. Please answer in steps so i can understand because i dont know php very well. Also it would be good if yoou include the easy jQuery or AJAX Script that does the job and a guide how to implement in the code. Update: How to call the location where country list is saved using php? for example i am using this code to get the location to be appear on the predictive search : Code: [Select] onchange="<?php echo get_location_dl($_REQUEST['srch_location']);?>"but its not working but I am 100% sure and tested that this code is working well when i code dropdown for location textbox. I just need to work as well for predictive search. Thank you very much. How is it possible for a website to know my physical location? Some websites I've seen will have ads such as; meet singles in "HOMETOWNGOESHERE" I'm guessing this kind of info is found from my Ip address? Has anyone ever done anything like this in php, I'm interested to know how this works. this little piece of code doesn't seem to work: Code: [Select] if($rs_teamcheck['team_id'] != $team{ header( "Location: http://domain/page.php" ) ;} If I replace the header location part with an echo the output is fine, so why isn't the redirect working? I've made a Login Script and I'm trying to make it re-direct me to the Homepage after the login is complete. However, it's doing nothing at all... Code: [Select] <?php require('./includes/header.php'); require('./includes/functions.php'); ?> <div id="loginHolder"> <div id="title"></div> <h2>Login</h2> <hr /> <?php if(@$_POST['submit_login']) { echo '<div id="loginBox">'; $username = protect($_POST['username']); $password = protect(encrypt($_POST['password'])); $loginCheckQ = mysql_query("SELECT * FROM `users` WHERE `username`='".$username."'"); $loginCheckF = mysql_fetch_assoc($loginCheckQ); $dbusername = $loginCheckF['username']; $dbpassword = $loginCheckF['password']; if($username == $dbusername && $password == $dbpassword) { $_SESSION['loggedUser']=$username; echo '<font color="green">You have successfully logged in as '.$username.'.</font>'; header('location: index.php'); } else { echo '<span>Incorrect Username or Password.</span>'; } echo '</div>'; } ?> <form action="login.php" method="POST" autocomplete="off"> <table cellspacing="0" cellpadding="0"> <tr> <td>Username: </td><td><input type="text" name="username" /></td> </tr> <tr> <td>Password: </td><td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="Login" class="submit" name="submit_login" /></td> </tr> </table> </form> </div> <?php require('./includes/footer.php'); ?> It works perfectly fine on Localhost, but when I upload it, it doesn't work. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=350642.0 Hi, Im new to all this coding stuff but get by ok with help from the wealth of info on the internet however in this instance i cant solve a PHP redirect issue im having. Ive got a very simple php script to redirect to a secure paypal item link using the header function. header("Location:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XYX96W3MSFQZ6"); The problem is when the script is called upon in IE it loops endlessly however works perfectly in Chrome, Firefox, Opera and the Andriod stock browser. I originally tried the redirect directly within the meta tag although this failed on all browsers so now i have the meta tag point to this PHP file. (The meta tag is in a script that submits form data and displays a temporary 'redirecting...' page. Has anyone expirenced this problem before or know of ways to fix it for IE? Could it be an issue with security in IE because the paypal link is secure? Any help would be greatly appreciated. Hi Everyone, I'm having a bit of a problem if someone could help me with? I have a simple registration form with fields userid, username, password, clientaddress So when the user logs in with their username and password it will redirect to their client address but I cant get the redirect working. Here is my code: Code: [Select] $clientaddress = trim($_POST['clientaddress']); $_SESSION['start'] = time(); header("Location:$clientaddress"); exit; } also note if I add: Code: [Select] $clientaddress = 'http://www.google.com'; it redirects ok to google. It's getting the field from the database I think thats the problem Can somone help it just wont redirect to the client address Hello everyone. I want to use php to obtain the 'location' value from a header of a url. However, when I use get_headers() it automatically follows the redirect and gives me the header information of the new page. I don't want this, I need the headers of the original page. (I need the value of the 'location' variable in the header). Hope you can help me out. Hy i have a GIT repo on a specific location and i need to exec it. so i tooth it was like exec git reset --hard but it executes the command as it was on the base root location. I need before i execute the command to go to my GIT repo location. Can someone help me out? I read about it here http://www.linuxjournal.com/content/bash-redirections-using-exec and if i get it i need a named pipe... but i don't get how i can do it ~.~ i am a exec newbie. Hi! I'm not a very experienced PHPer. I keep getting this error... Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/2/6/j26183102/html/referral.php:11) in /home/content/j/2/6/j26183102/html/referral.php on line 295 Any suggestions? It works on one server but not my customers godaddy hosting site. |