Jump to content

Recommended Posts

<?php

$username = include("archive/username.txt");

$password = include("archive/password.txt");

if ( $_GET[username] == $username ) {

echo " Hello World ";

} else {

echo " Omg Quackerz "; }

?>

How do I make it so if in title index.php?username= [ get from archive/username.txt ] then say hello world.

Etc for password aswell.

If not either of those, say omg quackerz

Thanks

You cannot assign an include to a variable. You should look into file_get_contents or fopen/fread instead.

 

if(isset($_GET['username']) && file_exists('archive/'.$_GET['username'].'.txt'))
{
    $data['username'] = file_get_contents('archive/'.$_GET['username'].'.txt';
}

if(isset($_GET['password']) && file_exists('archive/'.$_GET['password'].'.txt'))
{
    $data['password'] = file_get_contents('archive/'.$_GET['password'].'.txt';
}

echo '<pre>'.print_r($data, true).'<pre>';

Is this the correction you are looking for?

 

<?php
if(isset($_GET['username']) && file_exists('archive/username.txt'))
{
    $data['username'] = file_get_contents('archive/username.txt');
}

if(isset($_GET['password']) && file_exists('archive/password.txt'))
{
    $data['password'] = file_get_contents('archive/password.txt');
}

echo '<pre>'.print_r($data, true).'<pre>';
?>

<?php

if(isset($_GET['username']) && file_exists('archive/username.txt'))

{

    $data['username'] = file_get_contents('archive/username.txt');

}

 

if(isset($_GET['password']) && file_exists('archive/password.txt'))

{

    $data['password'] = file_get_contents('archive/password.txt');

}

 

echo '<pre>'.print_r($data, true).'<pre>';

?>

 

I want it so that it displays text if ?username=[username.txt]&password=[password.txt] in like pheudo code terms or wteva.

If not then display like "wrong"

Cheers for ur help so far

<?php
$username = $_GET['username'];
$password = $_GET['password'];
if(isset($username) && file_exists('archive/username.txt'))
{
    $data['username'] = file_get_contents('archive/username.txt');
}

if(isset($password) && file_exists('archive/password.txt'))
{
    $data['password'] = file_get_contents('archive/password.txt');
}

echo '<pre>'.print_r($data, true).'<pre>';
?>

 

Then simply if u wanna pull Username and pass type like this:

"Localhost/login.php?Username=carl419&password=Freddyiscool"

 

u can even impliment this into a $_POST['username']; and $_POST['password']; Veriables

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.