Jump to content

davidjmorin

Members
  • Posts

    16
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

davidjmorin's Achievements

Member

Member (2/5)

0

Reputation

  1. I am tyring to figure out how to allow the use of ' in the name field. I have tried string replace but that does not work. I also tried single and double quotes around value. Any help is appreciated. if(isset($_POST['upsubmit'])){ // Allowed mime types $csvMimes = array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'); // Validate whether selected file is a CSV file if(!empty($_FILES['file']['name']) && in_array($_FILES['file']['type'], $csvMimes)){ if(is_uploaded_file($_FILES['file']['tmp_name'])){ // Open uploaded CSV file with read-only mode $csvFile = fopen($_FILES['file']['tmp_name'], 'r'); // Skip the first line fgetcsv($csvFile); while(($line = fgetcsv($csvFile)) !== FALSE){ $Agent_ID =$line[0]; $Agent_Name =$line[1]; $Tran_Year =$line[2]; $Tran_Period =$line[3]; $Original_Mobile_ID =$line[4]; $Mobile_ID =$line[5]; $Device_Category =$line[6]; $Device_ID =$line[7]; $Account_Number =$line[8]; $Price_Plan =$line[9]; $Customer_Name =$line[10]; $Device_Change_Date =$line[11]; $New_Device_Contract_Begin_Date =$line[12]; $New_Device_Contract_End_Date =$line[13]; $Access_Charge =$line[14]; $Contract_Term =$line[15]; $Model =$line[16]; $Alt_Mobile_ID =$line[17]; $VZW_Provided_Equip =$line[18]; $Previously_Activated_Equip =$line[19]; $Installment_Contract =$line[20]; $Purchased_Receivable =$line[21]; $DPA_Service_Fee =$line[22]; $Agent_SSO_ID =$line[23]; $Customer_Type =$line[24]; $Previous_Price_Plan =$line[25]; $Previous_Access_Charge =$line[26]; $prevQuery = "SELECT ID FROM disc_Upgrades WHERE Device_ID = '".$line[7]."' AND Customer_Name = '".$line[10]."'"; $prevResult = $db->query($prevQuery); if($prevResult->num_rows > 0){ }else{ $db->query("INSERT INTO `disc_Upgrades(Agent_ID`, `Agent_Name`, `Tran_Year`, `Tran_Period`, `Original_Mobile_ID`, `Mobile_ID`, `Device_Category`, `Device_ID`, `Account_Number`, `Price_Plan`, `Customer_Name`, `Device_Change_Date`, `New_Device_Contract_Begin_Date`, `New_Device_Contract_End_Date`, `Access_Charge`, `Contract_Term`, `Model`, `Alt_Mobile_ID`, `VZW_Provided_Equip`, `Previously_Activated_Equip`, `Installment_Contract`, `Purchased_Receivable`, `DPA_Service_Fee`, `Agent_SSO_ID`, `Customer_Type`, `Previous_Price_Plan`, `Previous_Access_Charge`) VALUES ( '$Agent_ID', '$Agent_Name', '$Tran_Year', '$Tran_Period', '$Original_Mobile_ID', '$Mobile_ID', '$Device_Category', '$Device_ID', '$Account_Number', '$Price_Plan', '$Customer_Name', '$Device_Change_Date', '$New_Device_Contract_Begin_Date', '$New_Device_Contract_End_Date', '$Access_Charge', '$Contract_Term', '$Model', '$Alt_Mobile_ID', '$VZW_Provided_Equip', '$Previously_Activated_Equip', '$Installment_Contract', '$Purchased_Receivable', '$DPA_Service_Fee', '$Agent_SSO_ID', '$Customer_Type', '$Previous_Price_Plan', '$Previous_Access_Charge')"); } } // Close opened CSV file fclose($csvFile); $qstring = '?status=succ'; }else{ $qstring = '?status=err'; } }else{ $qstring = '?status=invalid_file'; } } // Redirect to the listing page header("Location: ../index.php".$qstring);
  2. Hey guys, Im trying to get a page to update profiles working and have been unsuccessful. Its a basic form with a server.php to process the updates. Server.php $username = mysqli_real_escape_string($db, $_POST['username']); $email = mysqli_real_escape_string($db, $_POST['email']); $password_1 = mysqli_real_escape_string($db, $_POST['password_1']); $password_2 = mysqli_real_escape_string($db, $_POST['password_2']); $location = mysqli_real_escape_string($db, $_POST['location']); $class = mysqli_real_escape_string($db, $_POST['class']); $id = mysqli_real_escape_string($db, $_POST['id']); if (empty($username)) { array_push($errors, "Username is required"); } if (empty($email)) { array_push($errors, "Email is required"); } if (empty($password_1)) { array_push($errors, "Password is required"); } if ($password_1 != $password_2) { array_push($errors, "The two passwords do not match"); } if (count($errors) == 0) { $password = password_hash($password_1, PASSWORD_DEFAULT); $query = "(UPDATE accounts SET password='".$password."', username='".$username."', email='".$email."', role='".$role."', class='".$class."' )"; mysqli_query($db, $query); $_SESSION['username'] = $username; $_SESSION['success'] = "Update Successful for user: " . $username; header('location: index.php'); } } update.php <?php session_start(); if (!isset($_SESSION['loggedin'])) { header('Location: ../login.php'); exit(); } if($_SESSION['class'] == 'user') { // Jump to user page header('Location:../user/home.php'); } ?> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>New User Registration</title> <link rel="stylesheet" type="text/css" href="../css/style.css"> <link href="../css/navbar.css" rel="stylesheet" type="text/css"> </head> <body> <?php include "../assets/navbar.php" ?> <div class="header"> <h2>Update User Info</h2> </div> <form method="post" action="server.php" class="form2"> <?php include('errors.php'); ?> <?php if (isset($_SESSION['success']) && ! empty($_SESSION['success'])) { echo "<div class='success'>" . htmlentities($_SESSION['success']) . "</div>"; unset($_SESSION['success']); } $id = $_REQUEST['id']; $username = $_REQUEST['username']; $location = $_REQUEST['role']; $email = $_REQUEST['email']; $password = $_REQUEST['password']; $class = $_REQUEST['class']; ?> <div class="input-group"> <input type="hidden" name="id" placeholder="<?php echo $id; ?>" value="<?php echo $id; ?>"> </div> <div class="input-group"> <input type="text" name="username" placeholder="<?php echo $username; ?>" value="<?php echo $username; ?>"> </div> <div class="input-group"> <input type="email" name="email" placeholder="Email Address?" value="<?php echo $email; ?>"> </div> <div class="input-group"> <input list="location" name="location" class="form-control" placeholder="<?php echo $location; ?>" required> <datalist id="location"> <option value="Manny"> <option value="Nate"> <option value="Jay"> <option value="Imran"> <option value="Sanat"> <option value="Minahan"> </datalist> </div> <div class="input-group"> <input list="class" name="class" class="form-control" placeholder="<?php echo $class; ?>" required> <datalist id="class"> <option value="user"> <option value="admin"> <option value="disabled"> </datalist> </div> <div class="input-group"> <input type="password" placeholder="Password" name="password_1"> </div> <div class="input-group"> <input type="password" placeholder="Confirm Location" name="password_2"> </div> <div class="input-group"> <button type="submit" class="btn" name="reg_user">Update</button> </div> </form> </body> </html> When I process the update it gives me a success message but the data in the table is not updated at all. Any suggestions on what im doing wrong here?
  3. what im really looking to do is grab images and put into images dir I have a site with over 10k images that i would like to grab and move... I know i can just move it easily but i wanna try to do it with coding
  4. I have the following <?php $url = 'http://www.google.com'; $outputfile = "dl.html"; $cmd = "wget -r -l1 -H -t1 -nd -N -np -erobots=off -i \"$url\" -O $outputfile"; exec($cmd); echo file_get_contents($outputfile); ?> This does not write to the DL file Any help ?
  5. Great thanks... I do still have a question about that "1" thing. What is the reason it outputs that to my page? Just curious so i know and can grow from that. Did what you suggested and worked fine. I thought i had tried that and it didnt work but i was wrong
  6. Hey again Have an issue when i use this code <div class="fullwidget"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Page Full Width') ) : ?> <h3> <?php _e("Help Me", ''); ?> </h3> <div class="box"> <?php _e(include("help.php")); ?> </div> <?php endif; ?> </div> The above code adds a 1 to the end of every statement my help file has links in it and at the end of the script on the webpage view it puts a 1 Order Form1 and here is the code from source <a href="http://mysite.com/orderform.pdf">Order Form</a>1 </div> IM lost!!
  7. just incase anyone was wondering.. here is how its done <h3> <?php _e("About Me", ''); ?> </h3> <div class="box"> <?php _e(include('facebook.html')); ?> </div> and data-div kind sir is what facebook uses. but thank you so much for your helpful response
  8. Hi all Im using wordpress for my site with custom sidebar boxes. The code is like this: <h3> <?php _e("About Me", ''); ?> </h3> <div class="box"> <?php _e("",'index'); ?> </div> What i want to do is add my fb into that. so like so <h3> <?php _e("About Me", ''); ?> </h3> <div class="box"> <?php _e("<div class="fb-activity" data-site="http://facebook.com/davidjmorin" data-width="300" data-height="300" data-header="true" data-recommendations="false"></div>",'index'); ?> </div> But that throws errors any help is much appreciated
  9. hey all I have a script i need help with. the following appears to be checking my email but not moving the file to the images DIR. any ideas why? the layout is like this http://blackberrypinpal.com/net/photoblog/images/ <?php $cfg = array(); ######## CONFIG ####### $cfg['upload_dir'] = '../images'; //what directory to upload images to $cfg['mail_server'] = 'pop.secureserver.net'; //email server $cfg['mail_port'] = '110'; //email server port /* email server services as described on http://php.net/imap_open */ $cfg['mail_services'] = '/pop3'; $cfg['mail_username'] = 'user@blackberrypinpal.com'; //username for the email address to check $cfg['mail_password'] = '*********'; //password for above user $cfg['debug'] = false; //true or false for debugging /* Accepted File Types: if less than four characters, use a dot as the first char. */ $cfg['accepted'] = array('.3g2','.png','.jpg','.jpe','jpeg','.gif'); ######## END CONFIG ######### $pid=2; $type = array('text', 'multipart', 'message', 'application', 'audio', 'image', 'video', 'other'); $encoding = array('7bit', '8bit', 'binary', 'base64', 'quoted-printable', 'other'); if(!is_dir($cfg['upload_dir'])) { @mkdir($cfg['upload_dir']) or die('Cannot create directory: '.$cfg['upload_dir'].'! Make sure the parent folder has write permissions'); } // open POP connection $inbox = @imap_open ('{'.$cfg['mail_server'].':'.$cfg['mail_port'].$cfg['mail_services'].'}', $cfg['mail_username'], $cfg['mail_password']) or die('Connection to server failed.'); // parse message body function parse($structure) { global $type; global $encoding; // create an array to hold message sections $ret = array(); // split structure into parts $parts = $structure->parts; for($x=0; $x<sizeof($parts); $x++) { $ret[$x]['pid'] = ($x+1); $that = $parts[$x]; // default to text if ($that->type == '') { $that->type = 0; } $ret[$x]['type'] = $type[$that->type] . '/' . strtolower($that->subtype); // default to 7bit if ($that->encoding == '') { $that->encoding = 0; } $ret[$x]['encoding'] = $encoding[$that->encoding]; $ret[$x]['size'] = strtolower($that->bytes); $ret[$x]['disposition'] = strtolower($that->disposition); if ($that->ifparameters == 1) { $params = $that->parameters; foreach ($params as $p) { if($p->attribute == 'NAME') { $ret[$x]['name'] = $p->value; break; } } } } return $ret; } function get_attachments($arr) { for($x=0; $x < sizeof($arr); $x++) { if($arr[$x]['disposition'] == 'attachment') { $ret[] = $arr[$x]; } } return $ret; } $count = @imap_num_msg($inbox) or die('No Messages in mailbox!'); //echo 'count: ' . $count; // get message headers and structure for ($c = 1; $c <= $count; $c++) { $id = $c; $headers = imap_header($inbox, $id); $structure = imap_fetchstructure($inbox, $id); // if multipart, parse if(sizeof($structure->parts) > 1) { $sections = parse($structure); $attachments = get_attachments($sections); } if ($cfg['debug']) { echo 'Structure of message: ' . $id . '<BR><pre>'; print_r($structure); echo '</pre><BR>'; echo 'Sections of message: ' . $id . '<BR><pre>'; print_r($sections); echo '</pre><BR>'; } // look for specified part for($x=0; $x<sizeof($sections); $x++) { if($sections[$x]['pid'] == $pid) { $dtype = $sections[$x]['type']; $dencoding = $sections[$x]['encoding']; $filename = $sections[$x]['name']; } } if ($cfg['debug']) { echo ' type: ' . $dtype . '<BR>'; echo 'encoding: ' . $dencoding . '<BR>'; echo 'filename: ' . $filename . '<BR>'; echo ' id: ' . $id . '<BR><BR>'; } $attachment = imap_fetchbody($inbox, $id, $pid); if (!$cfg['debug']) { //if (in_array(substr($filename, -4), $cfg['accepted'])) { if ($dencoding == 'base64') { // Decode and save attachment to a file list($usec, $sec) = explode(' ', microtime()); $usec = substr($usec,2,3); $name = date('Ymd.His'); $fp=fopen($cfg['upload_dir'].'/'.$name.'_'.$filename,'w'); fwrite($fp,imap_base64($attachment)); fclose($fp); } //} } } if (!$cfg['debug']) { // delete all emails for ($i = 1; $i <= $count; $i++) { imap_delete($inbox, $i); } imap_expunge($inbox); } imap_close($inbox); if (!$cfg['debug']) { header('Location: '.$cfg['upload_dir']); } ?> any help is appreciated.
  10. So i purchased the dolphin community script and in mozilla the ads are gone. but in IE the ads are there....what is going on??? The site is blackberrypinpal.com and if you look at the bottom that is where it is. I have no idea how to get rid of these. they are apparently commented out in the html file. Thanks for all your help
  11. Maybe you could help me on something else im trying to do. I would like to have it so that when a user uploads an item they can label it whatever they want rather then the uploaded file name such as "picture.jpg" and rename it just "fun at the beach" what would i put in my upload form and table in mysql and in the download page? here is the code upload.php <body bgcolor="black"> <form method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" id="userfile"> </td> <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> <?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } include 'config.php'; include 'opendb.php'; $query = "INSERT INTO upload (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); include 'closedb.php'; echo "<br>File $fileName uploaded<br>"; } ?> and the download form whree the user submitted name will appear <? if(isset($_GET['id'])) { include 'config.php'; include 'opendb.php'; $id = $_GET['id']; $query = "SELECT name, type, size, content FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; include 'closedb.php'; exit; } ?> <html> <head> <title>Download File From MySQL</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? include 'config.php'; include 'opendb.php'; $query = "SELECT id, name FROM upload"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { ?> <table border="1"> <? while(list($id, $name) = mysql_fetch_array($result)) { ?> <tr><td> <a href="download.php?id=<?=$id;?>"><?=$name;?></a> </td></tr> <? } ?> </table> <? } include 'closedb.php'; ?> </body> </html>
  12. how do i add a table to the following script? so that each link is in a row. <? if(isset($_GET['id'])) { include 'config.php'; include 'opendb.php'; $id = $_GET['id']; $query = "SELECT name, type, size, content FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; include 'closedb.php'; exit; } ?> <html> <head> <title>Download File From MySQL</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? include 'config.php'; include 'opendb.php'; $query = "SELECT id, name FROM upload"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <a href="download.php?id=<?=$id;?>"><?=$name;?></a> <br> <? } } include 'closedb.php'; ?> </body> </html> [/php
  13. here is the link ethans-space.com/test/test.html the php is in an iframe
  14. hey eveyone i have one last thing that i need an answer to. i would like to align my following code so that it sets it to the left side of the ;page. ive tried a few things but didnt work. also i would like to have it so that it only searches for picture and movie files. how would this be accomplished? thank you so much for any help <?php $dir = 'ajaxfiles'; $handle = opendir($dir); while ($file = readdir($handle)) { if (substr($file, 0, 1) !== '.'){ echo "<li><a href=\"" . $file . "\">" . $file . "</a></li>\n"; } } closedir($handle); ?>
  15. ok now how do i have it so that they appear line item. it just shows them on one continuous line style.cssexternal.htmporschegt.jpgaston.jpgexternal2.htmexternal3.htmferrari.jpg just like that. i want them like this style.css external.htm porschegt.jpg aston.jpg external2.htm external3.htm ferrari.jpg
×
×
  • 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.