Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by aebstract

  1. I don't want to print it out just for reading. I have to be able to use each piece of information. Just like when you pull it from a database and can do something like this: while($r=mssql_fetch_array($query)){ echo $r[3]; } Except I don't know how to go about this, because that uses mssql_fetch_array and, we aren't fetching an array from a database at this point.
  2. That gave me the first array results shown on the screen, but I'm needing a way to loop through all of them so I can do something with each piece of information. I'm trying something like while($r = unserialize(file_get_contents('array.txt'))) { echo $r; } Though, it's just returning: ArrayArrayArrayArray.. If I echo $r[0] it returns something like: 201201201201201201201..
  3. With serialize, I'm trying to echo out the results and getting just "Array" on the screen. How do I loop through the array after I unserialize it?
  4. The information is getting put there like this: <?php $server = 'ww26.empiredatatech.com'; $link = mssql_connect($server, 'outlaw', 'out98765law'); $myFile = "array.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $query = mssql_query(" SELECT ordnn_Users.userid, CAST(ordnn_Users.username as varchar), CAST(ordnn_Users.email as varchar), ordnn_UserPortals.CreatedDate FROM ordnn_Users LEFT JOIN ordnn_UserPortals ON ordnn_UserPortals.UserID = ordnn_Users.UserID "); if(mssql_num_rows($query) > 0){ while($r=mssql_fetch_array($query)){ $whattime = $r[3]; $whattime = explode(" ", $whattime); if ($whattime[0] == Jan){ $whattime[0] = 1; } if ($whattime[0] == Feb){ $whattime[0] = 2; } if ($whattime[0] == Mar){ $whattime[0] = 3; } if ($whattime[0] == Apr){ $whattime[0] = 4; } if ($whattime[0] == May){ $whattime[0] = 5; } if ($whattime[0] == Jun){ $whattime[0] = 6; } if ($whattime[0] == Jul){ $whattime[0] = 7; } if ($whattime[0] == Aug){ $whattime[0] = 8; } if ($whattime[0] == Sep){ $whattime[0] = 9; } if ($whattime[0] == Oct){ $whattime[0] = 10; } if ($whattime[0] == Nov){ $whattime[0] = 11; } if ($whattime[0] == Dec){ $whattime[0] = 12; } $whattime2 = explode(":", $whattime[4]); $whattime2[2] = substr("$whattime2[1]", -2); $whattime2[1] = substr("$whattime2[1]", 0, 2); if ($whattime2[2] == 'PM') { $whattime2[0] = $whattime2[0]+12; } $r[3] = mktime($whattime2[0],$whattime2[1],0,$whattime[0],$whattime[1],$whattime[2],0); $r[0] = $r[0]+200; echo "<pre>"; print_r($r); echo "</pre>"; $str = print_r($r, true) . PHP_EOL; fwrite($fh, $str); } } else { echo mssql_get_last_message(); } fclose($fh); ?> I don't care what I need to do, I just need to do it now. I'm running out of time on a deadline and need to figure something out. Running in to all kinds of problems trying to grab this information. I'm going to have to do it about 3-4 times (different files and whatnot) so I need to figure out a way to do it. EDIT: I can easily store the information in any format in the text file, I just need to know what is easiest/best. Since I'm pulling it from the database, it'll be simple to format the file in any way. Just not sure how I need it to be. Thanks!
  5. I have a text file, structured like this: Array ( [0] => 201 [userid] => 1 [1] => OR_host [computed] => OR_host [2] => host [computed1] => host [3] => [CreatedDate] => ) Array ( [0] => 202 [userid] => 2 [1] => OR_admin [computed] => OR_admin [2] => admin@outlawracing.com [computed1] => admin@outlawracing.com [3] => 1156790760 [CreatedDate] => Aug 28 2006 1:46PM ) Array ( [0] => 203 [userid] => 3 [1] => Tony Reece [computed] => Tony Reece [2] => tony@outlawracing.com [computed1] => tony@outlawracing.com [3] => 1156863060 [CreatedDate] => Aug 29 2006 9:51AM ) Array ( [0] => 204 [userid] => 4 [1] => Tony Reece_Admin [computed] => Tony Reece_Admin [2] => tony.reece@datavue.com [computed1] => tony.reece@datavue.com [3] => [CreatedDate] => ) I need to read the text file, and be able to loop through every array. I'm not really sure how I would approach this since the arrays aren't labeled or anything.
  6. I really need this figured out soon this morning.
  7. I'm connected, if I wasn't connected the first thing is it wouldn't be saying 'outlawracingcom' because it wouldn't have a connection to pull that value. This is at the top: $server = 'ww26.empiredatatech.com'; $link = mssql_connect($server, 'user', 'pass'); Which, no it isn't using mssql_select_db(), but this code below works perfect: <?php $server = 'ww26.empiredatatech.com'; $link = mssql_connect($server, 'outlaw', 'out98765law'); $query = mssql_query(" SELECT ordnn_Users.userid, ordnn_Users.username, ordnn_Users.email, ordnn_UserPortals.CreatedDate FROM ordnn_Users JOIN ordnn_UserPortals ON ordnn_Users.userid = ordnn_UserPortals.userid "); if(mssql_num_rows($query) > 0){ while($r=mssql_fetch_array($query)){ $r[] = '00000000006xrqeiww i1cjyo000000 qlaq52000000 qlaq52000000'; $r[] = crc32(strtolower($r[2])) . strlen($r[2]); $r[0] = $r[0]+200; echo "<pre>"; print_r($r); echo "</pre>"; } } else { echo mssql_get_last_message(); } ?> edit: $server = 'ww26.empiredatatech.com'; $link = mssql_connect($server, 'user', 'pass'); mssql_select_db('outlawracingcom', $link); This doesn't change the error one bit
  8. <?php $query = mssql_query(" SELECT UserID FROM ordnn_Forum_Posts "); if(mssql_num_rows($query) > 0){ while($r=mssql_fetch_array($query)){ echo "<pre>"; print_r($r); echo "</pre>"; } } else { echo mssql_get_last_message(); } ?> Okay, I'm just trying to simply grab and display the UserID from ordnn_Forum_Posts. I'm getting this error: Changed database context to 'outlawracingcom'. I've looked around a little bit and noticed some references saying it is just a message not an actual error. If this was the case, I would be able to at least see/get my information. I just get the error and a white page to follow it.
  9. Wherever you are grabbing your user's information, you need to grab the "usertype" column and set it as a variable. Something similar to this is what you will have: $query = mysql_query("SELECT * FROM users WHERE id = $_SESSION[id] LIMIT 1") or DIE(mysql_error()); if (mysql_num_rows($query)!=0){ while($r=mysql_fetch_array($query)) { $usertype = $r[usertype]; } } Now you can use your $usertype variable and do an if statement like what has been mentioned. if ($usertype == '1') { echo "this is an admin user, do anything here for admins"; }
  10. Did you write the registrations/login scripts? If so then you know how to connect to your database and retrieve information, no?
  11. You gave yourself the answers, there really isn't a question here. Do like you said and create a column in your user's table, "usertype" or whatever you want to name it. 0 is default, 1 will be admin. On your page, do a simple if statement like mentioned above. Check the column of "usertype" to see if it matches '1'. If it does, do whatever for admin. Now after that, if you still have a question.. you need to rephrase it.
  12. Most recent: <?php if ($user->data['username_clean'] != admin) { header("Location: index.php"); exit; } $content .= "<div id=\"content\">"; switch ($_GET['a']) { case registrations: if (isset($_POST["submit"])){ $hidden = "$_POST[hidden]"; $query2 = mysql_query("SELECT * FROM registrations WHERE id = $_POST[hidden]") or DIE(mysql_error()); if(mysql_num_rows($query2)!=0){ while($rs=mysql_fetch_array($query2)) { if($rs[firstname] == $_POST["firstname_$hidden"]) { $firstname = $rs[firstname]; } else { $firstname = $_POST["firstname_$hidden"]; } if($rs[lastname] == $_POST["lastname_$hidden"]) { $lastname = $rs[lastname]; } else { $lastname = $_POST["lastname_$hidden"]; echo "IT CHANGED $lastname"; } if($rs[address] == $_POST["address_$hidden"]) { $address = $rs[address]; } else { $address = $_POST["address_$hidden"]; } if($rs[city] == $_POST["city_$hidden"]) { $city = $rs[city]; } else { $city = $_POST["city_$hidden"]; } if($rs[state] == $_POST["state_$hidden"]) { $state = $rs[state]; } else { $state = $_POST["state_$hidden"]; } if($rs[zip] == $_POST["zip_$hidden"]) { $zip = $rs[zip]; } else { $zip = $_POST["zip_$hidden"]; } if($rs[car] == $_POST["car_$hidden"]) { $car = $rs[car]; } else { $car = $_POST["car_$hidden"]; } if($rs['class'] == $_POST["class_$hidden"]) { $class = $rs['class']; } else { $class = $_POST["class_$hidden"]; } if($rs[number] == $_POST["number_$hidden"]) { $number = $rs[number]; } else { $number = $_POST["number_$hidden"]; } if($rs[phone] == $_POST["phone_$hidden"]) { $phone = $rs[phone]; } else { $phone = $_POST["phone_$hidden"]; } if($rs[email] == $_POST["email_$hidden"]) { $email = $rs[email]; } else { $email = $_POST["email_$hidden"]; } mysql_query("UPDATE registrations SET firstname = '$firstname', lastname = '$lastname', address = '$address', city = '$city', state = '$state', zip = '$zip', car = '$car', class= '$class', number = '$number', phone = '$phone', email = '$email' WHERE id = $r[id]") or DIE(mysql_error()); header("Location: index.php?page=admin&a=registrations"); exit; } } } if (isset($_GET['u'])){ $query = mysql_query("UPDATE registrations SET active = '$_GET[u]' WHERE id = $_GET[i]") or DIE(mysql_error()); header("Location: index.php?page=admin&a=registrations"); exit; } $content .= "<table style=\"margin-top: 30px;\"><tr> <td></td> <td class=\"ar\"> Personal Information </td><td class=\"ar\"> Contact Information </td><td class=\"ar\"> Class & Car Information </td> </tr> "; $query = mysql_query("SELECT * FROM registrations") or DIE(mysql_error()); if(mysql_num_rows($query)!=0){ $count = 1; while($r=mysql_fetch_array($query)) { $content .= "<form action=\"index.php?page=admin&a=registrations\" method=\"post\" name=\"update_registration_$r[id]\">"; $content .= " <tr>"; if($r[active] == '1'){ $content .= "<td class=\"arx_a\">"; } else { $content .= "<td class=\"arx\">"; } $content .= " <a href=\"index.php?page=admin&a=registrations&i=$r[id]&u=1\">+</a> <br /> <a href=\"index.php?page=admin&a=registrations&i=$r[id]&u=0\">-</a> <br /> <input type=\"submit\" name=\"submit\" value=\"update\" /> </td> <td class=\"ar1\"> <input size=\"8\" class=\"a_reg\" type=\"text\" value=\"$r[firstname]\" name=\"firstname_$r[id]\" /> <input size=\"11\" class=\"a_reg\" type=\"text\" value=\"$r[lastname]\" name=\"lastname_$r[id]\" /><br /> <input size=\"23\" class=\"a_reg\" type=\"text\" value=\"$r[address]\" name=\"address_$r[id]\" /><br /> <input size=\"10\" class=\"a_reg\" type=\"text\" value=\"$r[city]\" name=\"city_$r[id]\" />, <input style=\"text-transform: uppercase; text-align:center;\" size=\"1\" class=\"a_reg\" type=\"text\" value=\"$r[state]\" name=\"state_$r[id]\" /> <input style=\"text-align:center;\" maxlength=\"5\" size=\"3\" class=\"a_reg\" type=\"text\" value=\"$r[zip]\" name=\"zip_$r[id]\" /> </td><td class=\"ar2\"> <input class=\"a_reg\" type=\"text\" value=\"$r[phone]\" name=\"phone_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[email]\" name=\"email_$r[id]\" /> </td><td class=\"ar3\"> <input class=\"a_reg\" type=\"text\" value=\"$r[car]\" name=\"car_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[class]\" name=\"class_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[number]\" name=\"number_$r[id]\" /> </td> </tr> <tr height=\"20\"><td></td><td></td><td></td></tr> "; $content .= "<input type=\"hidden\" name=\"hidden\" value=\"$r[id]\" /></form>"; } $content .= "</table>"; } break; default: $content .= "CUSTOM ADMIN CONTROL PANEL <a href=\"index.php?page=admin&a=registrations\">registrations</a>"; break; } $content .= "</div>"; ?> No errors of any kind, database isn't being updated.
  13. <?php if ($user->data['username_clean'] != admin) { header("Location: index.php"); exit; } $content .= "<div id=\"content\">"; switch ($_GET['a']) { case registrations: if (isset($_POST["submit"])){ $hidden = "$_POST[hidden]"; $query2 = mysql_query("SELECT * FROM registrations WHERE id = $_POST[hidden]") or DIE(mysql_error()); if(mysql_num_rows($query2)!=0){ while($rs=mysql_fetch_array($query2)) { if($rs[firstname] == $_POST["firstname_$hidden"]) { $firstname = $rs[firstname]; } else { $firstname = $_POST["firstname_$hidden"]; } if($rs[lastname] == $_POST["lastname_$hidden"]) { $lastname = $rs[lastname]; } else { $lastname = $_POST["lastname_$hidden"]; } if($rs[address] == $_POST["address_$hidden"]) { $address = $rs[address]; } else { $address = $_POST["address_$hidden"]; } if($rs[city] == $_POST["city_$hidden"]) { $city = $rs[city]; } else { $city = $_POST["city_$hidden"]; } if($rs[state] == $_POST["state_$hidden"]) { $state = $rs[state]; } else { $state = $_POST["state_$hidden"]; } if($rs[zip] == $_POST["zip_$hidden"]) { $zip = $rs[zip]; } else { $zip = $_POST["zip_$hidden"]; } if($rs[car] == $_POST["car_$hidden"]) { $car = $rs[car]; } else { $car = $_POST["car_$hidden"]; } if($rs[number] == $_POST["number_$hidden"]) { $number = $rs[number]; } else { $number = $_POST["number_$hidden"]; } if($rs[phone] == $_POST["phone_$hidden"]) { $phone = $rs[phone]; } else { $phone = $_POST["phone_$hidden"]; } if($rs[email] == $_POST["email_$hidden"]) { $email = $rs[email]; } else { $email = $_POST["email_$hidden"]; } $query = ("UPDATE registrations SET firstname = '$firstname', lastname = '$lastname', address = '$address', city = '$city', state = '$state', zip = '$zip', car = '$car', number = '$number', phone = '$phone', email = '$email' WHERE id = $r[id] ") or DIE(mysql_error()); } } } if (isset($_GET['u'])){ $query = mysql_query("UPDATE registrations SET active = '$_GET[u]' WHERE id = $_GET[i]") or DIE(mysql_error()); header("Location: index.php?page=admin&a=registrations"); exit; } $content .= "<table style=\"margin-top: 30px;\"><tr> <td></td> <td class=\"ar\"> Personal Information </td><td class=\"ar\"> Contact Information </td><td class=\"ar\"> Class & Car Information </td> </tr> "; $query = mysql_query("SELECT * FROM registrations") or DIE(mysql_error()); if(mysql_num_rows($query)!=0){ $count = 1; while($r=mysql_fetch_array($query)) { $content .= "<form action=\"index.php?page=admin&a=registrations\" method=\"post\" name=\"update_registration_$r[id]\">"; $content .= " <tr>"; if($r[active] == '1'){ $content .= "<td class=\"arx_a\">"; } else { $content .= "<td class=\"arx\">"; } $content .= " <a href=\"index.php?page=admin&a=registrations&i=$r[id]&u=1\">+</a> <br /> <a href=\"index.php?page=admin&a=registrations&i=$r[id]&u=0\">-</a> <br /> <input type=\"submit\" name=\"submit\" value=\"update\" /> </td> <td class=\"ar1\"> <input size=\"8\" class=\"a_reg\" type=\"text\" value=\"$r[firstname]\" name=\"firstname_$r[id]\" /> <input size=\"11\" class=\"a_reg\" type=\"text\" value=\"$r[lastname]\" name=\"lastname_$r[id]\" /><br /> <input size=\"23\" class=\"a_reg\" type=\"text\" value=\"$r[address]\" name=\"address_$r[id]\" /><br /> <input size=\"10\" class=\"a_reg\" type=\"text\" value=\"$r[city]\" name=\"city_$r[id]\" />, <input style=\"text-transform: uppercase; text-align:center;\" size=\"1\" class=\"a_reg\" type=\"text\" value=\"$r[state]\" name=\"state_$r[id]\" /> <input style=\"text-align:center;\" maxlength=\"5\" size=\"3\" class=\"a_reg\" type=\"text\" value=\"$r[zip]\" name=\"zip_$r[id]\" /> </td><td class=\"ar2\"> <input class=\"a_reg\" type=\"text\" value=\"$r[phone]\" name=\"phone_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[email]\" name=\"email_$r[id]\" /> </td><td class=\"ar3\"> <input class=\"a_reg\" type=\"text\" value=\"$r[car]\" name=\"car_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[class]\" name=\"class_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[number]\" name=\"number_$r[id]\" /> </td> </tr> <tr height=\"20\"><td></td><td></td><td></td></tr> "; $content .= "<input type=\"hidden\" name=\"hidden\" value=\"$r[id]\" /></form>"; } $content .= "</table>"; } break; default: $content .= "CUSTOM ADMIN CONTROL PANEL <a href=\"index.php?page=admin&a=registrations\">registrations</a>"; break; } $content .= "</div>"; ?> This isn't giving me an error, but it isn't updating my database.
  14. <?php if ($user->data['username_clean'] != admin) { header("Location: index.php"); exit; } $content .= "<div id=\"content\">"; switch ($_GET['a']) { case registrations: if (isset($_POST["submit"])){ $hidden = "$_POST[hidden]"; $query = mysql_query("SELECT * FROM registrations WHERE id = $_POST[hidden] LIMIT 1") or DIE(mysql_error()); if(mysql_num_rows($query)!=0){ while($r=mysql_fetch_array($query)) { echo "$r[id]"; if($r[firstname] == $_POST["firstname_$hidden"]) { $firstname = $r[firstname]; } else { $firstname = $_POST["firstname_$hidden"]; } if($r[lastname] == $_POST["lastname_$hidden"]) { $lastname = $r[lastname]; } else { $lastname = $_POST["lastname_$hidden"]; } if($r[address] == $_POST["address_$hidden"]) { $address = $r[address]; } else { $address = $_POST["address_$hidden"]; } if($r[city] == $_POST["city_$hidden"]) { $city = $r[city]; } else { $city = $_POST["city_$hidden"]; } if($r[state] == $_POST["state_$hidden"]) { $state = $r[state]; } else { $state = $_POST["state_$hidden"]; } if($r[zip] == $_POST["zip_$hidden"]) { $zip = $r[zip]; } else { $zip = $_POST["zip_$hidden"]; } if($r[car] == $_POST["car_$hidden"]) { $car = $r[car]; } else { $car = $_POST["car_$hidden"]; } if($r[number] == $_POST["number_$hidden"]) { $number = $r[number]; } else { $number = $_POST["number_$hidden"]; } if($r[phone] == $_POST["phone_$hidden"]) { $phone = $r[phone]; } else { $phone = $_POST["phone_$hidden"]; } if($r[email] == $_POST["email_$hidden"]) { $email = $r[email]; } else { $email = $_POST["email_$hidden"]; } $query = ("UPDATE registrations SET firstname = '$firstname', lastname = '$lastname', address = '$address', city = '$city', state = '$state', zip = '$zip', car = '$car', number = '$number', phone = '$phone', email = '$email' WHERE id = $r[id] ") or DIE(mysql_error()); } } } if (isset($_GET['u'])){ $query = mysql_query("UPDATE registrations SET active = '$_GET[u]' WHERE id = $_GET[i]") or DIE(mysql_error()); header("Location: index.php?page=admin&a=registrations"); exit; } $content .= "<table style=\"margin-top: 30px;\"><tr> <td></td> <td class=\"ar\"> Personal Information </td><td class=\"ar\"> Contact Information </td><td class=\"ar\"> Class & Car Information </td> </tr> "; $query = mysql_query("SELECT * FROM registrations") or DIE(mysql_error()); if(mysql_num_rows($query)!=0){ $count = 1; while($r=mysql_fetch_array($query)) { $content .= "<form action=\"index.php?page=admin&a=registrations\" method=\"post\" name=\"update_registration_$r[id]\">"; $content .= " <tr>"; if($r[active] == '1'){ $content .= "<td class=\"arx_a\">"; } else { $content .= "<td class=\"arx\">"; } $content .= " <a href=\"index.php?page=admin&a=registrations&i=$r[id]&u=1\">+</a> <br /> <a href=\"index.php?page=admin&a=registrations&i=$r[id]&u=0\">-</a> <br /> <input type=\"submit\" name=\"submit\" value=\"update\" /> </td> <td class=\"ar1\"> <input size=\"8\" class=\"a_reg\" type=\"text\" value=\"$r[firstname]\" name=\"firstname_$r[id]\" /> <input size=\"11\" class=\"a_reg\" type=\"text\" value=\"$r[lastname]\" name=\"lastname_$r[id]\" /><br /> <input size=\"23\" class=\"a_reg\" type=\"text\" value=\"$r[address]\" name=\"address_$r[id]\" /><br /> <input size=\"10\" class=\"a_reg\" type=\"text\" value=\"$r[city]\" name=\"city_$r[id]\" />, <input style=\"text-transform: uppercase; text-align:center;\" size=\"1\" class=\"a_reg\" type=\"text\" value=\"$r[state]\" name=\"state_$r[id]\" /> <input style=\"text-align:center;\" maxlength=\"5\" size=\"3\" class=\"a_reg\" type=\"text\" value=\"$r[zip]\" name=\"zip_$r[id]\" /> </td><td class=\"ar2\"> <input class=\"a_reg\" type=\"text\" value=\"$r[phone]\" name=\"phone_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[email]\" name=\"email_$r[id]\" /> </td><td class=\"ar3\"> <input class=\"a_reg\" type=\"text\" value=\"$r[car]\" name=\"car_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[class]\" name=\"class_$r[id]\" /><br /> <input class=\"a_reg\" type=\"text\" value=\"$r[number]\" name=\"number_$r[id]\" /> </td> </tr> <tr height=\"20\"><td></td><td></td><td></td></tr> "; $content .= "<input type=\"hidden\" name=\"hidden\" value=\"$r[id]\" /></form>"; } $content .= "</table>"; } break; default: $content .= "CUSTOM ADMIN CONTROL PANEL <a href=\"index.php?page=admin&a=registrations\">registrations</a>"; break; } $content .= "</div>"; ?> Specifically talking about case: registrations. When I click on update for the form, I'm getting an error message: [phpBB Debug] PHP Notice: in file /var/www/vhosts/outlawracing.com/httpdocs/admin.php on line 32: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Not too sure why. I also had "class" in the query at top but it was giving me some error, so once I get this portion working I'll add it back in and go from there.
  15. I put single quotes around all the values and it entered correctly.
  16. I get this error followed by the input and line number, it happens anytime there is a space in the string trying to be inserted. Any clue as to why? I've never had this problem as far as I can remember. The fields I am trying to insert in to are all varchar. (can varchar not have a space in it?) The information is coming from a form, by using $_POST[value]. Thanks
  17. From what I've read/seen, yes. You need to get their IP and match it to an IP/country database.
  18. <?php if (isset($_POST['submit'])){ if (empty ($_POST['firstname'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['lastname'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['address'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['city'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['state'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['zip'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['phone1'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['phone2'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['phone3'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['classdropdown'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif ($_POST['classdropdown'] == Classes) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['carnumber'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['makemodel'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['email'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } if (!$problem) { $emailbody = " ORSCA REGISTRATION FORM<br /><br /> <table> <tr> <td> Name: </td><td> </td><td> $_POST[firstname] $_POST[lastname] </td></tr> <tr><td> Email: </td><td> </td><td> $_POST[email] </td></tr> <tr><td> Phone Number: </td><td> </td><td> ($_POST[phone1]) $_POST[phone2] - $_POST[phone3] </td></tr> </table> $_POST[address]<br /> $_POST[city], $_POST[state] $_POST[zip]<br /><br /> $_POST[makemodel]<br /> $_POST[classdropdown]<br /> $_POST[carnumber] "; $to = 'tcantwell@berryequipment.net' . ', '; // note the comma // subject $subject = 'ORSCA Registration Form'; // message $message = " <html> <head> </head> <body> $emailbody </body> </html> "; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: ORSCA <tcantwell@berryequipment.net>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); } } $content .= " <div id=\"content\"> $error <form action=\"index.php?page=registration2\" method=\"post\" name=\"registration\"> <table><tr><td class=\"rtable1\"> Name: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"20\" class=\"textfield\" name=\"firstname\" value=\"$_POST[firstname]\" size=\"7\" /> <input type=\"text\" maxlength=\"20\" class=\"textfield\" name=\"lastname\" value=\"$_POST[lastname]\" size=\"10\" /> </td></tr> <tr><td class=\"rtable1\"> Address: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"60\" class=\"textfield\" name=\"address\" value=\"$_POST[address]\" size=\"20\" /><br /> <input type=\"text\" maxlength=\"30\" class=\"textfield\" name=\"city\" value=\"$_POST[city]\" size=\"10\" />, <input type=\"text\" maxlength=\"2\" class=\"textfield\" style=\"text-transform: uppercase; text-align:center;\" name=\"state\" value=\"$_POST[state]\" size=\"1\" /> <input type=\"text\" maxlength=\"5\" class=\"textfield\" style=\"text-align: center;\" name=\"zip\" value=\"$_POST[zip]\" size=\"2\" /> </td></tr> <tr><td class=\"rtable1\"> Phone Number: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"3\" class=\"textfieldp\" name=\"phone1\" value=\"$_POST[phone1]\" size=\"1\" /><input type=\"text\" maxlength=\"3\" class=\"textfieldp\" name=\"phone2\" value=\"$_POST[phone2]\" size=\"1\" /><input type=\"text\" maxlength=\"4\" class=\"textfieldp\" name=\"phone3\" value=\"$_POST[phone3]\" size=\"2\" /> </td></tr> <tr><td class=\"rtable1\"> Racing Class: </td><td class=\"tablespace\"> </td><td> <select name=\"classdropdown\"> <option style=\"text-align: center; border-bottom: 1px solid #000; margin-bottom: 10px; padding-bottom: 5px;\">Classes</option> <option value=\"outlaw105\">Outlaw 10.5</option> <option value=\"limitedstreet\">Limited Street</option> <option value=\"ezstreet\">EZ Street</option> <option value=\"realstreet\">Real Street</option> <option value=\"modifiedstreet\">Modified Street</option> <option value=\"470index\">4.70 Index</option> <option value=\"530index\">5.30 Index</option> <option value=\"600index\">6.00 Index</option> <option value=\"700index\">7.00 Index</option> </select> </td></tr> <tr><td class=\"rtable1\"> Desired Car Number: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"10\" class=\"textfield\" name=\"carnumber\" value=\"$_POST[carnumber]\" size=\"5\" /> </td></tr> <tr><td class=\"rtable1\"> Vehicle Make/Model: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"50\" class=\"textfield\" name=\"makemodel\" value=\"$_POST[makemodel]\" size=\"20\" /> </td></tr> <tr><td class=\"rtable1\"> Email Address: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"50\" class=\"textfield\" name=\"email\" value=\"$_POST[email]\" size=\"30\" /> </td></tr> </table> <input type=\"submit\" name=\"submit\" class=\"textfield\" value=\"Send Registration\" /> </form> </div> "; ?> Any idea why the email is sending twice?
  19. Easier/faster way than? Where's the code that you're questioning?
  20. Alright. Had to add in an extra bracket: $article = preg_replace('#\[[[a-z0-9]+\.[a-z0-9]+]]#i', '', $article); Thanks!
  21. (Didn't realize my other post wasn't in the right section!) $article = eregi_replace("^([[(a-zA-Z0-9.)]]{1,})", "", $article); Trying to get the hang of regex, but I'm failing atm. Need to remove everything from $article that matches [[anythinggoeshere.anyextension]] this pattern. The above code doesn't do anything
  22. My site is setup similarly, except here is the difference: ?page=about > domain.com/page/about/ ?page=about > domain.com/about/ ?page=about&content=3 ?page=about&content=3&style=1 would end up being domain.com/about/3/ domain.com/about/3/1/ Here is what I use: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([[:alnum:]_]+)/$ /index.php?page=$1 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2&var2=$3 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/([[:alnum:]]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2&var2=$3&var3=$4 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/([[:alnum:]]+)/([[:alnum:]]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2&var2=$3&var3=$4&var4=$5 [NC,L]
  23. aebstract

    regex :(

    $article = eregi_replace("^([[(a-zA-Z0-9.)]]{1,})", "", $article); Trying to get the hang of regex, but I'm failing atm. Need to remove everything from $article that matches [[anythinggoeshere.anyextension]] this pattern. The above code doesn't do anything
  24. Ended up being a bit off of what you have, gonna be an equal pain in the ass to do the second part like this, but oh well. $firstimage = substr(substr($article, strpos($article, '['), strpos($article, ']')), 2);
  25. I have a string, something basically like: $string = "a lot of text a lot of text a lot of text a lot of text a lot of text [[image.jpg]] a lot of text a lot of text a lot of text a lot of text [[image2.jpg]] a lot of text a lot of text a lot of text a lot of text [[image3.jpg]]"; I'm needing to grab the first [[*]] value in the string, remove it from the string and set it as a variable, $firstimage. Then I'll need to just delete all of the others from the string. Could someone help me with this, are there any real good resources for regex online? 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.