37 users online (0 members and 37 guests)  


  Results 1 to 2 of 2

Related

  1. How to create this counter    Forum: CSS Forum
    Replies: 1
  2. Replies: 0
  3. help for create an account    Forum: Myspace Forum
    Replies: 2
  4. Ignore code and link greeting note code    Forum: HTML Forum
    Replies: 3
  1. #1
    top200's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2014
    Posts
    9

    How would I create a code for something like this?

    I am familiar with php, but I've never worked on this, full time. I read like 4 good books, and I made some php modifications in Wordpress, but in general I work on other things. I would need to create a simple code, which would achieve something like this:

    I want to create an age verification page for an xxx site, and this would be redirecting people to certain model pages, which look like this:

    domain[dot]com/model/sunny-leone-123.html or domain[dot]com/model/kagney-linn-karter-2.html (these numbers are stored in a database, and go from 1 for the first model, to whatever number is the last one, currently I have around 1200 models there, so it is that)

    This is a copy of what I posted somewhere else:

    1) Starting ulrs will look something like this:

    domain[dot]com/e.php?m=sunny-leone (so I will need to store everything after the equal sign in a variable I would say, and obtain it with GET, most likely)

    2) Then search for "sunny-leone" in the database, which looks like this:

    prntscr[dot]com/982yph

    This is in table named "models" and column names are "name" and "record_num"

    The url parameter is "sunny-leone", and the record in the database would be "Sunny Leone", so I would need to make sure I will convert that to the right format or search for it in a certain way.

    After it finds "Sunny Leone", it needs to match it to the "record_num" and create a url like this:

    domain.com/model/"name"-"record_num".htmlt would contain hyphens like "sunny-leone"

    So if record number for "Sunny Leone" would be "123" the url would be looking like this:

    domain.com/model/sunny-leone-123.html

    3) And this needs to be connected to the Yes button, as a link. People will see "Are you 18 or older"? -> They will click yes, and it needs to go to this url.

    I guess this is the best way to do it, get the model name from the entry page url, search for it in the database, construct the url from this, and make it work with the yes button.

    This seems to be fairly easy, but it is kind of hard to figure out how to do it, since I don't work on php every day. If I could get some info, this would be a lot of help.

    (I escaped some urls as I was not able to post)

    Thanks.

  2. #2
    top200's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2014
    Posts
    9

    Re: How would I create a code for something like this?

    I have the following code and it does not work, after adding the database connection and query part (everything before that is correct):

    Code:
    <?php
    $param=$_GET['m'];
    $param=str_replace("-", " ", $param);
    $param=ucwords($param); 
    echo $param; 
    $host="localhost";
    $username="user_name";
    $password="password_here";
    $database_name="database_name_here";
    $link=mysqli_connect('host','username','password','database_name');
    if (mysqli_connect_errno()) {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit();
    }
    $query=$mysqli_query($link, "SELECT column_name FROM table_name WHERE another_column_name='$param'");
    echo $query; 
    mysqli_close($link);
    ?>
    I get the following error:

    "Connect failed: Unknown MySQL server host 'host' (20)"

    ...and the code is correct according to PhpCodeChecker.com.