Advertisement
Advertisement
| 03.23.2008 at 07:10PM PDT, ID: 23263287 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.23.2008 at 09:42PM PDT, ID: 21191976 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: |
action:php
<?php
global $postdata;
require_once './handle_form.php';
ini_set ( 'allow_call_time_pass_reference','On');
ini_set ( 'detect_unicode','On');
ini_set ( 'display_errors','On');
ini_set ( 'error_reporting','6135');
ini_set ( 'magic_quotes_gpc','Off');
ini_set ( 'memory_limit','32M' );
ini_set ( 'open_basedir','httpdocs:/tmp');
ini_set ( 'output_buffering', 'On' );
$postdata = $_POST;
$target=process ();
/* Redirect to a different page in the current directory that was requested */
redirect($target);
exit
?>
===================================
handle_form.php:
<?
require_once ('./auxfunctions.php');
require_once ('./mysqlfuns.php');
require_once ('./db_config.php');
function prepare_data() {
.
.
.
return $error;
}
function load_file() {
.
.
.
return false;
}
function load_db() {
.
.
.
.
return ($error);
}
function redirect($p)
{
/* Redirect to a different page in the current directory that was requested */
header("Location: ".$p);
exit ();
}
function process() {
.
.
.
return $target;
}
?>
|
| 03.24.2008 at 03:18PM PDT, ID: 21197736 |
| 03.24.2008 at 07:43PM PDT, ID: 21199167 |
| 03.24.2008 at 07:45PM PDT, ID: 21199176 |
| 03.24.2008 at 07:46PM PDT, ID: 21199183 |
| 03.25.2008 at 05:21AM PDT, ID: 21201140 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: |
action.php:
<?php
global $postdata;
require_once './handle_form.php';
ini_set ( 'allow_call_time_pass_reference','On');
ini_set ( 'detect_unicode','On');
ini_set ( 'display_errors','On');
ini_set ( 'error_reporting','6135');
ini_set ( 'magic_quotes_gpc','Off');
ini_set ( 'memory_limit','32M' );
ini_set ( 'open_basedir','httpdocs:/tmp');
ini_set ( 'output_buffering', 'On' );
$postdata = $_POST;
$target=process ();
/* Redirect to a different page in the current directory that was requested */
redirect($target);
exit;
?>
handle_form.php:
<?
require_once ('./auxfunctions.php');
require_once ('./mysqlfuns.php');
require_once ('./db_config.php');
function prepare_data() {
global $id, $frmId, $postdata, $hder, $record;
$error = false;
ini_set ( 'display_errors', 1 );
error_reporting ( E_ALL & - E_NOTICE );
/*generate date and time*/
$date = date ( 'm/d/Y' );
$time = date ( 'h:i:s A' );
$frmId = $postdata['formId'];
//Add record identifier
$id_array = array ('RecId' => $id);
$postdata = array_merge ( $id_array, $postdata );
/* Extract email address and mail thank you*/
if (array_key_exists ( 'email', $postdata )) {
$email = $postdata ['email'];
$to = $email;
$subject = "Thank you for your response";
$body = "Your prize will arrive shortly";
mail ( $to, $subject, $body );
array_delete_key('email',$postdata);
}
/* Clean out the 'submit' fields*/
if(array_key_exists('submit',$postdata)){array_delete_item('submit',$postdata);}
if(array_key_exists('submit_x',$postdata)){array_delete_item('submit_x',$postdata);}
if(array_key_exists('submit_y',$postdata)){array_delete_item('submit_y',$postdata);}
if(array_key_exists('process',$postdata)){array_delete_item('process',$postdata);}
/* Add date and time field headers*/
$postdata=array_merge($postdata,array('date'=>$date,'time'=>$time));
$keys = array_keys ( $postdata );
/*Header array -> comma delimited string + end of record mark*/
$akeys=array();
foreach ( $keys as $k )
{
$akeys=array_merge($akeys,array(pad_with_quotes($k)));
}
$hder = implode ( $akeys, "," ) . "\n";
$avals = array_values ( $postdata );
/*Surround values with quotes*/
$vals = array ( );
foreach ( $avals as $v ) {
$vals = array_merge ( $vals, array (pad_with_quotes ( $v ) ) );
}
/*Value array -> comma delimited strings + end of record mark*/
$record = implode ( $vals, "," ) . "\n";
return $error;
}
function load_file() {
global $site, $frmId, $hder, $record, $doc_root;
//data file name from formId
$file_path =$doc_root'/al/newtest/_private';
$filename = $frmId .'_Data.txt';
$savepath = $file_path.'/'.$filename;
//open data file for writing
if (! file_exists($savepath)) {
if (!file_put_contents ( $savepath, $hder, FILE_APPEND))
{
echo '<p> Error writing data header :'. $filename .'</p>';
echo '<p> File path is: '.$savepath.'</p>';
return true;}
if (!file_put_contents($savepath, $record, FILE_APPEND))
{
echo '<p> Error writing data header :'. $filename .'</p>';
echo '<p> File path is: '.$savepath.'</p>';
return true;
}
}
else
{
if (!file_put_contents ( $savepath, $record, FILE_APPEND))
{echo '<p> Error writing data to :'. $filename.' </p>';
echo '<p> File path is: '.$savepath.'</p>';
return true;}
}
return false;
}
function load_db() {
global $frmId, $hder, $record;
$error = false;
$tableId = $frmId . '_Data.tab';
/* Cant select the DB*/
if (! sel_db ( DB_USER )) {
$error = true;
print ('Cant log into db.');
return $error;
}
/*Insert data record into database*/
if (! tables_exist ( DB_NAME )) {
table_create ( $tableId, $hder );
$data = escape_data ( $record );
insert_into_table ( $tableId, $data );
}
return ($error);
}
function redirect($p)
{
/* Redirect to a different page in the current directory that was requested */
echo 'About to set Location: $p';
//header("Location: ".$p);
exit ();
}
function process() {
global $postdata, $doc_root;
global $id, $site;
global $err_mess, $mess;
$postdata=$_POST;
$site = 'http://'.$_SERVER['HTTP_HOST'].'/httpdocs/al/newtest';
$doc_root=$_SERVER['DOCUMENT_ROOT'];
$mess = 'begin: ';
$err_mess = '';
$id = get_rand_id ( 12 );
$erra = false;
$errb = false;
$errc = false;
if (!prepare_data ()) {
$mess .= ' + --data prep complete';
if (!load_file ()) {
$mess .= ' + --file loading complete';
/*if(!load_db()&&$erra==false)
{$mess.=' + db update complete';}
else
{$errc=true;$err_mess.=' + failure to load db';}*/
}
else
{
$errb = true;
$err_mess .= ' + failure to load file';
}
}
else
{
$erra = true;
$err_mess .= ' + failure in data prep';
}
if (($erra || $errb || $errc) == true) {
$target = $site . "/landing_page.php?" . $id . "&" . $mess . "&" . $err_mess;
} else {
$target = $site . "/landing_page.php?" . $id . "&" . $mess;
}
$serpd=urlencode(serialize($postdata));
$target = $target.'&'.$serpd;
return $target;
}
?>
|
| 03.25.2008 at 10:36PM PDT, ID: 21209100 |
1: 2: 3: 4: 5: 6: |
function redirect($p)
{
/* Redirect to a different page in the current directory that was requested */
header("Location: ".$p);
exit ();
}
|
| 03.28.2008 at 09:40PM PDT, ID: 21235558 |