Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

2014-02-19

Level Up - Webmaster: How To Randomly Redirect Visitors To Different Websites

There is a very simple method using PHP to have visitors automatically redirected to another site.

Why this is useful:
- User clicks "Take me to a random" page. You can finely-tune the random outcome.
- You are doing some A/B testing and want to sent users to different locations to test.
- Or, like me, you want to share your various websites/games, from a single button.

Try clicking
Ex: http://apps.simplyadvanced.net/windows8/redirect

Step 1: Here's all the PHP code that you need:

$urls = array("siteA.com",
              "siteB.com",
              "www.example.com"); $url = $urls[array_rand($urls)]; header("Location: http://$url"); ?>

Step 2: Done

Or, if you want to redirect the visitor after they visit a certain URL on your domain, then simply create an "index.php" file in the public directory that you want users to be redirected from, then the above code is all that you need to put in it.

Try it: Random Windows 8 Games created by me.
Try it: Random Windows Phone Games created by me.

~ Danial Goodwin ~



2014-02-09

Level Up - Webmaster: Setting Up Your First Laravel Website Or App

(For webmasters, a continuation on my last post Level Up - Webmaster: Installing Laravel and Composer on Bluehost.)

This walkthrough contains all the instructions I would have needed on one page, rather than looking through twenty different pages. This is a blunt how-to for connecting to a database with Laravel and displaying information. At the end are links for more specific and advanced info.

The following has explicit instructions and commands for a shared hosting provider like Bluehost, but the instructions should be the roughly the same for other providers and setups. I suggest to follow the steps explicitly the first time through, then run through it a second time with your specific project's names.

0. This simple "tutorial" assumes that you already know a little bit about Laravel and have possibly read my first install and setup walkthrough.

Setup the database:
1. Create a database on your server with a user and password.
2. From your root project folder, edit app/config/database.php to match your new database credentials.
3. In your root project directory, run php-cli artisan migrate:make create_users_table
4. You should now have the file that looks something like: app/database/migrations/2014_02_09_195357_create_users_table.php. Edit the up() and down() function to look like:
    public function up()
    {
        Schema::create('users', function($table)
        {
            $table->increments('id');
            $table->string('email')->unique();
            $table->string('name');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::drop('users');
    }
5. Now, back in the project root dir, run: php-cli artisan migrate
6. At this time, your tables in the database will be automatically created. Add some data manually so that we can test that retrieving data works.

Create a view:
7. Create a route (subdirectory pointer) in app/routes.php by adding the following code:
    Route::get('users', function()
    {
        $users = User::all();

        return View::make('users')->with('users', $users);
    });
8. Create two new views in app/views. Call the first one layout.blade.php and add this code:
   
       
           

Laravel Quickstart



            @yield('content')
        
    
Create the second view, called users.blade.php:
    @extends('layout')

    @section('content')
        @foreach($users as $user)
            {{ $user->name }}
        @endforeach
    @stop
9. Go to your doman.com/users and you should have all the user names from the database displayed on the page.


Note:
- If the php-cli command doesn't work for you, then try just php


More info:

2013-12-27

Google Search Answers

For some search queries, Google displays an answer at the top or right of the results. In order to get these results Google usually has to scrape content off of other sites. So,

Is it possible to scrape Google's answers off their search results page, which they have scraped off of others?

I'm sure it is. I just don't just have time to look it up, so that's why I'm sharing.

Have fun,
~ Danial Goodwin ~



2013-05-22

Simply Advanced Mobile App Development Website Updated

Hello,

Please check out my new design of Simply Advanced's home page. It's live now. Another surprising discovery is that my website shows first when searching for "Simply Advanced". You can access it by clicking the first result in: https://www.google.com/search?q=simply+advanced

Let me know what you think. =]
~ Simply Advanced ~