philhxc
New Members-
Posts
5 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
philhxc's Achievements
Newbie (1/5)
0
Reputation
-
Hello, i got a code from http://www.tutorialcode.com/php/top-referer-script/and i tried many times to modify it to my needs with no success first the code <?php require('mysql_connect.php'); // Find out or base pure referer. $ref = $_SERVER['HTTP_REFERER']; // Split our URL into bits. $url = explode("/",$ref); // Take the 3rd part of the url (the main site) $surl = $url[2]; // Check to see if it contains the www. at the begining $found = ereg('\www.',$surl); if ($found) { $url = $surl; } else { $url = 'www.'.$surl; } $query = "SELECT website, hits FROM referers WHERE website = '$url'"; $result = mysql_query($query); $num = mysql_num_rows($result); if ($num == 1) { $site = mysql_fetch_array($result, MYSQL_ASSOC); if ($site['website'] != 'www.') { if ($site['website'] != 'www.tutorialcode.com') { $hits = $site['hits'] + 1; $website = $site['website']; $query = "UPDATE referers SET hits = $hits WHERE website = '$website'"; $result = mysql_query($query); } } } else { if (!empty($surl)) { $query = "INSERT INTO referers (website, hits) VALUES ('$url', '1')"; $result = mysql_query($query); } } $query = "SELECT * FROM referers ORDER BY hits DESC LIMIT 10"; // Change the limit to the top XX that you want to show. $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<a href="http://'.$row['website'].'">'.$row['website'].'</a> - <b>'.$row['hits'].'</b><br />'; } ?> what i need is the following: instead of displaying just the www.example.com referer info i want www.example.com/subfolder also if the referer is www.example.com/subfolder/subfolder i want it to display as www.example.com/subfolder. also is it possible for the script to record a hit, the referrer url must already exist on the database, or else it will get ignored, which brings me to the next point, add a referer manually using a text field. and last but not least, how can i get unique hits? any help is greatly appreciated, is it too hard? will i have to pay for it? thank you! Phil
-
could anyone help me by adding a image resize to the following script please.. the the size must be 345px width or 345px height keeping aspect ratio... i dont know if this is really hard or take too much time, but i dont know anything about php, so if someone could help me i would appreciated soooo much.. thanks the code: <?php //session_start(); include("./admin/config.php"); include("$include_path/common.php"); global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SESSION_VARS,$HTTP_POST_FILES; global $_SESSION; if ($HTTP_POST_VARS!="") $_POST=$HTTP_POST_VARS; if ($HTTP_GET_VARS!="") $_GET=$HTTP_GET_VARS; if ($HTTP_SESSION_VARS!="") $_SESSION=$HTTP_SESSION_VARS; if ($HTTP_POST_FILES!="") $_FILES=$HTTP_POST_FILES; check_user_login(); $img_src = ""; include("$include_path/$table_file"); if(isset($_POST['delete_image'])) { $sql = " select concat(id, '.', image_ext) as image from $tb_users where id = '$_SESSION[userid]' "; $query = mysql_query($sql) or die(mysql_error()); $file = $image_path . "/" . mysql_result($query, 0, "image"); if(file_exists($file)) { if(unlink($file)){ drop_rotation($_SESSION['userid']); set_notfound_image($_SESSION['userid']); $message = "Tu foto ha sido borrada."; } else { $message = "Ha ocurrido un error, tu foto no se ha podido borrar."; } } else { $message = "No se encontro ninguna foto."; } } if(isset($_POST['upload_image'])) { $sql = " select total_files from $tb_users where id = '$_SESSION[userid]' "; $query = mysql_query($sql) or die(mysql_error()); $total = mysql_result($query, 0, "total_files"); if ($total <= 20) { $sql = " select image_status from $tb_users where id = '$_SESSION[userid]' "; $query = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($query); if ($res['image_status']!="disabled") { $upload_image_error = false; $allowed = false; $the_file_ext_array = explode(".", $_FILES['the_file']['name']); $the_file_ext = $the_file_ext_array[sizeof($the_file_ext_array)-1]; if(!strlen($_FILES['the_file']['name'])) { $upload_image_error = true; $message = "No subiste nada!<br><br>"; } $sql = " select * from $tb_image_types "; $query = mysql_query($sql) or die(mysql_error()); while($array = mysql_fetch_array($query)) if($the_file_ext == $array["ext"]) $allowed = true; if(!$allowed) { $upload_image_error = true; $message = "El tipo de archivo no es permitido<br>solo puedes subir:<br><br>"; $ssql = " select * from $tb_image_types "; $squery = mysql_query($ssql) or die(mysql_error()); while($sarray = mysql_fetch_array($squery)) $message .= "." . $sarray["ext"] . "<br>"; } if($allowed) { // echo " tmp ".$_FILES['the_file']['tmp_name']; $size = getimagesize($_FILES['the_file']['tmp_name']); list($foo, $width, $bar, $height) = explode("\"", $size[3]); if($width > $max_image_width) { $upload_image_error = true; $message = "Tu imagen no puede ser mas de " . $max_image_width . " píxeles de ancho<br><br>"; } if($height > $max_image_height) { $upload_image_error = true; $message = "Tu imagen no puede ser mas de " . $max_image_height . " píxeles de alto<br><br>"; } } if(!$upload_image_error) { $sql = " select total_files from $tb_users where id = '$_SESSION[userid]' "; $query = mysql_query($sql) or die(mysql_error()); $total = mysql_result($query, 0, "total_files"); $number = $total + 1; $main_picture= $_POST['pic_type']; if($total && $main_picture=="y") { $number=1; } $file_name = $_SESSION['userid'] . "_$number." . $the_file_ext; if(isset($_POST['overwrite'])) { if(move_uploaded_file($_FILES['the_file']['tmp_name'], $image_path . "/" . $file_name)) { if($main_picture=="y") { update_ext($the_file_ext, $_SESSION['userid']); } $newest_sql ="select * from $tb_newest_pictures where user_id ='$_SESSION[userid]' and image_number ='$number' "; $newest_res = mysql_query($newest_sql); if(mysql_num_rows($newest_res) ) { $newest_picture_sql ="update $tb_newest_pictures set upload_time=now() where user_id ='$_SESSION[userid]' and image_number ='$number' "; mysql_query($newest_picture_sql); echo mysql_error(); } else { $newest_picture_sql ="insert into $tb_newest_pictures(user_id,image_number,upload_time) values ('$_SESSION[userid]','$number',now() ) "; mysql_query($newest_picture_sql); echo mysql_error(); } if ($automatically_approve_picture=="no"){ $message = "Tu foto se subio eitosamente. Porfavor espera 24 horas hasta que sea revisada."; } else { $message = "Tu imagen fue subida exitosamente."; } $uid=$_SESSION['userid']; $main=$_POST['pic_type']; if($main == "n") $desc=$_POST['pic_desc']; $sql="insert into $tb_upload_image_details (id,user_id,total_file_count,main,description) values('',$uid,$number,'$main','$desc')"; mysql_query($sql); if($main == "n") { $sql = "update $tb_users set total_files=total_files+1 where id = '$_SESSION[userid]' "; $query = mysql_query($sql) or die(mysql_error()); } else { if(!$total) { $sql = "update $tb_users set total_files=total_files+1 where id = '$_SESSION[userid]' "; $query = mysql_query($sql) or die(mysql_error()); } } } else { $message = "Tu imagen no se pudo subir, ocurrió un error de escritura."; } update_url("here", "", $_SESSION['userid']); if ($automatically_approve_picture=="yes") approve_image($_SESSION['userid']); else queue_image($_SESSION['userid']); $imgsrc="$dat_base_url/images/$file_name"; NewImageAddedNotification($_SESSION['userid'], $imgsrc); } else { if (!@copy($_FILES['the_file']['tmp_name'], $image_path . "/" . $file_name)) { $message = "Tu nueva foto no se pudo subir."; } else { $message = "Tu nueva imagen fue subida exitosamente."; update_ext($the_file_ext, $_SESSION['userid']); } update_url("here", "", $_SESSION['userid']); if ($automatically_approve_picture=="yes") approve_image($_SESSION['userid']); else queue_image($_SESSION['userid']); $imgsrc="$dat_base_url/images/$file_name"; NewImageAddedNotification($_SESSION['userid']); } } // if (uploade_image_error) } // if (disabled) else { $message = "Tu foto fue desabilitada por el administrador."; } } else { $message = "Exediste el limite para subir imagenes..."; } } if(isset($_POST['submit_image_url'])){ $message = del_image($_SESSION[userid]); $message = update_url($_POST['update_where'], $_POST['new_image_url'], $_SESSION['userid']); } include("$include_path/doc_head.php"); include("$include_path/styles.php"); include ("Ads_new.php"); include("$include_path/right.php"); include("$include_path/left.php"); // start content $form = ""; $location = ""; if(isset($message)){ $message_code = <<<EOF <table cellpadding="5" cellspacing="5" border="0"> <tr> <td class="s9">$message</td> </tr> </table> EOF; } $user_id = isset($_SESSION['userid']) ? $_SESSION['userid'] : 0; $image_src = get_image($user_id,3); include("$include_path/image_rules.php"); $image_code = $image_rules; $tpl->assign(array('IMAGE_SRC' => $image_src)); $tpl->parse('IMAGE_CODE', 'upload_image_code'); $image_code .= $tpl->fetch('IMAGE_CODE'); if($allow_local_image == 1){ $tpl->assign(array('MAX_IMAGE_SIZE' => $max_image_size)); $location = query_where($user_id); if($location == "here" || !$allow_remote_image){ $tpl->assign(array('CHECKED_LOCAL_IMAGE' => ' checked')); $img_src = ""; } $tpl->parse('FIELD_LOCAL_IMAGES', 'field_local_image'); } else { $tpl->clear_dynamic('field_local_image'); } if($allow_remote_image == 1){ if($location == "there" or $allow_local_image == 0) { $tpl->assign(array('CHECKED_REMOTE_IMAGE' => " checked")); } $the_img_src = strstr($img_src, "notfound_image") ? "" : $img_src; $tpl->assign(array('THE_IMG_SRC' => $the_img_src)); $tpl->parse('FIELD_REMOTE_IMAGE', 'field_remote_image'); } else { $tpl->clear_dynamic('field_remote_image'); } $tpl->parse('FORM', 'upload_form'); $form = $tpl->fetch('FORM'); $title = "Subir Foto"; if(isset($_SESSION['userid'])) $content .= $image_code; if(isset($message_code)) $content .= $message_code; if(isset($_SESSION['userid'])) $content .= $form; $final_output = table($title, $content); $tpl->assign(array('CONTENT_TEXT' => $final_output)); $tpl->parse('PAGE', 'main'); $final_output = $tpl->fetch('PAGE'); $final_output = final_output($final_output); //echo $final_output; include ("copy.php"); function NewImageAddedNotification($uid, $img) { global $tb_users, $tb_user_types, $dat_base_url, $owner_email, $tb_email_templates; $sql = "select u.username, ut.user_type from $tb_users u, $tb_user_types ut where u.id = '$uid' and u.user_type=ut.id "; $res = mysql_query($sql); echo mysql_error(); if ($data = mysql_fetch_row($res)) { $username = $data[0]; $usertype = $data[1]; } $mailheader="From: ".$owner_email; $mailheader.="\r\nMIME-Version: 1.0\r\n"; $mailheader.="Content-type: text/html; charset=iso-8859-1\r\n"; $subject = "Nueva imagen agregada en $dat_base_url "; $sql = "select file_content from $tb_email_templates where file_name = 'new_image_notification' "; $res = mysql_query($sql); echo mysql_error(); if ($data = mysql_fetch_row($res)) { $message = $data[0]; } $message = ereg_replace("<<BASE_URL>>",$dat_base_url, $message); $message = ereg_replace("<<USERNAME>>",$username, $message); $message = ereg_replace("<<USERTYPE>>",$usertype, $message); $message = ereg_replace("<<IMAGE_SRC>>",$img, $message); /* $message = "New image was added in the site $dat_base_url <br><br> <b>User Details :</b> <br><br> Username : $username<br> Usertype : $usertype <br><br> Image : <img src='$img' border=1 >"; */ $to = $owner_email; mail($to, $subject, $message, $mailheader); } ?>
-
here are the headers info and stuff form sent mail Delivered-To: xxx.xxx@gmail.com Received: by 10.114.196.17 with SMTP id t17cs1493917waf; Fri, 23 Mar 2007 15:54:57 -0700 (PDT) Received: by 10.70.87.5 with SMTP id k5mr6638889wxb.1174690493247; Fri, 23 Mar 2007 15:54:53 -0700 (PDT) Return-Path: <xxx@panda.ultrawhb.com> Received: from panda.ultrawhb.com (panda.ultrawhb.com [65.98.6.51]) by mx.google.com with ESMTP id i14si4809226wxd.2007.03.23.15.54.42; Fri, 23 Mar 2007 15:54:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xxx@panda.ultrawhb.com designates 65.98.6.51 as permitted sender) Received: from philhxc by panda.ultrawhb.com with local (Exim 4.63) (envelope-from <philhxc@panda.ultrawhb.com>) id 1HUseX-0006DV-JT for xxx.xxx@gmail.com; Fri, 23 Mar 2007 22:54:33 +0000 To: xxx.xxx@gmail.com Subject: Philsen From: Philipp Berndt <xxx.xxx@gmail.com> Reply-To: Philipp Berndt <xxx.xxx@gmail.com> Message-ID: <1174690473ddfm@www.xxx.com> X-Sender-IP: 190.47.165.201 X-Mailer: PHP v4.4.6 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="==Multipart_Boundary_xc72f94069700877863f11941653fc59ax" Date: Fri, 23 Mar 2007 22:54:33 +0000 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - panda.ultrawhb.com X-AntiAbuse: Original Domain - gmail.com X-AntiAbuse: Originator/Caller UID/GID - [32208 500] / [47 12] X-AntiAbuse: Sender Address Domain - panda.ultrawhb.com X-Source: /usr/bin/php X-Source-Args: /usr/bin/php index.php X-Source-Dir: philipp-berndt.info:/public_html/lindasdefotolog This is a multi-part message in MIME format. --==Multipart_Boundary_xc72f94069700877863f11941653fc59ax Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit :start blah :end IP: 190.47.165.201 HOST: pc-201-165-47-190.cm.vtr.net --==Multipart_Boundary_xc72f94069700877863f11941653fc59ax Content-Type: image/jpeg; name="01.jpg" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="01.jpg" /9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE[...]oor0MJhKdOnKMZTac29XG9+WK6RXYD//2Q== and for the gmail sent email Received: by 10.114.196.17 with HTTP; Fri, 23 Mar 2007 15:56:50 -0700 (PDT) Message-ID: <6d2f1a800703231556j522c1ab7jb56123f38a1359c1@mail.gmail.com> Date: Fri, 23 Mar 2007 18:56:50 -0400 From: "Philipp Berndt" <xxx.xxx@gmail.com> To: xxx.xxx@gmail.com Subject: Philsen MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_232045_30808873.1174690610588" Delivered-To: xxx.xxx@gmail.com ------=_Part_232045_30808873.1174690610588 Content-Type: multipart/alternative; boundary="----=_Part_232046_26294074.1174690610588" ------=_Part_232046_26294074.1174690610588 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline blah ------=_Part_232046_26294074.1174690610588 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline blah<br> ------=_Part_232046_26294074.1174690610588-- ------=_Part_232045_30808873.1174690610588 Content-Type: image/jpeg; name=01.jpg Content-Transfer-Encoding: base64 X-Attachment-Id: f_ezn8e3cn Content-Disposition: attachment; filename="01.jpg" /9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wB[...]D0/4NfBr4k6b8SfDd7e+G/Jtof7Y82X+2NBk2 +ZoOqQp8kWqSSNukkRflQ4zk4UEgoor0MJhKdOnKMZTac29XG9+WK6RXYD//2Q== ------=_Part_232045_30808873.1174690610588-- at the end of the image info from the gmail sent mail theres this ------=_Part_232045_30808873.1174690610588-- could this be it? anyways.. who ever can figure this thing out please help me. thanks phil
-
Hello.. ok im using wordpress and two plugins called postie (wich lets you post to wordpress from email) and a contactform plugin called dd-formmailer. both systems work ok, but for some reason when i send a email from the contact form postie doesnt recognize the image (yes the image is attached), however if i send the same image from gmail or another contact form plugin (cforms) it works.. the idea is so that user can submit their photos to my blog.. but i cant use cforms because dd-formmailer has a lot more options that i use.. i figure out that the problem lies within the headers of the email. can someone help me by correcting dd-formmailer headers? DD Form Mailer Code: http://www.philipp-berndt.info/dd-formmailer.txt CForms Code: http://www.philipp-berndt.info/cforms.txt thank you in advanced! phil