Jump to content

jasonhardwick

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jasonhardwick's Achievements

Member

Member (2/5)

0

Reputation

  1. ok i tried that and nothing...it just passes the data to the database and sends me to my login page...
  2. Well the rest of my code works... it puts everything in the database and takes me to the successful registration page. It allows anything in the username and pasword fields.
  3. yeah, sorry i'll go into more detail... ok I would like to let my users upload an image. I want to resize it to save space on the server and also rename it to the users USERNAME but for some reason I get this as my output ... but nothing happens, no image is uploaded. Warning: explode(): Empty delimiter. in /home/content/j/a/s/jasonhardwick/html/update_profile_image.php on line 124 ����JFIF�����n�Wϵ��P��B�z�q� y��#O��q�%����[vםX�I����dr{� u�⬣Z��ZI$��*<�[�ӌ� �w��h{�3k���{:~�^�Zp��NU8����ղ��̣�.^mNn�DsH����� і��W�w$�jƙ O���:�{�!�T�%%���� �=��j���� #�#�w��`�����8�4���F��2�9���N�mn�.�Ҷ�N ]S������Z}u��}���Ƴ����U��Y~̐ �<�҃V�Qu�S���zY/��~-b�ڊ�% `j��ޝLJϕj��J���q�n��zLzG����ۛ�+�z��Wj������@�� �7e�w�x<��a߆��h�5� ׮n�4i%Yc� �6��/mݢ�V�l<������&�����Ф�kr.l��b�ѵ�ƿ�:0���٬D�S�N5c ����T�^�*���`r�6!�'*-�Ҧ��U��R��R�Hh�̿�χ�Yx?�Zu��m&�l�m�c��L��f��;Yi ���G#�(��qn�w�����_�m�jW�_�~\_xO�V]�x�\�c�6��N妺�5Hm�����d(I$���'���e��&��U���.�HԜ�����#+6����~���*8�1����T�gȝ8�A����Sko�>9�Ҿ�[��Ƌ����^��b��k���.I>ĞI�kb�5�SAmm��Q���~6x�㧋�ĺ���D���(�����D���&\��6Fl�IExN�>lD`���c6�qN1o��;��vޛ����MI`jW����n�\�NrZ��7q|�&�I]'m�L�C�����OA�I�d����\� ��n��4pƃ��HꑯX�ӂW�Ȣ��`����$���i1'� 5�bڿt��岱�^~����S�s���T�����3_\D�z�́@$��O,��FeU ��7��V��/� �])'{�#��|5���JY�b�_�k��F����g�p!4�pJĪ +�s�&�X��ߺ¾(�pNm7��'*T[OZq�*R�j����\��|�HG[9�W^�α���bq<��k��$�Տ5�I����6�,�d�7��l���e+��f `�eJ� �q�i/�7�:��K#�֭&��=˼�4= ��๶g$�7w6ח�C�[��bJ+��^�Q��75����b�S�����E���U]-k��nTv�i��[5�b*S�����p?<�긪�x�M�u�i�N /׽�<�����e��fr���QB(�>P2@=U=�3�d�r029�W��rM�qo��o]����Z1I$�$���lC��܎�ٹ���<k�����7B�80�]Ԃ�`����\t�8���EEf�M�=y/}�IY��[�N�*�R�惕�~��M�Vgqa{�:9�/�f���Y�:���r�9g ��k�%�B�ᕐ��03�� �d��օY�m^�K[�K]�u��q��%������4������ӱ���M#�8E�7�� �We��dr�8 $X�X���99r΅�v+���R����QX�M�u�~���GL)�����ӳm�nկk�yw?��Your profile image has been sucessfully updated
  4. I dont get either that bit of code doesn't work at all.
  5. I feel like my problem is around this part. if( ctype_alnum($pw1) // numbers & digits only && strlen($pw1)>6 // at least 7 chars && strlen($pw1)<21 // at most 20 chars ){ // valid }else{ header( "Location:Messages1.php?msg=12" ); } if( ctype_alnum($name) // numbers & digits only && strlen($name)>6 // at least 7 chars && strlen($name)<21 // at most 20 chars ){ // valid }else{ header( "Location:Messages1.php?msg=13" ); }
  6. I've got this code I've been working on and it was working for a while but recently I changed the page and I've lost the functionality of the validate username and password entries. if anyone sees why this stoped working please help... <?php if(isset($_POST['Submit'])){ //NEED TO CHECK IF FIELDS ARE FILLED IN if( empty($_POST['name'])){ header("Location:Messages1.php?msg=17"); exit(); } if( empty($_POST['email'])){ header("Location:Messages1.php?msg=16"); exit(); } if( empty($_POST['pw1']) && (empty($_POST['pw2']))){ header( "Location:Messages1.php?msg=4" ); exit(); } if( empty($_POST['f_name']) && (empty($_POST['l_name']))){ header( "Location:Messages1.php?msg=15" ); exit(); } if( empty($_POST['legal_accept'])){ header( "Location:Messages1.php?msg=14" ); exit(); } $name=$_POST['name']; $email=$_POST['email']; $f_name=$_POST['f_name']; $l_name=$_POST['l_name']; $zip_code=$_POST['zip_code']; $e_private=$_POST['e_private']; $country=$_POST['country']; $bio=$_POST['bio']; $occupation=$_POST['occupation']; $occupation_other=$_POST['occupation_other']; $website=$_POST['website']; $date_joined=date("D, F jS, Y \@ g:i a T"); //create date time $user_image=$_POST['user_image']; $legal_accept=$_POST['legal_accept']; $pw1=$_POST['pw1']; $pw2=$_POST['pw2']; if("$pw1" !== "$pw2" ){ header( "Location:Messages1.php?msg=5" ); exit(); } $ip = $_SERVER['REMOTE_ADDR']; //connect to the db server , check if uname exist include('config.php'); $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); if( ctype_alnum($pw1) // numbers & digits only && strlen($pw1)>6 // at least 7 chars && strlen($pw1)<21 // at most 20 chars ){ // valid }else{ header( "Location:Messages1.php?msg=12" ); } if( ctype_alnum($name) // numbers & digits only && strlen($name)>6 // at least 7 chars && strlen($name)<21 // at most 20 chars ){ // valid }else{ header( "Location:Messages1.php?msg=13" ); } if ($num > 0) {//Username already exist header( "Location:Messages1.php?msg=6" ); exit(); }else{ //if username does not exist insert user details $query=( "INSERT INTO user (f_name,l_name,zip_code,e_private,country,bio,occupation,occupation_other,website,uname,pw,email,date_joined,user_image,legal_accept,ip,level) VALUES ('$f_name','$l_name','$zip_code','$e_private','$country','$bio','$occupation','$occupation_other','$website','$name','$pw1','$email','$date_joined','$user_image','$legal_accept','$ip','Normal')"); if (@mysql_query ($query)) { header("location:login.php?reg=1"); exit; }else die(mysql_error()); } mysql_close(); } ?>
  7. Ok I've had this problem for a while now and no one seems to know how to help... so i'm trying again... i need this function to resize, rename and upload an image but for some reaseon I cant get it to work can anyone help? Thank, j <?php include "config.php"; $user_image = $_FILES['user_image']['tmp_name']; $filename1 = $_FILES['user_image']['name']; function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } $src1 = imagecreatefromjpeg($user_image); list($width,$height)=getimagesize($user_image); $newwidth1=250; $newheight1=($height/$width)*250; $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp1,$src1,0,0,0,0,$newwidth1,$newheight1,$width,$height); $tbl_name="user"; $username=$_SESSION['username']; $resault = explode($_FILES[$filename1]['name'], '.'); $ext = findexts ($_FILES['user_image']['name']) ; $new_name = $username."."; imagejpeg($tmp1,$target,100); $target = "user_images/"; $target1 = $target . $new_name.$ext; if(move_uploaded_file($_FILES['user_image']['tmp_name'], $target1)) { $sql=( "UPDATE $tbl_name SET user_image = '".$new_name.$ext."' WHERE uname='$username'"); echo "Your profile image has been sucessfully updated"; $id = mysql_insert_id(); } else { echo "Sorry, there was a problem uploading your file."; } imagedestroy($src1); imagedestroy($tmp1); ?>
  8. is this really that hard of a function that no one has any suggestions... maybe there is a better function to use.... anything???
  9. I feel like my problem is on this line but not sure how to fix it "$ext = findexts ($_FILES[$filename1]['name']) ;" anything?
  10. So I've got this code that takes an image that is uploaded resizes it and renames it... but it doesnt work properly i know i'm missing something just dont know what... <?php include "config.php"; $user_image = $_FILES['user_image']['tmp_name']; $filename1 = $_FILES['user_image']['name']; function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } $src1 = imagecreatefromjpeg($user_image); list($width1,$height1)=getimagesize($user_image); $newwidth1=250; $newheight1=($height1/$width1)*250; $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp1,$src1,0,0,0,0,$newwidth1,$newheight1,$width1,$height1); $tbl_name="user"; $username=$_SESSION['username']; $ext = findexts ($_FILES[$filename1]['name']) ; $new_name = $username."."; imagejpeg($tmp1,$target,100); $target = "user_images/"; $target1 = $target . $new_name.$ext; if(move_uploaded_file($_FILES[$filename1]['tmp_name'], $target1)) { $sql=( "UPDATE $tbl_name SET user_image = '".$new_name.$ext."' WHERE uname='$username'"); $rows = mysql_query($sql); echo "Your profile image has been sucessfully updated"; $id = mysql_insert_id(); echo $id; } else { echo "Sorry, there was a problem uploading your file."; } imagedestroy($src1); imagedestroy($tmp1); ?>
  11. thanks or the feedback i guess i'm just frustrated and want to get it up so i can review what i learned and redo what i did wrong... just a little disillusioning to think about starting over... :-\
  12. ok how about anyone who can just see whats wrong with my if statment in my button code. I cant figure that one out at all... ??? ??? ??? ???
  13. Yeah I know that there are many better ways to do everything!, and once i get my code working in my learning stage then i will rebuild it the proper way so if anyone could get my "freshman code" to work or some sugestions. then i can take a fresh look at the site and use what i've learned to build it better, but we all know that when your building a site while learning if you dont set a get it done goal you end up constantly starting over to use the "proper" code and structure then it never gets done. any help would be great. thanks
  14. ok i've got a set of questions that revolve around a network of users. Normally i would post them separate but just figured if anyone could help on anything that would be great... thanks {ps: failure can get annoying} let me explain a little. I'm putting together a site that alows you to create a network of users. you can search for and view USER X's page and if you want invite him to your network you can via a php button in the right hand corner. this button adds USER X's username and a , to a coulmn in my user table called "network_invite". now that php button needs to change based on the "network_invite" & "network" columns in my user table. so if you art viewing USER X's page and he is already a "network member" (ie your name is in the "network" colum) your right hand corner button will then change to a "Remove from Network" button with a different action (php below). ok so my questions are: 1: When I run the current button php I always get an "Invite to network" button? 2: When i try to run the "Invite to network" script it dosent seem to do anything? 3: I have no clue on how to delete an username from a string in the "network" column? 4: I need help adding a "username," to a string in the "network_invite" column? 5: I need help moving a "username," from a string in the "network_invite" column to a string in the "network" column? Button Code: <?php include "config.php"; $username=$_SESSION['username']; $user_profile=$_GET['username']; $sql4 = "SELECT * from user WHERE uname = '$user_profile' "; $sql5 = "SELECT * from user WHERE uname = '$username' "; $result4 = mysql_query($sql4) or die (mysql_error()); $row4 = mysql_fetch_assoc($result4); $result5 = mysql_query($sql5) or die (mysql_error()); $row5 = mysql_fetch_assoc($result5); //$user_profile=$_GET['username']; if($row5['network'] == "user_profile") { echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"accept_network.php\">"; echo "<input name=\"network_invite\" type=\"hidden\" id=\"network_invite\" value =\"$user_profile\"/>"; echo "<input name=\"invitee\" type=\"hidden\" id=\"invitee\" value =\"$username\"/>"; echo "<label>"."<input type=\"submit\" name=\"button\" id=\"button\" value=\"Accept in network\" />"."</label>"; echo "</form>"; else if($row4['network'] == "user_profile") { echo "<form id=\"form2\" name=\"form2\" method=\"post\" action=\"remove_network.php\">"; echo "<input name=\"network\" type=\"hidden\" id=\"network\" value =\"$username\"/>"; echo "<input name=\"invitee\" type=\"hidden\" id=\"invitee\" value =\"$user_profile\"/>"; echo "<label>"."<input type=\"submit\" name=\"button\" id=\"button\" value=\"Remove from network\" />"."</label>"; echo "</form>"; else if($row4['network_invite'] == "user_profile") { echo "network invite pending"; else { echo "<form id=\"form3\" name=\"form3\" method=\"post\" action=\"add_invite.php\">"; echo "<input name=\"network_invite\" type=\"hidden\" id=\"network_invite\" value = \"$username\"/>"; echo "<input name=\"invitee\" type=\"hidden\" id=\"invitee\" value = \"$user_profile\"/>"; echo "<label>"."<input type=\"submit\" name=\"button\" id=\"button\" value=\"invite to network\" />"."</label>"; echo "</form>"; }}} // swhile ($row = mysql_fetch_assoc($result)) { // } ?> Accept To Network Code: <?php include "config.php"; $tbl_name="user"; $user_profile=$_POST['invitee']; $network_invite=$_POST['network_invite']; $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); // // this is were I need a way to move from one column to another // $sql="UPDATE user SET network_invite = '$network_invite' WHERE uname = '$user_profile'"; // // $result = mysql_query($sql) or die (mysql_error()); if($result) { echo "Your have accepted ".$network_invite." to your network"."<BR/>"; } else { echo "Error"; } ?> Remove from network code: <?php include "config.php"; $tbl_name="user"; $user_profile=$_POST['invitee']; $network=$_POST['network']; $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); $sql="UPDATE user SET network = '$network' WHERE uname = '$user_profile'"; $result = mysql_query($sql) or die (mysql_error()); if($result) { echo "You have removed ".$network_invite." from your network"."<BR/>"; } else { echo "Error"; } ?> Invite to network code: <?php include "config.php"; $tbl_name="user"; $user_profile=$_POST['invitee']; $network_invite=$_POST['network_invite']; $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); $sql="UPDATE user SET network_invite = '$network_invite' WHERE uname = '$user_profile'"; $result = mysql_query($sql) or die (mysql_error()); if($result) { echo "Your Invite to".$network_invite."has been sent"."<BR/>"; } else { echo "Error"; } ?>
×
×
  • 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.