Jump to content

chriscloyd

Members
  • Posts

    488
  • Joined

  • Last visited

Posts posted by chriscloyd

  1. here is this plosable if not how could i do it?

    [code]
    <?php
    <?php
    $get_staff = mysql_query("SELECT * FROM users WHERE level = 'admin' AND level = 'staff' AND level = 'sales'");
    while ($staff_info = mysql_fetch_assoc($get_staff)) {
    $id = $staff_info['id'];
    $name = $staff_info['first'].' '.$staff_info['last'];
    $email = $staff_info['email'];
    echo '<tr>
    <td><div align="center">'.$id.'</div></td>
    <td><div align="center">'.$name.'</div></td>
    <td><div align="center">'.$email.'</div></td>
    <td><div align="center">
    <form name="form1" id="form1">
    <select name="menu1" onchange="MM_jumpMenu("parent",this,0)">
    <option>Commands</option>
    <option value="staff.php?page=sales&aid='.$id.'">Convert To Sales</option>
    <option value="staff.php?page=admin&id='.$id.'">Convert To Admin</option>
    <option value="staff.php?page=staff&id='.$id.'">Convert To Staff</option>
    <option value="staff.php?page=edit&id='.$id.'">Edit</option>
    <option value="staff.php?page=delete&id='.$id.'">Delete</option>
    <option value="staff.php?page=ban&id='.$id.'">Ban</option>
    </select>
    </form>
    </div></td>
    </tr>';
    }
    ?>[/code]
  2. okay i changed it all to one page lol just bc i wanna get it to work for now
    but now its just saying wrong info but i check and it is right info
    [CODE]
    <?php
    session_start();
    include("config.php");
    include("functions.php");
    error_reporting(E_ALL);
    ini_set('log_errors','1');
    ini_set('display_errors','0');
    //login
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    if (isset($_POST['username'])){
    $users = mysql_query("SELECT * FROM users WHERE username = '$username'");
    if ($users) {
    $count_users = mysql_num_rows($users) or die('ERROR: '.mysql_error());
    $timendate = date("n/j/Y g:i:s A");
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    $ip = $_SERVER['REMOTE_ADDR'];
    $description = 'Login';
    if ($count_users > 0) {
    $user_info = mysql_fetch_array($users) or die('ERROR: '.mysql_error());
    if ($user_info['username'] == $user) {
    if ($user_info['password'] == $password) {
    $login = '1';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home";
    } else {
    $location = "http://localhost/index.php?page=home";
    }
    $status = 'Success';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $login = '0';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    }
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $login = '0';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    }
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    $login = '0';
    }
    } else {
    $error = 'No such user!';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    $login = '0';
    }
    if ($login == '1'){
    $_SESSION['ccloyd'] = $username;
    header("Location: ".$location);
    } else {
    header("Location: ".$location);
    }
    }
    ?>
    [/CODE]
  3. i just checked the log file for erros and i have this error
    [Tue Jan 02 01:34:48 2007] [error] [client 127.0.0.1] PHP Notice:  Undefined variable: login in C:\\xampp\\xampp\\htdocs\\includes\\login.php on line 13, referer: http://localhost/
    [Tue Jan 02 01:34:48 2007] [error] [client 127.0.0.1] PHP Notice:  Undefined variable: location in C:\\xampp\\xampp\\htdocs\\includes\\login.php on line 17, referer: http://localhost/
  4. Its not redirecting me anywhere it stays on the login.php page and its not even showing any errors

    heres my first part of the process login.php
    [code]
    <?php
    session_start();
    include("config.php");
    include("functions.php");
    error_reporting(E_ALL);
    ini_set('log_errors','1');
    ini_set('display_errors','0');
    //login
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    if (isset($_POST['username'])){
    login($username,$password);
    if ($login == '1'){
    $_SESSION['ccloyd'] = $username;
    header("Location: ".$location);
    } else {
    header("Location: ".$location);
    }
    }
    ?>
    [/code]
    heres my function functions.php
    [CODE]
    <?php
    function login($user,$pass){
    $users = mysql_query("SELECT * FROM users WHERE username = '$user'");
    if ($users) {
    $count_users = mysql_num_rows($users) or die('ERROR: '.mysql_error());
    $timendate = date("n/j/Y g:i:s A");
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    $ip = $_SERVER['REMOTE_ADDR'];
    $description = 'Login';
    if ($count_users > 0) {
    $user_info = mysql_fetch_array($users) or die('ERROR: '.mysql_error());
    if ($user_info['username'] == $user) {
    if ($user_info['password'] == $pass) {
    $login = '1';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home";
    } else {
    $location = "http://localhost/index.php?page=home";
    }
    $status = 'Success';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $login = '0';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    }
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $login = '0';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    }
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    $login = '0';
    }
    } else {
    $error = 'Wrong User Info';
    if ($_SERVER['HTTP_HOST'] == "www.christophercloyd.com") {
    $location = "http://www.christophercloyd.com/index.php?page=home&false=".$error;
    } else {
    $location = "http://localhost/index.php?page=home&false=".$error;
    }
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    $login = '0';
    }
    if ($login == 1) {
    return $login;
    return $location;
    } else {
    return $login;
    return $location;
    return $error;
    }
    }
    ?>
    [/CODE]
  5. [CODE]
    <?php
    session_start();
    include("config.php");
    error_reporting(E_ALL);
    ini_set('log_errors','1');
    ini_set('display_errors','0');
    //login
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $timendate = date("n/j/Y g:i:s A");
    if (isset($_POST['username'])){
    $get_user = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    $numusers = mysql_num_rows($get_user) or die(mysql_error());
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    $ip = $_SERVER['REMOTE_ADDR'];
    $description = 'Login';
    if ($numusers > 0) {
    $user = mysql_fetch_array($get_user) or die(mysql_error());
    if ($username == $user['username']) {
    //check_passwords now
    if ($password == $user['password']) {
    $_SESSION['ccloyd'] == $username;
    $status = 'Success';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../index.php?page=home");
    } else {
    $error = 'Wrong Login Info.';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../index.php?false=$error");
    }
    } else {
    $error = 'Wrong Login Info.';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../index.php?false=$error");
    }
    } else {
    $error = 'Wrong Login Info.';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../index.php?false=$error");
    }
    }
    ?>
    [/CODE]


    i just updated it and its still not redirecting
  6. okay i made my login script and for whatever reason its not returning to any page

    heres my code

    [code]
    <?php
    error_reporting(E_ALL);
    ini_set('log_errors','1');
    ini_set('display_errors','0');
    session_start();
    include("config.php");
    //login
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $timendate = date("n/j/Y g:i:s A");
    $get_user = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    $numusers = mysql_num_rows($get_user) or die(mysql_error());
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    $ip = $_SERVER['REMOTE_ADDR'];
    $description = 'Login';
    if ($numusers > 0) {
    $user = mysql_fetch_array($get_user) or die(mysql_error());
    if ($username == $user['username']) {
    //check_passwords now
    if ($password == $user['password']) {
    $_SESSION['ccloyd'] == $username;
    $status = 'Success';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../?page=home");
    } else {
    $error = 'Wrong Login Info.';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../?false=$error");
    }
    } else {
    $error = 'Wrong Login Info.';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../?false=$error");
    }
    } else {
    $error = 'Wrong Login Info.';
    $status = 'Failed';
    mysql_query("INSERT INTO logs (`ip`,`hostname`,`description`,`timendate`,`status`) VALUES ('$ip','$hostname','$description','$timendate','$status')") or die(mysql_error());
    header("Location: ../?false=$error");
    }
    ?>
    [/code]
  7. heres my problem
    im creating a script so a person can not register an account from the same ip or have the same username or same email as any other users so heres the problem i created the script but it seems to just skip right over it even tho im using the same info i already registered with

    heres my first page
    [code]
    <?php
    session_start();
    error_reporting(E_ALL);
    include("functions.php");
    //connect to mysql
    mysql_connect('*****','******','******');
    mysql_select_db('******');
    //register begins
    //define vars
    $first = $_POST['First_Name'];
    $last = $_POST['Last_Name'];
    $username = $_POST['Username'];
    $password = md5($_POST['Password']);
    $email = $_POST['Email'];
    $day = $_POST['day'];
    $month = $_POST['month'];
    $year = $_POST['year'];
    $key = $_POST['key2'];
    $sc = sha1(md5($_POST['key1']));
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    $ip = $_SERVER['REMOTE_ADDR'];
    check_mulit($ip,$email,$username);
    ?>
    [/code]

    then heres my function
    [code]
    <?php
    //connect to mysql
    mysql_connect('*****','******','******');
    mysql_select_db('******');
    //check multi
    function check_multi($i,$e,$u) {
    $check_i = mysql_query("SELECT * FROM users WHERE ip = '$i'");
    $check_e = mysql_query("SELECT * FROM users WHERE email = '$e'");
    $check_u = mysql_query("SELECT * FROM users WHERE username = '$u'");
    $i_status = mysql_num_rows($check_i);
    $e_status = mysql_num_rows($check_e);
    $u_status = mysql_num_rows($check_u);
    if ($i_status > 0) {
    $error = '-You already have an account on this ip address';
    header("Location: ../?page=Register&error=$error");
    }
    if ($e_status > 0){
    $error = '-The email address '.$email.' is already registered';
    header("Location: ../?page=Register&error=$error");
    }
    if ($u_status > 0){
    $error = '-The username '.$username.' is already taken';
    header("Location: ../?page=Register&error=$error");
    }
    }
    ?>
    [/code]
  8. heres my delima okay I want to check a form and if there is multi errors i want it to show all errors at once heres my code
    [code]
    <?php
    //connect to mysql
    mysql_connect('localhost','root','');
    mysql_select_db('site');
    //register begins
    //define vars
    $first = $_POST['first'];
    $last = $_POST['last'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $password2 = $_POST['password2'];
    $email = $_POST['email'];
    $email2 = $_POST['email2'];
    $day = $_POST['day'];
    $month = $_POST['month'];
    $year = $_POST['year'];
    $key = $_SESSION['key'];
    session_destroy('key');
    $sc = $_POST['sc'];
    $hostname = $_SERVER["HTTP_HOST"];
    $ip = $_SERVER['REMOTE_ADDR'];
    //check them all
    if (!$first) {
    $error = '-You did not supply your First Name';
    $complete = 0;
    } elseif (!$last) {
    $error = '-You did not supply your Last Name';
    $complete = 0;
    } elseif (!$username) {
    $error = '-You did not supply a Username';
    $complete = 0;
    } elseif (!$password) {
    $error = '-You did not supply a Password';
    $complete = 0;
    } elseif (!$password2) {
    $error = '-You did not supply a Confirmation Password';
    $complete = 0;
    }  elseif (!$email) {
    $error = '-You did not supply your Email address';
    $complete = 0;
    } elseif (!$email2) {
    $error = '-You did not supply your Confirmation Email address';
    $complete = 0;
    }  elseif (!$day) {
    $error = '-You did not supply your Birthday day';
    $complete = 0;
    } elseif (!$month) {
    $error = '-You did not supply your Birthday month';
    $complete = 0;
    } elseif (!$year) {
    $error = '-You did not supply your Birthday year';
    $complete = 0;
    } elseif (!$sc) {
    $error = '-You did not supply the Security Code';
    $complete = 0;
    }
    if ($complete == 0) {
    //go back to page and display errors
    }
    ?>[/code]
    at the bottom if $complete == 0 i want it to go back and show all the errors is there a way of showing all the errors at once?
  9. i have a form in php where people do there bdays so say like they choose february i want it to make it drop down the box with only 28 characters can any one help me with this part im not a noob at php i just dont know how to do this
  10. well what r u trying to do with line 8 like the href
    [CODE]
    <?php
    $url = $_GET['url'];
    if(!isset($url)){
    echo "<form method=get><input type=text name=url value=http://><input type=submit value=Go></form>";
    }else {
    $file = file_get_contents("$url");
    echo "<form method=get><input type=text name=url value=http://><input type=submit value=Go></form><br><br>";
    $replace = "href=' . "http://cs-blog.net/file.php?url=$url" . '";
    $file = str_replace('href="',$replace,$file);
    echo $file;
    }
    ?>
    [/CODE]
  11. public_html/test22/includes/delete_spam.php: line 1: ?php: No such file or directory
    public_html/test22/includes/delete_spam.php: line 2: syntax error near unexpected token `"../db.php"'
    public_html/test22/includes/delete_spam.php: line 2: `include("../db.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.