Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Posts posted by Lamez

  1. Easy. Take the input URL and make a hash out of it, md5();, store it in a database with a ID, URL, and md5 column. Then use a $_GET[] variable check the table for the same URL, if not, add it. Then pull the raw URL and pass it to the proxy. Make sense?

  2. Okay I am getting slightly frustrated. It has been a long time, but I really think I am doing this right. If I was doing this right, then the code would compile.

     

    Here is another error I am getting:

    ID Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

     

    Here is the query:

    <?php
    $id = mysql_query("SELECT * FROM $_people")or die ("ID Query: ".mysql_error());
    $id = mysql_num_rows($id) or die (mysql_error());
    ?>
    

     

    Here is all of my code:

    <?php
    include($path."core/includes/db-config.php");
    include($path."core/includes/wide-variables.php");
    function clean($var){
      $var = htmlspecialchars($var);
      $var = strip_tags($var);
      $var = mysql_escape_string($var);
      $var = trim($var);
      $var = mysql_real_escape_string(trim(strip_tags($var)));
      $var = htmlspecialchars($var,ENT_QUOTES);
      return $var;
    }
    function checkExist($table, $col, $var){
    $q = mysql_query("SELECT * FROM $table WHERE $col = '$var' LIMIT 1")or die("Function Check Exist: ".mysql_error());
    $n = mysql_num_rows($q);
    if($n == 0){
    	$return = false;
    }else if($n > 0){
    	$return = true;
    }
    return $return;
    }
    function RegisterUser($email, $first, $last, $pass1, $pass2){
    $email = clean($email);
    $first = clean($first);
    $last = clean($last);
    $pass1 = clean($pass);
    $pass2 = clean($pass2);
    $check = checkEmail($email);
    $error = "Reg:";
    if($pass1 === $pass2){
    	$error .= "0";
    }else{
    	$error .= "1";
    }
    if($check == true){
    	$check = checkExist($_people, "email", $email);
    	if($check == false){
    		$error .= "0";
    	}else if($check == true){
    		$error .= "1";
    	}
    }else if($check == false){
    	$error .= "2";
    }
    $first = strtolower($first);
    $last = strtolower($last);
    $pass = md5($id).sha1($pass).md5($first.$last);
    $id = mysql_query("SELECT * FROM $_people")or die ("ID Query: ".mysql_error());
    $id = mysql_num_rows($id) or die (mysql_error());
    
    if($error == "Reg:"){
    	mysql_query("INSERT INTO ".$_people." (id, email, first, last, password) VALUES ('".$id."', '".$email."', '".$first."', '".$last."', '".$pass."')")or die("Function Check Register: ".mysql_error());
    	return 0;
    }else{
    	return $error;
    }
    }
    function checkEmail($email){
    if(preg_match("/[.+a-zA-Z0-9_-]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $email) > 0){
    	$pass = true;
    }else{
    	$pass = false;
    }
    return $pass;
    }
    ?>
    

    Any ideas?

     

    Oh ya, as you can see, I did use mysql_real_escape_string() ;)

     

    -Thanks Guys, maybe I am just overlooking something

  3. Hello All,

    I am running a local server with MySQL and PHP 5.

     

    I am trying to do something like this:

    <?php
    function checkExist($table, $col, $var){
    $q = mysql_query("SELECT * FROM $table WHERE $col = $var")or die("Function Check Exist: ".mysql_error());
    $n = mysql_num_rows($q);
    if($n == 0){
    	$return = false;
    }else if($n > 0){
    	$return = true;
    }
    return $return;
    }
    ?>

     

    However I get errors like this:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE email = wizkid916@yahoo.com' at line 1

     

    Maybe I am rusty, or there is a unclear error in my syntax.

     

    Any ideas?

     

    Thanks!

  4. Turn off the television, shut the door, close the window, and shutoff any noise making annoyance excluding the sound on your laptop.

     

    Plug some headphones into the headphone jack on the machine, and see if you can still hear it. If so, save all work and restart. Run a virus scan, if a virus is found, do as follows:

    1.Turn off laptop

    2.Grab nearest bottle of gas and match

    3.Find a metal waste bin (or anything of that nature)

    4.Toss laptop into bin, and spray the gas over it and light the match and add it to the concoction.

    5.Buy cheap IBM Thinkpad, format the HDD and install a form of Linux.

    6.Done!

     

    :)

  5. I think that Mac and Microsoft make two decent operating systems. I have played around with both, and I think both of them needs tons of work. Microsoft being widely know, is the most bashed on. However they do contain a lot of security flaws.

     

    The only secure OS out there that I know of is Linux. If it becomes popular like windows, you might see some more security flaws within (just because someone is looking), and viruses will be more common. But, if you are using Linux, chances are you know a little about PCs, and you keep yourself protected.

     

    I think that all three Operating Systems have some good things, and some bad things. I just prefer Ubuntu 9+\Debian

  6. Um, to make things simpler. I do this all the time at work, teachers change the administrator account, and us Technology guys need it so I change it back through the command prompt.

     

    Open the Command Prompt, Start > RUN (or Windows Key + R) and type CMD

    Then type, net user account_name_here *

    Then it will ask you for your password, then type it in, it will not show anything, just keep typing then push enter. Then re-type it. and Bam, logout and log back in.

     

    Okay so I just re-read your post, and you cannot login at all. You can also try re-booting and before the windows loading screen, press F8 and go into safe mode with command prompt.

     

    Also, you need to burn the ISO with a special ISO program. Also make sure in your boot priorities you have CDROM before your HDD. That way during the bootstrapping process the BIOS finds the CD's MBR before it finds the Hard Drive's.

     

    Hoped I could help!

  7. Oh man.

    I have:

     

    2 servers

    1 Laptop

    2 Desktops

    That is 5 total.

     

    That is just mine. In the entire house we have:

     

    2 servers

    2 laptops

    3 desktops

    That is 7 total.

     

    And this does not include the ones I have set aside for spare parts, and experiments. I also am buying another laptop for my dad.

     

  8. Okay I am doing some finishing touches on this script. It is a review script. Here is how it works:

     

    1.User Types a Review

    2.Script sends out a email verification to user

    3.After email is verified, Review goes into pending, and sends a email to admin

    4.Admin either accepts review, or denies it.

    5.Script sends out a email to the user telling them they have been accepted or denied.

     

    Telling you guys how this works, might help you help me.

     

    In the script, after step 1 it adds a record to the database, but I need to know the id before it is added for the URLs, so I made a function that generates the ID from getting the last entry plus one. Here is that function:

     

    <?php
    function getId(){
    $q = mysql_query("SELECT MAX(id) FROM `reviews`");
    $f = mysql_fetch_array($q);
    return $f['0']+1;
    }
    ?>
    

     

    Does my systems with the IDs sound stable, or should I go a different route of some sorts?

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