Jump to content

gffg4574fghsDSGDGKJYM

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by gffg4574fghsDSGDGKJYM

  1. Put the $_GET inside isset <?php if (isset($_GET['uk'])) { $x = $_GET['uk']; } else { $x = "default value"; } ?> is that what you are looking for ?
  2. Your first part : RewriteCond %{HTTP_HOST} ^www.mysite.co.uk$ [NC] RewriteRule ^(.*)$ http://www.mysite.com/$1 [R,PT] Will only rewrite request from www.mysite.co.uk to www.mysite.com. This can be bad if someone type mysite.com or mysite.co.uk. This will rewrite everything that not www.mysite.com : RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] RewriteRule ^(.*)$ http://www.mysite.com%{REQUEST_URI} [L,R=301] All request by IP adress, mysite.co.uk, www.mysite.co.uk and mysite.com or any other request that not www.mysite.com will be SEO-friendly redirected to www.mysite.com. If you have many domain in the same root folder you can use this to redirect the www and no-www version to a www.mysite.com version. RewriteCond %{HTTP_HOST} ^(.*)mysite\.co.uk$ [NC] RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC] RewriteRule ^(.*)$ http://www.mysite.com%{REQUEST_URI} [L,R=301] For the https part you can use : RewriteCond %{HTTPS} off RewriteRule ^quote(.*)\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Anything that not https AND start with quote AND end with php will be redirected to a https. You can maybe use the full filename instead of wildcards to prevent someone to play with it, though i hardly see how can someone use that to break security, in the end it will always end up in a 301 redirect to your website. To add more safety you can add in your php file something to test if you are on https or not, you can use many variables to make this script domain and file name independent and/or require_once(''); it on each page you need to be secure with https : <?php if ($_SERVER['HTTPS'] ....) { /* raise a error or redirect to a https page */ header('Location: https://www.somesite.com/somepage.php'); } ... ?> The complete code will look like this (untested of course but should work fine) : Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] RewriteRule ^(.*)$ http://www.mysite.com%{REQUEST_URI} [L,R=301] RewriteCond %{HTTPS} off RewriteRule ^quote(.*)\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] The order of the rewritecond/rewriterule is important since you don't want a request like http://mysite.co.uk/quote2.php to be redirect to a https://mysite.co.uk/quote2.php http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
  3. `viewed` int(30) DEFAULT '0', is a little bit weird since INT datatype can't be display in more than 11 digits (with the - negative sign) should be : `viewed` int(11) DEFAULT '0', I'm not sure exactly what wrong with your query but you can try adding a index to your viewed field and read this : http://dev.mysql.com/doc/refman/5.1/en/order-by-optimization.html http://dev.mysql.com/doc/refman/5.1/en/using-explain.html
  4. Re-login and get a new cookie each time, you have to emulate what a user would do. <?php /* Config ------------------------------------------------------------- */ $timeout = 15; /* timeout in seconds */ $cookiefilename = "cookie.txt"; /* this isn't thread safe unless you find a way to make unique filename */ /* Login to the site and save the cookie ----------------------------- */ $post = "account=blablabla&password=blablabla"; $ch = curl_init("http://www.somesite.com/login.php"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefilename); curl_setopt($ch, CURLOPT_HEADER, true); $output = curl_exec($ch); curl_close($ch); /* Test the $output to be sure you get a HTTP code 200 (success) and look into the html to be sure you are logged */ /* do what you have to do on that site you can repeat this as many url you need to see use cookiejar again if the cookie change else use cookiefile */ $ch = curl_init("http://www.somesite.com/somefolder/somefile.php"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefilename); curl_setopt($ch, CURLOPT_HEADER, true); $output = curl_exec($ch); curl_close($ch); /* Test the $output to be sure you get a HTTP code 200 (success) and grab the html for whatever you need it */ /* logout ------------------------------------------------------------- */ $ch = curl_init("http://www.somesite.com/logout.php"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefilename); curl_setopt($ch, CURLOPT_HEADER, true); $output = curl_exec($ch); curl_close($ch); /* Test the $output to be sure you get a HTTP code 200 (success) and look into the html to get a string that show you you have logout properly */ /* delete the cookie file */ unlink($cookiefilename); ?> It not tested but it should work or at least give you a basic idea how it's done. You need to add a lot of if to be sure the script won't crash, and it will need to be modified each time the target site change. That why it's always better to use API instead of that, but some site just don't provide a API so you have no choice sometime.
  5. <?php ... $MAX_COLUMNS = 3; /* Max row to display*/ $columns = 1; /* start at row 1 */ echo "<table align=\"center\"><tr>"; while ($newArray = mysqli_fetch_array($eventImages_res, MYSQLI_ASSOC)) { $path = $newArray["path"]; echo "<td><a href=\"cms/".$path."\" target=\"_blank\"><img src=\"cms/".$path."\" width=\"150\" height=\"100\"></a></td>"; $columns = $columns + 1; if ($columns > $MAX_COLUMNS) { $columns = 1; echo "</tr><tr>"; } } /* Fill the missing cell if image numbers aren't multiple of $MAX_COLUMNS to make valid HTML markup and be sure it will be display properly on all browser */ while ($columns > $MAX_COLUMNS) { $columns = $columns + 1; echo "<td></td>"; } echo "</tr></table>"; ... ?> May not be the most efficient way to do it but it should work. May need some tweak as i haven't tested it. You should maybe add a mysql_num_rows and skip the whole thing if you don't have any image to display.
  6. Yes site age have good impact for SEO. 4 in the Top 10 Positive Factors for SEO. From : http://www.seomoz.org/article/search-ranking-factors As far i know underconstruction page while NOT get you any age of document 'SEO bonus'.
  7. if($_POST['submit']) //If submit is hit { The page don't execute since you have POST for the first page then GET for the others page. When you click next your page only have $_GET and no $_POST['submit'].
  8. Read : http://www.php.net/manual/en/function.file-exists.php as some people already posted some code workaround for file_exists() (with URL) to work with older php version. Some with cURL, get_headers() or fsockopen(). New php version >= 5.0.0 seem to natively support http protocol with file_exists() function though i never try that. I always used file_exists() only for local file and a home made version for testing URL.
  9. I think you are looking for something like that Propel http://propel.phpdb.org/trac/
  10. weird..it should work, maybe the error is here : mod_gzip_minimum_file_size 1002 mod_gzip_maximum_file_size 1000000 What the size of your .js file ? Wait did you use mod_gzip OR mod_deflate ? (or both?)
  11. Adding this in pitchsearch.php would probably help a lot : ... $pitches = mysql_query($select . $from . $where); if (!$pitches) { echo '</table>'; echo '<p>SQL : '.$select . $from . $where.'</p>'; echo '<p>error getting pitches from the database<br />' . 'Error'. mysql_error() . '</p>'; echo "<p> $pitches </p>"; } ... So we can see the exact SQL query that raise that error. Just don't forget to comment it when you're done debugging.
  12. ... echo $row['in_return']; //good echo "</td></td>"; echo "<img src=\"images/K_little.png\">"; ... Closing 2 td instead of closing then opening a td Use : ... echo "</td><td>"; ... Next time try validate your html code before posting into a forums for help : http://validator.w3.org/ That kind of error is easly found by the validator
  13. You can't run a server-side script PHP function with a client side javascript. AJAX http://www.google.com/search?q=ajax is probably what you are looking for....
  14. It's probably a wrong datatype. Use integer instead of string/varchar.
  15. Use : curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); To store the cookie in a file. (Usually on the first request when you login) Then : curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); To use the cookie in your next request. Of course you will need write access to the directory to create/write the file. I think you can also directly read/write http header to read/set cookie with curl but i never try this so far. http://www.php.net/manual/en/function.curl-setopt.php
×
×
  • 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.