Jump to content

slpctrl

Members
  • Posts

    173
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

slpctrl's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I just wonder if I could do the above without the sprintf() function...that function really confuses me, not sure what it's doing. Would that be possible?
  2. Got it easier than I thought, a simple: <html> <body> <center><br /><br /><br /><br /> <form action="" method="post" /> Username: <input type="text" name="username" /><br /> Password: <input type="password" name="pass" /><br /> Email: <input type="text" name="email" /><br /> <input type="submit" /> </form> </center> <?php if (isset($_POST['username']) && isset($_POST['pass']) && isset($_POST['email']) && !empty($_POST['username']) && !empty($_POST['pass']) && !empty($_POST['email'])) { $con = mysql_connect("localhost","root",""); if(!$con) { die("Couldn't connect to DB: " . mysql_error()); } $password = md5($_POST['pass']); mysql_select_db("info", $con); $check = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_array($check)){ if($row['UserName'] == $_POST['username'] || $row['email'] == $_POST['email']){ die("That username or email is already in use!"); } } mysql_query("INSERT INTO users (UserName, PassWord, email) VALUES('$_POST[username]', '$password', '$_POST[email]')"); mysql_close($con); } die(""); ?> Did the trick.
  3. Alright, I have this script (very basic, trying to refresh my memory on PHP/SQL and such): <html> <body> <center><br /><br /><br /><br /> <form action="" method="post" /> Username: <input type="text" name="username" /><br /> Password: <input type="password" name="pass" /><br /> Email: <input type="text" name="email" /><br /> <input type="submit" /> </form> </center> <?php if (isset($_POST['username']) && isset($_POST['pass']) && isset($_POST['email']) && !empty($_POST['username']) && !empty($_POST['pass']) && !empty($_POST['email'])) { $con = mysql_connect("localhost","root",""); if(!$con) { die("Couldn't connect to DB: " . mysql_error()); } $password = md5($_POST['pass']); mysql_select_db("info", $con); mysql_query("INSERT INTO users (UserName, PassWord, email) VALUES('$_POST[username]', '$password', '$_POST[email]')"); mysql_close($con); } die(""); ?> But, what I want to do is to check the DB first, try to match the information trying to be submitted, and if it exists, stop the information from inserting into the DB. But, can't seem to wrap my head around a simple way. Any help would be appreciated .
  4. ^That actually wasn't my password thank god, but I do use it somewhere . Anyways, I got it thanks all .
  5. Thanks for removing those details...after a second I realized, oh sh...oh wow, why did I not filter those out x_x
  6. <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } $user = "********"; $pass = md5("********"); $email = "******@live.com"; mysql_select_db("users", $con) or die("unable to select DB"); mysql_query("INSERT INTO users (user, pass, email) VALUES ('$user', '$pass', '$email')") or die("Can't insert info into DB " mysql_error()); mysql_close($con); ?> mod edit: removed user/pass/email details
  7. I've recently been getting back into PHP, and I've racked my brain over this incredibly simple piece of code, and can't figure out why I can't insert. <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } $user = "********"; $pass = md5("********"); $email = "******@live.com"; mysql_select_db("users", $con) or die("unable to select DB"); mysql_query("INSERT INTO users ('user', 'pass', 'email') VALUES ($user,$pass,$email)") or die("Can't insert info into DB " mysql_error()); mysql_close($con); ?> I know my error is within the insert command...I just don't understand why this isn't working. I've even copied the code straight from W3schools, and it still doesn't work. My MYSQL version is 5.5.24 mod edit: removed user/pass/email details
  8. Doesn't work; I've got it down to this: <?php $num = array(); For ($i = 1000; $i > 0; $i--){ if ((($num % 3) != 0) || (($num % 5) != 0)) { array_push($num, $i); } echo array_sum($num); ?> I would think that'd work; but it doesn't. I've tried it with % and with /, nothing. When I insert that line just in my code, and move the code around so that it works it just echoes 1000 twice. :\
  9. First off, here's the script: <?php $num = array(); For ($i = 1000; $i > 0; $i--){ if !($num/3) && || !($num/5) { $i--; } else{ array_push($num, $i); echo "$i\n"; $i--; } } echo array_sum($num); ?> Now, what I'm trying to do is store every number under 1000 divisible by 3 or 5 into an array, and then add all the values in the array together; however, it doesn't work and I can't pinpoint where the error is. Any help is appreciated. Edit: Also, I have the echo "$i\n"; in there to help with finding the error; it echoes nothing :\.
  10. Alright, I've got this simple little script here: <?php //draws the image and stuff. . . $im = @imagecreatefrompng( "babe.png" ); header( "Content-type: image/png" ); imagepng($im); imagedestroy($im); ?> This works fine when it's saved as a .php, but when I save it as a .gif file (and this is my .htaccess: AddHandler application/x-httpd-php .png ) So, it should parse .php even with the .gif extension, but as a .php file it works fine, just as it should but as a .gif file it says can not display this image because it contains errors.
  11. How would I go about doing this? I know that it's gotta be simple, I just can't seem to find it via google and my brain can't come up with it . So, how do I just select the highest primary key and store it into a variable? ???
  12. Of course you can do it yourself! But now for the bad news: SEO is kind of a niche it's self, and something that needs to be learned entirely, kind of like learning to code. It's going to be a long haul to be honest, knowing nothing about SEO and a decent SEO agent can command thousands of dollars good work. Good luck .
  13. Hi, would anyone know where to get a PHP/flash driven app that allows you to do graphics and art? Are there any public ones? Just curious, I really don't have the time to take something like this on.
  14. Thank you so much! It's weird though, sometimes there's the border (represented by 10 0s) is still there, sometimes it's not, and sometimes there's just one or 2 extra 0s on the end. But this is as close as I'm gonna get probably, thanks!
×
×
  • 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.