Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. Your first RewriteRule RewriteRule ^([a-z]+)/([a-z\-]+)$ /$1/$2.php [L]is going to match the /pages/home url first and send the request over to /pages/home.php. You need to either disable that rule or change their orders so the other one matches first.
  2. RewriteRule ^page/([a-z0-9]+)$ /index.php?page=$1 [L]That would match your /page/home example and translate it into /index.php?page=home. As far has making it look like /page/home in the browser, you just need to type in the URL that way. When you create your links you need to create them using the new friendly format, not the older query-string format. <a href="/page/home">Go Home</a>not <a href="/index.php?page=home">Go Home</a>
  3. Rather than do a meta redirect you should either use a header redirect and exit, or just output the maintenance page and exit. Also, you should not put a redirect if you are not in maintenance mode, as doing so will just put you into an endless redirect.
  4. That is not going to generate the proper URL. You need to generate a URL that looks like this: lissajous.php?T1=##&T2=##&a1=##&a2=## where ## is the value from the slider. To do that you need to concatenate strings and the variables together using the + operator.
  5. A directory on the server or on the client? If on the server, it depends on the source of the image. Assuming this is related to your other threads, you'd use the filename parameter of imagepng If it's from some other source, one of the various filesystem functions would work.
  6. Create another function called UpdateImage which will read the current value of each slider. Then have all your sliders just call that function whenever they change. function UpdateImage(){ var T1 = $('#T1Slider').slider('option', 'value'); ... var url = 'lissajous.php?T1=' + T1 ...; $('#lissajousOutput').attr('src', url); } $('#T1Slider').slider({ change: UpdateImage; });
  7. Your script to generate the image has to be separate from the one with the HTML and sliders. When you generate an image as output then the only output that script can produce is the image, no HTML or even excess whitespace can be present in the output.
  8. Make your $T1 and $T2 variables reference a $_GET variable rather than be static: $Values = $_GET + array( 'T1' => 20 //Default values , 'T2' => 30 //Used if nothing is given ); $T1 = $Values['T1']; $T2 = $Values['T2']; Then you just need to implement the sliders and use some Javascript to update the source of an image tag whenever they change their value. jQuery UI has a slider widget you could use fairly easily. <img src="lissajous.php" id="lissajousOutput"> <div id="T1Slider"></div> <script type="text/javascript"> $(function(){ $('#T1Slider').slider({ change: function(){ var T1 = $(this).slider('option','value') $('#lissajousOutput').attr('src', 'lissajous.php?T1='+T1) } }); }); </script>
  9. You could just link the images to a PHP script that then determines which image to get. Eg: <img src="get-author-image.php?screen_name=<?=urlencode($row2['Twitter'])?>"> <?php $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); $data = $connection->get('statuses/user_timeline', array('screen_name' => $_GET['screen_name'], count=>'1')); if(is_array($data)){ $image = $data[0]->user->profile_image_url; $image = str_replace('_normal', '_bigger', $image); } else { $image = 'http://www.example.com/blank.png'; //Some default image incase the lookup fails } header('Location: '.$image); ?>
  10. There is always the potential for a network connection to fail. Temporary outages, firewalls, etc. You just need to check for such errors and handle them in some way such as re-trying, logging the problem, indicating failure to the end-user, etc.
  11. General advice: 1) Don't post your entire page unless asked for it, people don't want to wade through a bunch of code. Only post the problematic area. 2) Use tags if you want people to look at your code. Regarding problem: 1) Do you get any error message back from mysql_error()? 2) echo $sql and try running the query manually in phpMyAdmin or similar. 3) Make sure your WHERE condition matches rows by using a SELECT query with the same clause.
  12. You could also manually parse it with a regex and use mktime
  13. It'd be best to have a separate background script update a local DB with the status of the files on the various mirrors. Then just list any mirrors that have the file as of the last check. Doing a check of each mirror on each page load will slow down the loading of the page, especially if there are issues (such as the mirror being down). Lastly, present all the mirrors that do appear to have the file, rather than just the first one. Just because a mirror is accessible to you doesn't mean it is accessible to your end user. If it doesn't work for them they need to be able to choose a different mirror. Only listing the first mirror sort of defeats the purpose of mirroring anyway, unless your doing some randomization/geo-locating of the mirrors.
  14. Why are you adding a \n after the value? Do all the value in your database contain a \n at the end also?
  15. stream_socket_client to connect fwrite or fputs to send data, either is fine fread or fgets to receive data, either is fine Read about the IRC protocol in order to actually talk to the IRC server and process data.
  16. Generally speaking, it is the other way around. Someone would obfuscate something in order to make it un-readable to a browser (or bot) but still readable to a human user. Eg, writing an email out as something like someuser (at) somedomain (dot) com makes it so your average email detection software wont see it, but any human user will still understand it. Whether the link is gibberish or not though, if it works then the user can still just use the direct link. If you just want to make it so the URL doesn't contain info like the artist's name/track name then generate some random code for each file and create a database to map the code to the file (or just rename the files). Then use that code to reference the file in the URL.
  17. The simple answer is that your query does not match any rows. Echo out $sql and run it manually to verify it returns data first.
  18. There isn't anything you can do to automatically fill in their form fields. You could maybe generate your own form w/ the data pre-filled and set it's action to their URL. Perhaps if you explain what you're trying to accomplish and why you want to do this we could provide better help.
  19. Try calling ob_flush in addition to flush. Also be aware that there could always be additional buffers between you and the script which you have no control over. For example another apache module (eg mod_gzip), a proxy server, your browser... If you want to have continuous output then flush isn't really the appropriate approach. A more appropriate approach would be to split the job into several small batches and use some AJAX or simple page refreshing to execute each batch and update the screen.
  20. According to the docs the param for mysqli_next_result and mysqli_more_results should be $connection, not $page_set. You may also need to fetch the results, not sure on that. Try: while (mysqli_next_result($connection)){ mysqli_fetch_all(mysqli_store_result($connection)); }
  21. $s = $x will make what is known as a copy-on-write reference to $x. In other words both $x and $s point to the same value, just like if you had use a reference. The difference is that if you ever do anything that would cause either of them to change, eg $s=strtolower($s); then PHP will copy them at that point. So until you perform some sort of modification to either variable, they still only occupy a single instance of memory and there is no additional overhead copying values over. As such, using a reference merely to save memory/reduce overhead is unnecessary. Only use a reference if you have another reason for doing so.
  22. Are you looking for code that will recurse down into all sub directories (and sub's of them and so on) or are you just wanting to find images from a specific subdirectory? If it's a specific sub directory, just pass it as part of the path, eg: foreach (glob('./images/*.png') as $filename) If you want a recursive setup you can look into RecursiveDirectoryIterator or scandir with a loop and stack.
  23. It's used to allow a function the ability to modify a variable. One example is to return an error message from a function, such as how fsockopen does. Another example would be to directly modify an array, such as what sort and related functions do. Passing a variable by reference won't save any memory generally speaking. PHP won't copy a variable's value until it needs (due to a write operation) so if your function never makes a write statement to the parameter then the variable never gets copied and no extra memory is used.
  24. Naw, I generally don't care for it. Mostly that is just because of the implementations I've tried, almost all have sucked and gotten in the way more than they helped really. The only IDE I've used that I did like the completion for was Visual Studio when coding some VB.NET and C# stuff. It was pretty decent at completing structures like if's and loops while still being usable. It also provided suggestions for member functions and pressing enter/'.'/'(' would complete the word. I'm still used to just using my plain text editor without all the fancy ide features. I did pick up a copy of PHPStorm though and have been trying it whenever I work on something new. It's been pretty decent so far but I have a lot to learn about it still.
  25. I don't see why you can't just setup a NAT entry. No NAT system I've ever used required the source and destination ports to match so even if you already have an entry for port 80 going somewhere else you could just add an entry for port 8080 or something that goes to the IPMI IP. So you'd map externalip:8080 -> ipmi_ip:80 If for some reason that wont work for you though, then setup a proxy as suggested by requinix, or an ssh tunnel.
×
×
  • 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.