Jump to content

Craig Hopson

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by Craig Hopson

  1. OK so i have this snipit of code and it's making me look like a fool

    <?php$url="All other trademarks and material are the prop of their respectful owners";$site = file_get_contents("https://www.footle.net");if (strpos($site,$url) !== false) {   echo 'GOOD'; } else {   echo 'BAD';}?>

    Works fine on my server but my clients server gives this error

    Warning: file_get_contents(https://www.footle.net) [function.file-get-contents]: failed to open stream: No such file or directory in /usr/local/apache2/htdocs/test-1.php on line 3BAD
    PLEASE help me work round this
  2. hi how can i check if the web server is apache, i have the crontab script which only works on apache servers so i would like something like

    if($_SERVER['server_software'] == 'apache'){// do something here}

    My server is apache yet if i echo "$_SERVER['server_software'];" it says its LiteSpeed which is based on apache Question:-How can i check if the web server is apache

  3. Got it to work now

    file_put_contents('crontab.txt','0 * * * * php /home/chsitesc/delete1.php'.PHP_EOL);echo exec('crontab crontab.txt');$output = exec('crontab -l');echo $output;$myFile = "crontab.txt";unlink($myFile);

  4. hi guys im stuck again this is what i have so far but it wont work

    <?php$data = '0 0 * * * /usr/local/bin/php $HOME/public_html/run_this_script.php';file_put_contents('cron.txt', $data, FILE_APPEND);exec("/usr/bin/crontab cron.txt", $output, $return);if($return === 0) {echo 'Cron Successful';} else {echo 'Cron Unsuccessful';}echo "<br />\nOutput:<br /><br />";var_dump($output);echo "<br /><br />done!";?>

  5. Still cant get this code to work i have broken it back to basics still giving error

    $test = "http://seekface.com/themes/blue/ico.gif";$URL = "www.seekface.com";echo preg_replace($URL," ",$test);

  6. Is there an example of this i had a little search and made this

    <!DOCTYPE html><?phpecho '<h1> Testing</h1>PLEASE ADD THIS CODE TO YOUR SITES FRONT PAGE<pre style="background:green;padding:20px;"><div id="backlink"><a href="http://twitterrooms.co.uk"><img src="http://twitterrooms.co.uk/themes/charcoal/twitterrooms5.png"></a></div></pre><form action="test.php" method="post">Site: <input type="text" name="site" placeholder="http://example.com" /><input type="hidden" name="check" value="1"/><input type="submit" value="Check" /></form>';if($_POST['check'] == 1){if($_POST['site'] == ''){echo 'Please enter a site';}else{$haystack = file_get_contents($_POST['site']);$needle = '<div id="backlink"><a href="http://twitterrooms.co.uk"><img src="http://twitterrooms.co.uk/themes/charcoal/twitterrooms5.png"></a></div>';if (strpos($haystack,$needle) !== false) {    echo 'FOUND IT';}else{    echo 'ITS NOT THERE';}$_POST['check'] = 0;}}//echo'<div id="backlink"><a href="http://twitterrooms.co.uk"><img src="http://twitterrooms.co.uk/themes/charcoal/twitterrooms5.png"></a></div>';?>

  7. I was looking through ebay at old work stations and found 2x 8core xeon setups for well in your budget here is an example but its in UK but still cheaphttp://www.ebay.co.uk/itm/HP-XW8400-2x-Quad-Core-Xeon-X5355-Tower-Server-16GB-RAM-500GB-SATA-RAID-Storage-/110901556065?pt=UK_Computing_Servers&hash=item19d23f7361

  8. Hi all some has asked me to right a script for them but i'm not shore what they want this is what they said to me.... i want something that will give a code of my banner...and members put that code on their websites ...then something checks to see if the code is really there..then it will allow that member to put his link on my site. Question 1...Is there a pre-made script for this already?Question 2...If not i assume i would use a cron job?Question 3...How can i make a script check another site's content? Thanks

  9. Thanks for the quick responce i have read that but really dont understand. The top script does support paging and limiting and puts results in a table i dont want all that just yet i want to learn...do you know/Can you convert top script into its most basic form ie the bottom script

  10. hi guys i'm stuck i'm trying to query in drupal, here is what works

    function browse_output() {   $query = db_select('users', 'd')->extend('PagerDefault');  $query->fields('d', array('uid', 'name', 'picture'));  $result = $query    ->limit(10)     ->orderBy('d.uid')    ->execute();  $rows = array();  foreach ($result as $row) {    $rows[] = array('data' => (array) $row);  }  $build['pager_table'] = array(    '#theme' => 'table',    '#rows' => $rows,    '#empty' => t('There are no date formats found in the db'),  );  $build['pager_pager'] = array('#theme' => 'pager');  return $build;}

    and this displays a table with user id, name, and picture(number)ok i know it works but i dont understand what is going on in the code and why cant i do it like this

    $result = mysql_query("SELECT * FROM users");while($row = mysql_fetch_array($result))  {  echo $row['picture']." ".$row['id']." ".$row['name'];  echo "<br />";   }

    ANY advice on this would help and yes i've read the documentation but cant make much sence from it i got the function browse_output from the examples on the Drupal site Thanks

×
×
  • Create New...