Jump to content

Search the Community

Showing results for tags 'url'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. Here is a example link: https://site.com/this_here/page.php?note=W+srchttp:>e+have+some+text+here. That shows up fine like it is supposed to, but when I want a image to show up with in it - in html - it makes the whole page wonky. Example Problem: https://site.com/this_here/page.php?note=We+have+some+text+here.+<img src=imagelink.png> I have it on any page that is now set to show an image link that. I used to not have problems with this and now I do. The 'note' text comes from a $_GET and is not decoded or anything - which you shouldn't do I know. I tested by taking out one "<" thinking that was the problem. And that made it so the page wasnt wonky but then you know just the text appeared. I also tested leaving in both "<>" from the img tag and taking out the "=". That also makes it so the page isnt wonky anymore. Does just the same as taking out a "<>". This seems like a really weird error to me, but maybe there is something I should or shouldn't be doing that I am not thinking of.
  2. I cannot seem to figure this bit out. I'm trying to load data from an xml file depending on what the value of a url parameter is. I have an attribute set in my xml, but cannot seem to figure out how to go about this. I've looked at several examples of getting the attribute so I'm not sure where I am wrong since I haven't come across an example using url parameters to determine what data should be fetched. Here is what I have so far. An example of my xml file. There will be more records of piercing in this file. <piercings> <piercing id="default"> <title>Piercing Not Specified</title> <names>N/A</names> <gauge>0</gauge> <healing>0</healing> <risk>None</risk> <description>You must first choose a specific piercing from the menu to view information.</description> <aftercare>Aftercare tips will be available once you choose a specific piercing from the menu.</aftercare> <avoid>Things you should avoid will be listed once a specific piercing has been chosen.</avoid> <img>http://via.placeholder.com/350/000000/676767?text=Not%20Specified</img> <additionalimgs> <additionalimg>http://via.placeholder.com/350/000000/676767?text=Not%20Specified</additionalimg> </additionalimgs> </piercing> <piercing id="incomplete"> <title>Listing Incomplete</title> <names>N/A</names> <gauge>0</gauge> <healing>0</healing> <risk>None</risk> <description>The listing for this piercing is incomplete. Once completed the data will appear on this page. Please check back later.</description> <aftercare>Aftercare tips will be available once you the listing is complete.</aftercare> <avoid>Things you should avoid will be listed once the listing is complete.</avoid> <img>http://via.placeholder.com/350/000000/676767?text=Incomplete</img> <additionalimgs> <additionalimg>http://via.placeholder.com/350/000000/676767?text=Incomplete</additionalimg> </additionalimgs> </piercing> <piercing id="antieyebrow"> <title>Anti-Eyebrow</title> <names>Anti-Eyebrow, Teardrop</names> <gauge>16</gauge> <healing>6 - 8</healing> <risk>Rejection/Migration, Scarring</risk> <description>The anti-eyebrow piercing is located on the upper side of the cheek bone right below the orbital socket of the eye. This piercing is most commonly pierced using a 16 gauge curved barbell or custom bent jewelry. This piercing may also be referred to as a teardrop piercing.</description> <aftercare>It is recommended with this piercing to clean twice a day using saline solution or antibacterial soap. Do not overclean. Irritation from overcleaning can result in migration of the piercing. </aftercare> <avoid>Using rubbing alchohol as a cleaner. Changing the jewelry for atleast 3 weeks although recommended to wait until the piercing is fully healed. Pools/hot tubs especially those with chemical cleaners in them. Swimming holes, creeks, rivers, etc. due to bacterial exposure risk.</avoid> <img>http://jessetoxik.com/img/display/stock/antieyebrow_default.jpg</img> <additionalimgs> <additionalimg>http://jessetoxik.com/img/thumb/stock/antieyebrow_1.jpg</additionalimg> <additionalimg>http://jessetoxik.com/img/thumb/stock/antieyebrow_2.jpg</additionalimg> <additionalimg>http://jessetoxik.com/img/thumb/stock/antieyebrow_3.jpg</additionalimg> </additionalimgs> </piercing> </piercings> So for this one I am trying to pull all of the data for the piercing with the attribute of id="antieyebrow". Here is what I tried to retrieve that. URL: http://example.com/piercing.php?location=antieyebrow. if (file_exists($_SERVER['DOCUMENT_ROOT'].'/info/piercing/piercings.xml')) { $piercingxml = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].'/info/piercing/piercings.xml'); $location = $_GET['location']; $piercingid = $piercingxml['id']; } else { $piercingxml = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].'/info/piercing/default.xml'); $location = "default"; } And finally to display the data onto the page: echo $piercingxml->$piercingid[$location]->title; So far nothing from the file is being displayed. How do I accomplish this? Any help as to where I went wrong would be greatly appreciated.
  3. I have followed a youtube playlist to build a simple MVC framework based on PHP, here is a link to the playlist I have followed. and here is an image of my application structure image I have connected the application to a MySql database, everything is working fine, but now I am trying to do friendly URLs. Currently, my URLs look like the following: mywebsite.com/public/home/property This is fine as this link is for a static page, but I want the same for dynamic URLs, for example: Current URL: mywebsite.com/public/home/property?id=10 to URL: mywebsite.com/public/home/property/id/10 I have tried a lot of methods in htaccss but the data is not pulled from the database once the URL is re-written and I get only an empty page. current .htaccess code (the one that is located in the public folder): Options -MultiViews RewriteEngine On RewriteBase /public RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] I have tried a lot of methods and rules but non have worked. I am not sure if the details I provided are clear enough, I am little confused as I combined a lot of tutorials together to create this app. App.php code: <?php class App{ protected $controller = 'home'; protected $method = 'index'; protected $params = []; public function __construct(){ $url = $this->parseUrl(); if(file_exists('../app/controllers/' . $url[0] . '.php')){ $this->controller = $url[0]; unset($url[0]); } require_once '../app/controllers/' .$this->controller. '.php'; $this->controller = new $this->controller; if(isset($url[1])){ if(method_exists($this->controller, $url[1])){ $this->method = $url[1]; unset($url[1]); } } $this->params = $url ? array_values($url) : []; call_user_func_array([$this->controller, $this->method], $this->params); } public function parseUrl(){ if(isset($_GET['url'])){ return $url = explode('/', filter_var(rtrim($_GET['url'], '/'), FILTER_SANITIZE_URL)); echo $url; } } } ?> controller.php code: <?php class Controller{ public function model($model){ require_once '../app/models/' . $model . '.php'; return new $model(); } public function view($view, $data = []){ require_once '../app/views/' . $view . '.php'; } } ?> controllers code: <?php class home extends Controller{ public function index(){ $this->view('home/index'); } public function listings(){ $this->view('home/listings'); } public function property(){ $this->view('home/property'); } } ?> code for the page that should show data from mysql database: <?php include "includes/head.php"; ?> <?php $property = Property::find_id($_GET['id']); ?> <section id="sub-main"></section> <section id="sub-list"> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-6"> <div id="listingCarousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=585%C3%97380&w=585&h=380" alt=""> </div> <div class="item"> <img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=585%C3%97380&w=585&h=380" alt=""> </div> <div class="item"> <img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=585%C3%97380&w=585&h=380" alt=""> </div> </div> </div> </div> <div class="col-xs-12 col-sm-6"> <h1><?php echo $property->property_name; ?></h1> <ul class="list-inline"> <li><i class="fa fa-map-signs" aria-hidden="true"></i> <b></b> <?php echo $property->city; ?></li> </ul> </div> </div> <hr> <div id="map"></div> </div> </section> <?php include "includes/subscribe.php"; ?> <?php include "includes/footer.php"; ?> The project is online, I can give full access if someone interested in helping me solve this issue.
  4. Say I have directory setup like this. core/ includes/ snippets/ template.php js/ index.php Say in the index.php file, I have a file path like this " include 'snippets/template.php'; ". It works. Or say If I am in template.php and I have a file path like this " include '../index.php'; ". It works as well. I am wondering if there is a more global method to this so I don't have to worry about when to use "../" or not. It becomes hectic if there are a lot of includes and/or links.
  5. Say below is my normal html href link. How would you turn this into a pretty URL using .htaccess? Also if I understand it correctly, this link will also have to be changed to match the pretty url. What would the new link look like? <a href="shop.php?type=45&name=belts">Belts</a>
  6. Typically when you submit a form, it's in a format like this "collections?type='wheels'&make='acura'&year='2016'&model='mdx' ". Instead of that format, I would like to do something like this " collections/wheels/acura+2016+mdx ". How would I go on about doing that format with jquery submit form? This is my setup so far. <script> // Code goes here $(document).ready(function() { $('#search').on('submit', function() { var type = $('#type').val(); var make = $('#make').val(); var year = $('#year').val(); var model = $('#model').val(); var formAction = $('#search-form').attr('action'); $('#search-form').attr('action', formAction + type + make + year + model); }); </script> <form id="search-form" action="/collections/" method="get"> <select id="type" name="type"> // type list goes here </select> <select id="make" name="make"> // make list goes here </select> <select id="year" name="year"> // year list goes here </select> <select id="model" name="model"> // model list goes here </select> <input type="submit" id="search" value="Search"> </form>
  7. I am using a simple image upload. http://www.w3schools.com/php/php_file_upload.asp It gives me 2 errors like this. Warning: move_uploaded_file(C:/xampp/htdocs/home/upload/images/grandpix 2.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\home\upload\post.php on line 174 Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\phpF915.tmp' to 'C:/xampp/htdocs/home/upload/images/grandpix 2.jpg' in C:\xampp\htdocs\home\upload\post.php on line 174 This is my code. Post.php . I see that it's the "$target_dir" issue. How can I fix it? if(isset($_FILES['fileToUpload'])){ if(!empty($_FILES['fileToUpload']['name'])) { $target_dir = $_SERVER['DOCUMENT_ROOT'].'/home/upload/images/'; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { $uploadOk = 1; } else { $errors[] = 'File is not an image.'; $uploadOk = 0; } // Check if file already exists if (file_exists($target_file)) { $errors[] = 'Sorry, file already exists.'; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { $errors[] = 'Sorry, your file is too large.'; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { $errors[] = 'Sorry, only JPG, JPEG, PNG & GIF files are allowed.'; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { $errors[] = 'Sorry, your file was not uploaded.'; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { $errors[] = 'Sorry, there was an error uploading your file.'; } } $insert_image = $db->prepare("INSERT INTO images(user_id, item_id, image_path, date_added) VALUES(:user_id, :item_id, :image_path, :date_added)"); $insert_image->bindParam(':user_id', $userid); $insert_image->bindParam(':item_id', $item_id); $insert_image->bindParam(':image_path', $target_file); $insert_image->bindParam(':date_added', $date_added); if(!$insert_image->execute()) { $errors[] = 'There was a problem uploading the image!'; } else { if(empty($errors)) { $db->commit(); $success = 'Your post has been saved.'; } else { $db->rollBack(); } } } else { $errors[] = 'An image is required!'; } }
  8. Trying to figure out how, when I press my logout button, do I get my page to go back to it's original page without the ?variable=something at the end: header('Location: '.$_SERVER['PHP_SELF'].'?activationsent=1'); I own this site: http://www.golden-wand.com/phpfreaks.txt
  9. Hello, I have problem with my pagination script, I tried to add tags to it but selecting second page (next page) when tag is working and filter content of the page, gets me back to second page with content without tag. It should look like this: gallery/page/2/?s=&tag=2 instead: gallery/page/2 I just dont know what to do. Can you help me out? My pagination script: <?php foreach ($this->pagesInRange as $page): ?> <?php if ($page != $this->current): ?> <li><a href="<?php echo $this->url($this->route, array('page' => $page ), true); ?>"><?php echo $page; ?></a></li> <?php else: ?> <li class="active"><a href="#"><?php echo $page; ?></a></li> <?php endif; ?> <?php endforeach; ?>
  10. Here's the basic premise of the function I am trying to create. 1. User 1 sends a trade request to User 2. 2. User 2 accepts the request. 3. It redirects both users to new page(trade.php). Below is the code where User 2 accepts the request.I am using jquery dialog box for pop windows. The current issue I am having is that "window.location." is not showing the "by=$session_requestById" variable. It appears as NULL if I var_dump on trade.php page. But it is showing the second variable correctly, which is "by=$session_requestToId". It seems like it only happens on trade.php page. Both variables show up fine on request-php.page and in heading when I var_dump. Perhaps you can tell me what's wrong with this ? window.location.href='trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>'; <script> $(function() { $( "#dialog-confirm" ).dialog({ resizable: true, autoOpen: true, modal: true, width: 600, height: 300, buttons: { "Accept Trade": function() { $( this ).dialog( "close" ); $.ajax({ type:"post", url:"request-trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>", data:"action=acceptTrade", success:function(data){ window.location.href='trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>'; } }); }, Cancel: function() { $( this ).dialog( "close" ); $.ajax({ type:"post", url:"request-trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>", data:"action=cancelTrade", success:function(data){ if(data == false) { alert('not cancelled'); } else { alert('cancelled success'); } } }); } } }); }); </script>
  11. Im setting up members on my site i want the profile url to be like www.mywebsite.com/NATHAN but not go to a folder on my server called nathan but instead go to mywebsite.com/?profile=Nathan
  12. Right now my website url appears like this. http://www.mywebsite.com/index.php I was wondering if there is a way to remove the index.php and just have it show like this when someone goes to the website? http://www.mywebsite.com
  13. Here is what I am trying to do. Get from this http://mysite.com/post.php?id=12&title=postname to this http://mysite.com/post/12/postname/ here’s the rewrite rule. Options +FollowSymLinks RewriteEngine On RewriteRule ^post/([a-zA-Z]+)/([0-9]+)/$ post.php?id=$1&title=$2 This is my html link that links to the post.php page. <a href="post.php?id=12&title=postname"> Click here to see the post! </a> It does not change the url. I have also tried it like below and it gives me an internal error. <a href="post/12/postname"> Click here to see the post! </a> Can you see what I have done wrong? Also if the above method for the linking is correct, how do I get the "id" and "title" using the $_GET?
  14. I'm trying to get an equation from a user that types it in the url, ex) 1+2+3. I can get the 1,2,3 fine, but the + operator is no longer in the string. Same with the * and / operators. Is there a way to keep them as a string using $_GET?
  15. I am taking a form that has been created and now trying to incorporate it into WP. The form is filled out multiple times per session. The form when filled out will generate an ID that is used to track the form submissions until completed. The problem that I'm running into is that the code is using a URL structure that breaks on the install. I'm not sure what to tell the code to look for as the URL. I hope I'm making sense. This is my first dive into WP dev. Thanks for the help. <?php /* Template Name: Form */ ?> <?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other 'pages' on your WordPress site will use a different template. * * @package WordPress * @subpackage Twenty_Thirteen * @since Twenty Thirteen 1.0 */ get_header(); ?> <div id="main-content" class="main-content"> <div id="headertitle"> <h1>Steam Trap Form Input</h1> </div> <div id="formtable"> <form class="form-horizontal" role="form" action="/test/FormHandler.php" method="post"> <fieldset> <div class="form-group"> <label for="dateSurvey" class="col-sm-2 control-label">Survey Date</label> <div class="col-sm-6"> <input type="text"<? echo (isset($sd['date']) ? ' value="'.format_date($sd['date']).'"' : '') ?> class="form-control col-sm-6 input-append date" id="dp1" name="dateSurvey" data-date="02-12-2014" data-date-format="mm-dd-yyyy"> </div> </div> <div class="form-group"> <label for="plantName" class="col-sm-2 control-label">Plant Name</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantName"<? echo (isset($sd['plant_name']) ? ' value="'.$sd['plant_name'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="plantLoc" class="col-sm-2 control-label">Plant Location</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantLoc"<? echo (isset($sd['plant_location']) ? ' value="'.$sd['plant_location'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="plantContact" class="col-sm-2 control-label">Plant Contact Name</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="plantContact"<? echo (isset($sd['plant_contact_name']) ? ' value="'.$sd['plant_contact_name'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="pph" class="col-sm-2 control-label">Pound Per Hour</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="pph" placeholder="XX.XX"<? echo (isset($sd['pph']) ? ' value="'.$sd['pph'].'"' : '') ?>> </div> </div> <div class="form-group"> <label for="area" class="col-sm-2 control-label">Area</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="area" placeholder="Boiler Room"<? echo (isset($sd['area']) ? ' value="'.$sd['area'].'"' : '') ?>> </div> </div> <hr> <div class="form-group"> <label for="testDate" class="col-sm-2 control-label">Tested Date</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6 input-append date" id="dp2" name="testDate" data-date="02-12-2014" data-date-format="mm-dd-yyyy"> </div> </div> <!-- <div class="form-group"> <label for="direction" class="col-sm-2 control-label">Direction</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="direction"> <option value="N">N</option> <option value="NE">NE</option> <option value="NW">NW</option> <option value="S">S</option> <option value="SE">SE</option> <option value="SW">SW</option> <option value="E">E</option> <option value="W">W</option> </select> </div> </div> --> <div class="form-group"> <label for="location" class="col-sm-2 control-label">Location</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="location" placeholder=" 'Detailed as possible'"> </div> </div> <div class="form-group"> <label for="flrLevel" class="col-sm-2 control-label">Floor Level</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="flrLevel"> <option value="GROUND">Ground</option> <option value="1st">1st</option> <option value="2nd">2nd</option> <option value="3rd">3rd</option> <option value="4th">4th</option> <option value="5th">5th</option> <option value="6th">6th</option> <option value="7th">7th</option> <option value="8th">8th</option> <option value="9th">9th</option> <option value="10th">10th</option> <option value="11th">11th</option> <option value="12th">12th</option> <option value="13th">13th</option> <option value="14th">14th</option> <option value="15th">15th</option> </select> </div> </div> <div class="form-group"> <label for="elevation" class="col-sm-2 control-label">Elevation</label> <div class="col-sm-6"> <input type="number" class="form-control col-sm-6" name="elevation" placeholder="in feet"> </div> </div> <div class="form-group"> <label for="tagNum" class="col-sm-2 control-label">Tag Number</label> <div class="col-sm-6"> <input type="text" class="form-control col-sm-6" name="tagNum"> </div> </div> <div class="form-group"> <label for="manufacturer" class="col-sm-2 control-label">Manufacturer</label> <? /* <input type="text" name="mmn" size="30"> */ ?> <div class="col-sm-6"> <select name="manufacturer" class="depend col-sm-6 form-control" id="manufacturer"> <option value="" selected="selected" disabled="disabled">Select Manufacturer</option> </select> </div> <div id="status"></div> </div> <div class="form-group"> <label for="model" class="col-sm-2 control-label">Model Number</label> <div class="col-sm-6"> <select name="model" class="depend col-sm-6 form-control" id="model"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="size" class="col-sm-2 control-label">Size</label> <div class="col-sm-6"> <select name="size" class="depend col-sm-6 form-control" id="size"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="pressure" class="col-sm-2 control-label">Pressure</label> <div class="col-sm-6"> <select name="pressure" id="pressure" class="col-sm-6 form-control"> <option value="" selected="selected">Select value</option> </select> </div> </div> <div class="form-group"> <label for="service" class="col-sm-2 control-label">Service</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="service" name="service"> <option value="TRACER">TRACER</option> <option value="HEATER">HEATER</option> <option value="PROCESS">PROCESS</option> <option value="DRIP">DRIP</option> </select> </div> </div> <div class="form-group"> <label for="trapCond" class="col-sm-2 control-label">Trap Conditions</label> <div class="col-sm-6"> <select class="form-control col-sm-6" name="trapCond"> <option value="OK">OK</option> <option value="BT">BT</option> <option value="CP">CP</option> <option value="VO">VO</option> <option value="RCL">RCL</option> </select> </div> </div> <p></p> <div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <? if(isset($surveyID)) { echo '<input type="hidden" name="surveyID" value="'.intval($_GET['survey']).'">'; } ?> <!-- <? if(isset($areaID)) { echo '<input type="hidden" name="areaID" value="'.intval($_GET['area']).'">'; } ?> --> <button class="btn btn-default btn-lg" type="submit" name="submit" value="add">Add Trap</button> <button class="btn btn-primary btn-lg" type="submit" name="submit" value="add_area">Submit Area</button> <button class="btn btn-danger btn-lg" type="submit" name="submit" value="submit">Submit Survey</button> </div> </div> </fieldset> </form> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <!-- <script src="../script/js/script.js"></script> --> <script src="../script/js/live.js"></script> <script src="../script/js/bootstrap-datepicker.js"></script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#dp1').datepicker({ dateFormat : 'dd-mm-yy' }); }); jQuery(document).ready(function() { jQuery('#dp2').datepicker({ dateFormat : 'dd-mm-yy' }); }); </script> </body> </html> <!-- #content --> </div><!-- #primary --> <?php get_sidebar( 'content' ); ?> </div><!-- #main-content --> <?php get_sidebar(); get_footer(); ?> <?php require("../test/base.php"); if(isset($_POST['submit'])) { $url = '../test/form'; // path to form.php if(!isset($_POST['manufacturer'])) { $_POST['manufacturer'] = NULL; } if(!isset($_POST['model_number'])) { $_POST['model_number'] = NULL; } if(!isset($_POST['size'])) { $_POST['size'] = NULL; } if(!isset($_POST['pressure'])) { $_POST['pressure'] = NULL; } $data = prep($_POST); if($data['submit'] == 'add') { if(!isset($data['surveyID'])) { $surveyID = save_survey($data); } else { $surveyID = $data['surveyID']; } save_survey_details($surveyID, $data); if($surveyID) { header('Location: '.$url.'?survey='.$surveyID); } } if($data['submit'] == 'add_area') { if(!isset($data['areaID'])) { $areaID = save_survey($data); } else { $areaID = $data['areaID']; } save_survey_details($areaID, $data); if($areaID) { header('Location: '.$url.'?survey='.$areaID); } } elseif($data['submit'] == 'submit') { if(isset($data['surveyID'])) { save_survey_details($data['surveyID'], $data); } else { $surveyID = save_survey($data); save_survey_details($surveyID, $data); } header('Location: '.$url); } } function prep($input) { $data = array(); if(is_array($input)) { foreach ($input as $key => $val) { $data[$key] = mysql_real_escape_string($val); } } return $data; } function format_date($date = '') { if(isset($date) && $date) { $tmp = explode('-', $date); $d = $tmp[2].'-'.$tmp[0].'-'.$tmp[1]; } else { $d = NULL; } return $d; } function save_survey($data) { $result = mysql_query("INSERT INTO surveys (date, plant_name, plant_location, plant_contact_name, pph, area) VALUES('".format_date($data['dateSurvey'])."','".$data['plantName']."','".$data['plantLoc']."','".$data['plantContact']."','".$data['pph']."','".$data['area']."')") or die('Error: ' . mysql_error()); $result = mysql_query("INSERT INTO area (date, plant_name, plant_location, plant_contact_name, pph, area) VALUES('".format_date($data['dateSurvey'])."','".$data['plantName']."','".$data['plantLoc']."','".$data['plantContact']."','".$data['pph']."','".$data['area']."')") or die('Error: ' . mysql_error()); return mysql_insert_id(); } function save_survey_details($surveyID, $data) { $result = mysql_query("INSERT INTO survey_details (survey_id, tested_date, direction, location, floor_level, elevation, tag_number, manufacturer, model_number, size, pressure, service, trap_conditions) VALUES($surveyID, '".format_date($data['testDate'])."','".$data['direction']."','".$data['location']."','".$data['flrLevel']."','".$data['elevation']."','".$data['tagNum']."','".$data['manufacturer']."','".$data['model']."','".$data['size']."','".$data['pressure']."','".$data['service']."','".$data['trapCond']."')"); $result = mysql_query("INSERT INTO area_details (survey_id, tested_date, direction, location, floor_level, elevation, tag_number, manufacturer, model_number, size, pressure, service, trap_conditions) VALUES($surveyID, '".format_date($data['testDate'])."','".$data['direction']."','".$data['location']."','".$data['flrLevel']."','".$data['elevation']."','".$data['tagNum']."','".$data['manufacturer']."','".$data['model']."','".$data['size']."','".$data['pressure']."','".$data['service']."','".$data['trapCond']."')"); //or die('Error: ' . mysql_error()); } ?>
  16. I am new to website development. I can't figure out how to open a new tab for the following javasript. I went through related questions but nothing worked for me. I want the browser to open a new tab when someone clicks on the link (example.com) below. The code target="_blank doesn't work here... What code should I add and where should I place that code? My html code is here - <section id="work-grid" class="site-inner"> <div class="work-item" data-groups='["all", "webdesign"]' data-url="http://example.com"> <figure class="image-container"><img src="images/work/web-one.jpg" /></figure> </div> Thanks in advance.
  17. Hi Everyone.. I am not sure if I should post this question here. I would like to fix this problem using PHP rather than HTML. I am new to PHP. This code is part of an old PHP gallery file. I am trying to validate my site but the site's links have some characters that makes the link throw errors in W3C Validator. So I tried to replace the characters with HTML characters for example ? are now replaced by ? so my original link before using valid HTML characters looked like www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-art And now it looks like this ... www.awebsite.com/viewgallery.php?cname=Colorado-Fall&pcaption=Lost-In-The-art But now W3C Validator shows an error like this The ? for replacing ? seems to be the problem.The & is highlighted in red. What am I doing wrong? How can I validate this link? I tried to use single or double quotes around HTML characters but that breaks my links and they won't work after that. Any tips will be appreciated...
  18. Hello - hoping to find some direction with this. I think this is fairly simple for more experienced php coders but I'm having trouble with it. It's a php grep text string search that results in a list of files that contain the string. Hoping to split the $results value (list of file names) into separate links to open the file. I was able to convert into a link for the first file listed, but it links to that same file for all the entries in the list. I assume that maybe an array of $results needs to be created first rather than try and work with $results at the end? <?php /** * E.Yekta * cafewebmaster.com */ define("SLASH", stristr($_SERVER[SERVER_SOFTWARE], "win") ? "\\" : "/"); $path = ($_POST[path]) ? $_POST[path] : dirname(__FILE__) ; $q = $_POST[q]; function php_grep($q, $path){ $fp = opendir($path); while($f = readdir($fp)){ if( preg_match("#^\.+$#", $f) ) continue; // ignore symbolic links $file_full_path = $path.SLASH.$f; if(is_dir($file_full_path)) { $ret .= php_grep($q, $file_full_path); } else if( stristr(file_get_contents($file_full_path), $q) ) { $ret .= "$file_full_path\n"; } } return $ret; } if($q){ $results = php_grep($q, $path); } echo <<<HRD <pre > <form method=post> <input name=path size=100 value="$path" /> Path <input name=q size=100 value="$q" /> Query <input type=submit> </form> $results </pre > HRD; ?> php_grep.php
  19. Hello, I want to know how they keep the same url when page is changing, if you dont know what i mean try the link and check the browser when you wat happens when you click in a other link in the website. ( Website Link ( Normal Content ) ) http://geedmo.com/?item=LushSlider Thanks in advance.
  20. Hi all, So im trying to improve on my PHP as my knowledge isn't that great. lets say for argument sake my ip is: im trying to set a external variable to set this as the url. so on each page i use, for each link instead of typing out the ip address i can simply type: <a href="{url}/index.php">Home</a> and then if it is possible, to do something like this: <link rel="stylesheet" href="{url}/main.css" type="text/css"> all in one file so in my php pages i can simple include 1 php file and it will have all of the relevant stylesheets ect linked to it.
  21. hi, im trying to create a website and only now started thinking about the security part(noob mistake). say for example i have home.php page and an index.php page. index.php is where users would sign up/log in. the login and sign up processes are all done but i was thinking of creating a unique id of some sort for when the user logs in. or something like this site (forum.phpfreaks) when we sign in, you are signed but the url stays the same = forums.phpfreaks.com. like if we were signed out we will be permanantly signed out and typing in forums.phpfreaks.com would just land us at the main page where we need to sign in. right now ,my home.php can be accessed with or without logging in even with sessions. hope im making sense, thanks in advanced! **haha that rhymed. i tried adding: <?php echo $_SERVER[php_SELF] . '?name=' . $userData['name'];?> in the index.php: <?php ob_start(); session_start(); if(isset($_POST['login'])) { $email = $_POST['email']; $password = $_POST['pass']; require "connection.php"; $emails = mysqli_real_escape_string($con, $email); $query = "SELECT id, name, email, password, salt FROM users WHERE email = '$emails';"; $result = mysqli_query($con, $query); if(mysqli_num_rows($result) == 0) // User not found. So, redirect to login_form again. { echo "<script>alert(\"User does not exist!\")</script>"; } $userData = mysqli_fetch_array($result, MYSQLI_ASSOC); $hash = hash('sha256', $userData['salt'] . hash('sha256', $password) ); if($hash != $userData['password']) { echo "<script>alert(\"Incorrect Password!\")</script>"; }else{ session_regenerate_id(); $_SESSION['sess_user_id'] = $userData['id']; $_SESSION['sess_name'] = $userData['name']; session_write_close(); header('Location: home.php?user='); } } ob_flush(); ?> <!DOCTYPE html> <form name="login" method="post" action="<?php echo $_SERVER[PHP_SELF] . '?name=' . $userData['name'];?>"> but i got access forbidden!
  22. I didn't notice this until know. Say I have a url like this. http://www.yoursite.com?category_id=3&category_name= Grocers & Shoppers When I get the the category name using $_GET, it'll only echo 'Grocers' and not the full word 'Grocers & Shoppers'. Anyone can tell me what's happening?
  23. I am trying to set variables with $_GET from the url... caption.php?image=53348b3068f36.jpg&topcaption=sdfas&bottomcaption=asdfadf if (isset($_GET['image'])){ $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption'];
  24. I have a problem when I share a link of my website, that remains "static". I mean: when I share an article (link www.mysite.net/?guid=VALUE) in social networks, the post text is normal, but when I click in the article picture or title, the link that opens is the "normal" of my website (www.mysite.net). The title and description not change too. Code: <META ITEMPROP="name" CONTENT="text/html; charset=utf-8"> <?php include("login/db_connect_open.php") ; ?> <?php if (isset($_REQUEST["guid"])) { $guid = mysql_real_escape_string($_REQUEST["guid"]); // sanitize the guid $query = "SELECT * FROM news WHERE news_guid='".$guid."'"; $result = mysql_query($query); $row = mysql_fetch_array($result); ?> <div class="twelve columns"> <div class="row"><h3 class="n3"><?php echo $row["news_title"]; ?></h3> </div> </div> <div class="row"><!-- Row interior--> <div class="twelve columns"> <div class="panel"> <p id="data"><?php echo $row["news_date"]; ?>, <?php echo $row["hour"];?> GMT</p> <p><?php echo $row["news_post"]; ?></p> </div></div></div> <?php } else ?> <div class="twelve columns"> <div class="row"><h3 class="n3">Destaques</h3> </div> <div class="row"> <?php { $query = "SELECT * FROM news WHERE destaque='Sim' and publicado='sim' ORDER BY news_id DESC LIMIT 4"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo "<div class='three columns'>"; echo "<a href='?guid=".$row["news_guid"]."' class='div-link'>"; echo "<div class='desc-new'>"; //imagem echo "<div class='img-block'><img src='".$row['news_image']."' title='".$row["news_title"]."' alt='".$row["news_title"]."'/></div>"; //texto echo "<h4 class='new-title' onmouseover='none'>".$row["news_title"]."</h4>"; echo "<h4 class='new-subtitle' onmouseover='none'>".$row["news_subtitle"]."</h4>"; echo "<aside><p>".$row["news_desc"]."</p><p class='datapeq'>".$row["news_date"].", ".$row["hour"]."</p></aside>"; echo "</div>"; echo "</a>"; echo "</div>"; } } ?> </div></div> <!-- Fim de row interior --> <?php include("login/db_connect_close.php") ; ?>
  25. Hey, I have looked around everywhere possible to find a way of doing this and just cant seem to do it. So.. i have 1 Page with holds 4 extentions e.g ?table1=show to ?table4=show. Im wondering how i get one of my tables to have a & aswell so like ?table4=show&id=1.. but when im clicking the word to add the & to URL its just taking th table out and going to ?content=show. To make a & is $_GET anygood or should that be used for ? only? Thanks in advance and sorry if this is hard to understand.
  • 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.