Jump to content

corbin

Staff Alumni
  • Posts

    8,102
  • Joined

  • Last visited

Everything posted by corbin

  1. When ever I have 2 conditional statments i use ((condition 1) && (condition 2)) {  }
  2. $result = mysql_fetch_assoc($q); $race_array = explode(",", $result); Should do it...
  3. I started basic html about 2 and a half years ago... I started out very simple and then gradually became fairly fluent with HTML (I'm definatly not an expert)... Then I slowly started messin with PHP... I learned from random tutorials and by trail and error mostly...
  4. Uhhh from your description of your problem it seems to me like you have an un-needed step... Why not have 2co.com send the info straight to your final site that is involved?
  5. I always use meta tags to refresh pages that I write that handle processing post variables... And the meta tags work fine in FF and IE for me...
  6. add a column to your table that is something like pic_url then You could add a picture url box on your form so they could put one if they wanted... Then when the form is processed have it put the url in the database if its a valid url... then when displaying it if the url column doesnt equal "" you could display it in an image tag
  7. I did something similar to that when i was making a script a few weeks back...  Only bad thing is that the servers error logs become use less when it comes to page not found...
  8. FireFox and Internet Explorer will generate different sessions server side I think...
  9. http://www.w3schools.com/php/php_file.asp is a short tutorial that might help you...
  10. I suggest using a database but [code=php:0] <? $farray = file("links.txt"); $c = count($farray); if($c > 5) { $s = $c - 5; } else { $s = 0; } //foreach($farray as $key => $value) { //echo $value; //} $i = 0; while($i <= 5) { echo $farray[$s]; $i++; $s++; } ?> [/code] will display the last 5 lines in links.txt If you use this youll have to put the links in the form of [code]<a href="http://site.com/page.ext">Text to display</a>[/code]
  11. call to it like <img src="script.php?image=y"> and then you could do [code=php:0] if($_GET['image'] == "y") { function dbar($status) {   $bar = ImageCreate(100, 5);   $red = ImageColorAllocate($bar, 255, 0, 0);   $green = ImageColorAllocate($bar, 0, 255, 0);   ImageFilledRectangle($bar, 0, 0, $status, 4, $green);     header("Content-type: image/png");   ImagePng($bar);   ImageDestroy($bar); } $status = '10'; //Ignore the status var... dbar($status); }
  12. you forgot the > on your iframe tag... also the format of an iframe is [code=php:0]<iframe>error messege for if the browser cant display it</iframe>[/code] also uhhh why [code] iframe_loc = $remote_url= [/code] why not just $iframe_loc="http://www.remotesite.aspx" . "?username=" . $_SESSION['username'] . "&password=" . $_SESSION['password']; Also are you setting the SESSION variables?  Cause if not this is only gonna iframe http://remotesite.aspx?username=&password=
  13. [code=php:0] $p = array(); if($_POST) { foreach ($_POST as $key => $value) { $p[$key] = $value; } } foreach ($p as $key => $value) { if(!$url) { $url = "?" . $key. "=" . $value; } else { $url .= "&" . $key . "=" . $value; } } $url = "http://somesite.com/page.php" . $url; echo "<meta http-equiv=\"refresh\" content=\"0;url=" . $url . "\">" [/code] will forward it with any post variables set converted into get variables... Theres prolly a better way to do this but its what i came up with :D
  14. and really you could just use [code=php:0] $q = mysql_query("SELECT * FROM `customers` WHERE `user`='$name' AND `password`='$pass'",$con); $num = @mysql_num_rows($q); if($num == "1") { //stuff to do if the password is correct } else { //stuff to do if the password is incorrect } [/code] also [code=php:0]if (mysql_query("SELECT id FROM customers WHERE password=$pass") != mysql_query("SELECT id FROM customers WHERE user=$name"))[/code] I dont think you can compare straight queries... I think you would have to turn them into results... Also 2 users could have the same password so lets say $name = zabc and the other person who has their password is named aabc then aabc's id would be returned first by the first one, but zabc's id would be selected from the second...
  15. $resultant = mysql_query("SELECT `password` FROM `customers` WHERE `user`='$name'",$con); I don't know if its affecting it or not, but I always use ` and ' around my mysql queries...
  16. $sqlCOMPARE  = "SELECT * from prodname where `ProdName` = '$ProdName'"; Wrong sentax on that line...  And I'm not sure bout the rest of the script... Just woke up :D
  17. More detail would be nice... Does your page recieve it through POST or GET and does the other page recieve it thru POST or GET?
  18. [code=php:0] <?php function opentable() { echo"<table width=\"600\"  border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">  <tr> <td width=\"15\"><img src=\"/image/left_side.gif\" width=\"15\" height=\"22\"></td> <td width=\"100%\" background=\"/images/middle.gif\"></td> <td width=\"15\"><img src=\"/images/right_side.gif\" width=\"15\" height=\"22\"></td> </tr> <tr><td>"; } ?> [/code] Should do it... It will look in /images/ no matter where its called from instead of current directory/images...
  19. $authorized_users = array (); while ($row = mysql_fetch_row($result)) {   authorized_users[] = $row['user']; } Should work... I dont use arrays very often so I'm not sure...
  20. Hmmm I dont know whats causin that lol
  21. [code=php:0] $numb = @mysql_query(     "SELECT `number`, `desc` FROM `house_num` WHERE `house_num.id`='$id'");   if (!$numb) {     exit('<p>Error fetching number details: ' .         mysql_error() . '</p>');   } [/code] Should also work... Not sure though
  22. Hehe sorry  I got a lil side tracked... Anyways here it is... [code=php:0] <? include('header.php'); include('db_connect.php'); $conn = db_connect(); $db = mysql_select_db('dev', $conn) or die ('Database error.  Please try again later.'); function checkEmail($e) {   if(!eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", $e))   { return FALSE;   } else { return TRUE; } } $sub = $_POST['sub']; if($sub) { if($_POST['name']) { $name = $_POST['name']; } else { $error .= "Please enter a user name.<BR>"; } if($_POST['email']) { $email = $_POST['email']; if(checkEmail($email) != TRUE) { $error .= "Your Email Address is not valid.<BR>"; } } else { $error .= "Please enter an email address.<BR>"; } if($_POST['uname']) { $uname = $_POST['uname']; $q = "SELECT * from `users` WHERE `uname` = '" . $uname . "'"; @$num = mysql_num_rows($q); if($num > 0) { $error .= "Sorry the user name you requested is not available.<BR>"; } } else { $error .= "Please enter a username<BR>"; } if($_POST['pass']) { $pass = $_POST['pass']; } else { $error .= "Please enter a password<BR>"; } if($_POST['pass_two']) { $pass_two = $_POST['pass_two']; } else { if($pass) {  $error .= "You did not enter your password a second time!<BR>"; } } if(($pass) && ($pass_two) && ($pass != $pass_two)) { $error .= "Your passwords do not match!<BR>"; } if(!$error) { $sql = "INSERT INTO `users` (`name`, `email`, `uname`, `pass`) VALUES ('" . $name . "', '" . $email . "', '" . $uname . "', '" . $pass . "')"; if(!mysql_query($sql, $conn)) { echo "Sorry! A database error has occured... Please try again later."; } else { $no_display = "yes"; ?> <meta http-equiv="refresh" content="0;url=<? echo $_SERVER['HTTP_SELF'] . "?success=yes&user=" . $uname; ?>"> <? } } } if($no_display != "yes") { ?> <center><font color="red"><? if($error) { echo "<B>One or more errors occured:</b> <BR>" . $error; }?></font> <h2>New User Registration</h2> <br> <? } if(($_GET['success'] != "yes") && ($no_display != "yes")) { ?> <form action="" method="post"> <table border="0"> <tr><td>Name:</td><td><input type="text" name="name" value="<?=$name;?>"></td></tr> <tr><td>Email:</td><td><input type="text" name="email" value="<?=$email;?>"></td></tr> <tr><td>Username:</td><td><input type="text" name="uname" value="<?=$uname;?>"></td></tr> <tr><td>Password:</td><td><input type="password" name="pass"></td></tr> <tr><td>Password:</td><td><input type="password" name="pass_two""></td></tr> <tr><td><input type="submit" name="sub" value="Submit"></td></tr> </form> <? } else { echo "Thanks, " . $_GET['user'] . ", your are now a member of the Studio Community!"; } if($conn) { mysql_close($conn); } ?> [/code] If I were you I would limit the lengths of the names usernames emails and passwords...  Also i would store the passwords in MD5...  This script does work though :D (working copy up at the momment at http://corbin-dev.no-ip.org/reg/)
  23. Just a sec... I'll rewrite your script... lol
  24. Oh and you realize your form is messed up right? $var = "bob"; echo('hello "$var"'); would out put hello "$var" I normally use echo "hello" . $var;
  25. Something is wrong with your eregi thing i think... I just tested it my self a little... try [code=php:0] function checkEmail($email) {   if(!eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", $email))   { return FALSE;   } else { return TRUE; } } [/code]
×
×
  • 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.