Jump to content

ukscotth

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by ukscotth

  1. Ok, Ive got it to work sort of using this : $fh = fopen("test.jpg", "r"); $data = addslashes(fread($fh, filesize("test.jpg"))); fclose($fh); // Create the query $SQL = " INSERT INTO customavatar(userid, filedata, filename,filedata_thumb) VALUES('13','$data','test.jpg','$data')"; // Execute the query $RESULT = mysql_query($SQL) or die("Couldn't insert image"); Not sure how to get the dimensions and create the thumbnail tho
  2. thanks ryan. So would I do something like this ? $filename = "test.jpg"; $content = file_get_contents($filename); $size = filesize($filename); mysql_query("INSERT INTO customavatar (`userid`, `filedata`, `filename`, `filesize`, `filedata_thumb`) VALUES ('20', '".$content."', '".$filename."','".$size."','".$content."')");
  3. Hi, I currently run a busy social networking site and im trying to change the software it runs off. Ive managed to transfer all the user data and the forum data but im stuck on transferring the pictures. The main problem im having is that on the old site they are stored in a folder on the server but on the new site they are stored in the database itself. heres the database structures for both sites : OLD SITE picture_id picture_username picture_type picture_path picture_label picture_status adult_status reason gallery 1 KellyIOW 1 pictures/193242254_nightclub_girls.jpg 1 0 ungrouped NEW SITE userid filedata dateline filename visible filesize width height filedata_thumb width_thumb height_thumb 30 [bLOB - 1.6 KB] 1247656853 me.jpg 1 1604 80 64 [bLOB - 1.4 KB] 60 48 I think Id need to do something like this : $fh = fopen("MyImg.jpg", "r"); $data = addslashes(fread($fh, filesize("MyImg.jpg"))); fclose($fh); // Create the query $SQL = " INSERT INTO Image(ImgTitle, ImgType, ImgData) VALUES('My Image', 'jpg', '$data')"; // Execute the query $RESULT = mysql_query($SQL) or die("Couldn't insert image"); But im unsure how to work out the right heights and widths for the images and the thumbnails Can anyone help plzzzz ? Thanks, Scott.
  4. I just wanted to say thanks for your help with this, tested it now and it works perfect. A mod can mark this as solved now
  5. ok cool thnx, what does the die part do, i keep seeing it on coding ? sorry for being stoopid, lol i sent you a pm by the way
  6. Thanks peeps, so for the first part id do something like this ?? <?php include("include/configvb.inc.php"); $users = mysql_query("SELECT * FROM joovili_users"); while ($got_users = mysql_fetch_array($users)){ $string = $got_users['account_created']; $string = str_replace('at','',$string); $timestamp = strtotime($string); mysql_query("INSERT INTO user (`userid`, `password`, `username`, `email`, `joindate`) VALUES ('".$got_users['id']."', '".$got_users['password']."', '".$got_users['username']."','".$got_users['email']."','".$timestamp."')"); } ?>
  7. I know this isnt a freelance forum but I dont suppose any of you would like to help me out with the whole migration if i paid ? im starting to think its all gonna be a bit to hard for me
  8. yep but thats about all i know, this is what ive been doing : <?php include("include/configvb.inc.php"); $users = mysql_query("SELECT * FROM joovili_users"); while ($got_users = mysql_fetch_array($users)){ mysql_query("INSERT INTO user (`userid`, `password`, `username`, `email`) VALUES ('".$got_users['id']."', '".$got_users['password']."', '".$got_users['username']."','".$got_users['email']."')"); }
  9. Thanks alot for your quick replies, had a look at both of those but im a bit of a newbie and it looks a bit complicated and chance of an example for my situation plzzzz ?
  10. Hi, Im in the process of changing the software my social networking site runs off and im currently trying to pull the data from the old database and load it into the new one. The part im stuck with is the dates as they are stored differently in both databases. Heres the old and the new structures : OLD field : account_created type: varchar example : 24th Dec 2009 at 13.19 NEW field : joindate type : int(10) example : 1246980713 Id like to pull the dates from the old database, convert them and then load them into the new one using SELECT etc. its just the conversion part im stuck with I also have a similar problem with the d.o.b fields : OLD field : birth_day type : (int11) example : 24 field : birth_month type : (int11) example : 6 field : birth_year type : (int11) example : 1980 NEW field : birthday type : char(10) example : 05-21-1978 Hope that makes and I hope someone can help. Thanks very much. Scott
  11. Ok thanks thorpe I didnt even know images could be stored that way, so the image doesnt actually have to be copied over to the new site, the whole image is stored as a binary string ? am i right ? sorry for being stoopid lol
  12. Hi, Sorry I thought this was a mysql help forum. My problem is im trying to change the software my social network runs on, so I would need to transfer all the data from the old site to the new site. I can manage transferring the user data and the forum data over no probs but I dont know how to transfer the pictures over as in the old site they are simply stored in a folder with a database table saying which pic belongs to which member etc. On the new site (vbulletin) the pics are stored in the database itself so Im unsure how i could transfer all the members pics over to the new site. Hope that makes sense. Scott
  13. Hi, Im trying to migrate my busy social networking site from joovili to vbulletin / vbadvanced and I think I can probably just about manage to transfer the user date and the forum data but im stuck on how to transfer the pictures over. Here is the database structure for Joovili site : picture_id picture_username picture_type picture_path picture_label picture_status adult_status reason gallery 1 KellyIOW 1 pictures/193242254_nightclub_girls.jpg 1 0 ungrouped 2 SandownSarah 1 pictures/377261578_evento-173209084.jpg 1 0 ungrouped 3 Phil28 1 pictures/424606021_bloke.jpg 1 0 ungrouped and heres the structure for the vbulletin site : pictureid userid caption extension filedata filesize width height thumbnail thumbnail_filesize thumbnail_width thumbnail_height thumbnail_dateline idhash reportthreadid state 1 1 BeckyObst jpg [bLOB - 2.4 KB] 2458 70 70 [bLOB - 2.4 KB] 2458 70 70 1246992563 951091872435d4ccf4ed4036ecd082e3 0 visible 2 1 bum jpg [bLOB - 49.4 KB] 50610 500 329 [bLOB - 5.0 KB] 5093 150 99 1246992563 c14b254f6028d7bbfe1454a9e53faafd 0 visible 3 1 design jpg [bLOB - 36.4 KB] 37250 397 600 [bLOB - 4.5 KB] 4580 99 150 1246992563 5f9938a079736984f4ab92af2c0a9f7c 0 visible Can anyone help ? Im willing to pay for this Many thanks, Scott
  14. Hi, I run a social network and it has a shoutbox on it. At 9pm each night i would like to remove the bad word filter on the shoutbox and then at say 5am put it back on. The shoutbox has a config file which contains the set bad words so I thought the best way to achieve what I want would be to use cron jobs and some kind of simple php upload and replace script. Any ideas on how i can code the php file to upload and replace the shoutbox config file ? Or maybe it would be better to have 2 config files and rename them at set times, im not sure. Thanks, Scott.
  15. I understand and thanks alot for your help. Looks like Il have to do it one table at a time, I may suggest to the original script writers that a relational database structure would be an idea for the next version of the script. Thanks again
  16. Hi, yes i see what you mean but that would involve alot of file editing. But thanks its a shame the people that wrote the script didnt do it that way to begin with
  17. Hi, I run a social networking site and I want to be able to change my members usernames when neccessary. The problem is there usernames are stored in various different tables under various different field names. Is there a way to run a query that searches and replaces text in the whole database ? I know you can do it by backing up the database and the using search replace in notepad but I wanted to add the option to my admin panel. Any ideas ? Thanks in advance. Scott.
  18. joovili wont mind, i know them quite well. I dont mind paying u if u want to help me out with it
  19. I presume its done in this file : <?php /*************************************************************************** * * Copyright © 2007 Joovili * ------------------------------------- * Version: 3.0 * ------------------------------------- * www.joovili.com * **************************************************************************** * Page: messages.php ***************************************************************************/ include("include/joovili.settings.php"); session_exists($session_logged); sent_messages_access($_SERVER['QUERY_STRING']); include("include/joovili.javascript.php"); include("modules/messages.functions.php"); include("modules/block.functions.php"); if (isset($_POST['delete_inbox'])) { $do_update = delete_inbox(); } if (isset($_POST['delete_sent'])) { $do_update = delete_sent(); } if (isset($_POST['delete_notifications'])) { $do_update = delete_notifications(); } if (isset($_POST['delete_inbox_message'])) { $do_update = delete_inbox_message(); } if (isset($_POST['delete_sent_message'])) { $do_update = delete_sent_message(); } if (isset($_POST['delete_notification_message'])) { $do_update = delete_notification_message(); } if (isset($_POST['send_message'])) { $do_update = send_message(); } ?> <?php include_once("themes/".SITETHEME."/joovili.header.php"); ?> <table width="100%" border="0" cellpadding="4"> <tr> <td width="25%" valign="top"> <table width="100%" border="0" cellpadding="6" cellspacing="2" class="table_1_css"> <tr> <td class="quick_menu"><a href="messages.php?do=inbox" class="quick_menu"> <?php echo $lang['messages_inbox'];?> (<?php echo message_stats('inbox_total');?>)</a></td> </tr> <tr> <td class="quick_menu"><a href="messages.php?do=sent" class="quick_menu"> <?php echo $lang['messages_sent'];?> (<?php echo message_stats('sent_total');?>)</a></td> </tr> <tr> <td class="quick_menu"><a href="messages.php?do=notifications" class="quick_menu"> <?php echo $lang['messages_notifications'];?> (<?php echo message_stats('notifications_total'); ?>)</a></td> </tr> <tr> <td class="quick_menu"><a href="blocked.php" class="quick_menu"> <?php echo $lang['block'];?> (<?php echo block_stats('block_total');?>)</a></td> </tr> <tr> <td class="quick_menu"><a href="messages.php?do=new" class="quick_menu"><?php echo $lang['messages_new'];?></a></td> </tr> </table></td> <td width="75%"> <table width="100%" border="0" cellpadding="4"> <tr> <td class="text_1_css"><?php echo $lang['menu_user_messages'];?></td> </tr> </table> <?php echo $do_update . message_reach('message');?> <br /> <?php if ($_GET['do'] == 'inbox') { ?> <table width="100%" border="0" class="table_1_css"> <tr> <td class="text_5_css"><?php echo $lang['messages_inbox'];?></td> </tr> </table> <form method="post" action="messages.php?do=inbox"> <table width="100%" border="0" cellpadding="4" cellspacing="2" class="text_2_css"> <?php $fetch_all_messages = sql_query("SELECT * FROM joovili_messages WHERE message_to = '".$_COOKIE['session_username']."' AND message_deleted = '0'"); if (mysql_num_rows($fetch_all_messages) == 0) { ?> <tr> <td colspan="5"><?php echo $lang['messages_inbox_empty'];?></td> </tr> <?php } $fetch_new_messages = sql_query("SELECT * FROM joovili_messages WHERE message_to = '".$_COOKIE['session_username']."' AND message_status = '0' AND message_deleted = '0' ORDER BY message_id DESC"); while ($new_messages = mysql_fetch_array($fetch_new_messages)) { ?> <tr> <td width="1%"><img src="themes/<?php echo SITETHEME;?>/images/icons/016.gif" /></td> <td><a href="messages.read.php?do=inbox&id=<?php echo $new_messages['message_id'];?>" class="text_2_css"> <?php echo $new_messages['message_subject'];?></a></td> <td><?php echo $new_messages['message_from'];?></td> <td width="30%"><?php echo $new_messages['message_date'];?></td> <td width="1%"><input type="checkbox" name="del[]" value="<?php echo $new_messages['message_id'];?>" /></td> </tr> <?php } if (!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $results = '10'; $from = (($page * $results) - $results); $fetch_old_messages = sql_query("SELECT * FROM joovili_messages WHERE message_to = '".$_COOKIE['session_username']."' AND message_status = '1' AND message_deleted = '0' ORDER BY message_id DESC LIMIT $from, $results"); while ($old_messages = mysql_fetch_array($fetch_old_messages)) { ?> <tr> <td width="1%"><img src="themes/<?php echo SITETHEME;?>/images/icons/017.gif" /></td> <td><a href="messages.read.php?do=inbox&id=<?php echo $old_messages['message_id'];?>" class="text_2_css"> <?php echo $old_messages['message_subject'];?></a></td> <td><?php echo $old_messages['message_from'];?></td> <td width="30%"><?php echo $old_messages['message_date'];?></td> <td width="1%"><input type="checkbox" name="del[]" value="<?php echo $old_messages['message_id'];?>" /></td> </tr> <?php } ?> </table> <br /> <table width="100%" border="0"> <tr> <td colspan="3" class="divider"> </td> </tr> <tr> <td class="pagination_text"> <?php ## INBOX PAGINATION define('pagination_max_link',10); $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM joovili_messages WHERE message_to = '".$_COOKIE['session_username']."' AND message_status='1' AND message_deleted = '0'"),0); $total_pages = ceil($total_results / $results); if($page > 1) echo '<a href="'.$_SERVER['PHP_SELF'].'?do=inbox&page='.($page-1).'" class="pagination_text"> '.$lang['common_previous'].'</a> '; $start = floor($page/pagination_max_link)*pagination_max_link; $end = ($start+pagination_max_link>$total_pages) ? $total_pages : $start+ pagination_max_link; for($i = $start+1; $i <= $end; $i++) echo ($page) == $i ? '<font color="#000000">'.$i.'</font> ' : '<a href="'.$_SERVER['PHP_SELF'].'?do=inbox&page='.$i.'" class="pagination_text">'.$i.'</a> '; if($page < $total_pages) echo ' <a href="'.$_SERVER['PHP_SELF'].'?do=inbox&page='.($page+1).'" class="pagination_text">'.$lang['common_next'].'</a>'; ?></td> <td width="1%"><input type="button" class="form_button" onClick="this.value=check(this.form)" value="<?php echo $lang['common_check'];?>" /></td> <td width="1%"><input name="delete_inbox" type="submit" class="form_button" value="<?php echo $lang['messages_delete'];?>" /></td> </tr> </table> </form> <?php } else if ($_GET['do'] == 'sent') { ?> <table width="100%" border="0" class="table_1_css"> <tr> <td class="text_5_css"><?php echo $lang['messages_sent'];?></td> </tr> </table> <form method="post" action="messages.php?do=sent"> <table width="100%" border="0" cellpadding="4" cellspacing="2" class="text_2_css"> <?php if (!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $results = '10'; $from = (($page * $results) - $results); $fetch_sent_messages = sql_query("SELECT * FROM joovili_messages WHERE message_from = '".$_COOKIE['session_username']."' AND message_deleted_sent = '0' ORDER BY message_id DESC LIMIT $from, $results"); if (mysql_num_rows($fetch_sent_messages) == 0) { ?> <tr> <td colspan="5"><?php echo $lang['messages_sent_empty'];?></td> </tr> <?php } else { while ($sent_messages = mysql_fetch_array($fetch_sent_messages)) { ?> <tr> <td width="1%"><img src="themes/<?php echo SITETHEME;?>/images/icons/018.gif" /></td> <td><a href="messages.read.php?do=sent&id=<?php echo $sent_messages['message_id'];?>" class="text_2_css"> <?php echo $sent_messages['message_subject'];?></a></td> <td><?php echo $sent_messages['message_to'];?></td> <td width="30%"><?php echo $sent_messages['message_date'];?></td> <td width="1%"><input type="checkbox" name="del[]" value="<?php echo $sent_messages['message_id'];?>" /></td> </tr> <?php } } ?> </table> <br /> <table width="100%" border="0"> <tr> <td colspan="3" class="divider"> </td> </tr> <tr> <td class="pagination_text"> <?php ## SENT PAGINATION define('pagination_max_link',10); $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM joovili_messages WHERE message_from = '".$_COOKIE['session_username']."' AND message_deleted_sent = '0'"),0); $total_pages = ceil($total_results / $results); if($page > 1) echo '<a href="'.$_SERVER['PHP_SELF'].'?do=sent&page='.($page-1).'" class="pagination_text"> '.$lang['common_previous'].'</a> '; $start = floor($page/pagination_max_link)*pagination_max_link; $end = ($start+pagination_max_link>$total_pages) ? $total_pages : $start+ pagination_max_link; for($i = $start+1; $i <= $end; $i++) echo ($page) == $i ? '<font color="#000000">'.$i.'</font> ' : '<a href="'.$_SERVER['PHP_SELF'].'?do=sent&page='.$i.'" class="pagination_text">'.$i.'</a> '; if($page < $total_pages) echo ' <a href="'.$_SERVER['PHP_SELF'].'?do=sent&page='.($page+1).'" class="pagination_text">'.$lang['common_next'].'</a>'; ?></td> <td width="1%"><input type="button" class="form_button" onClick="this.value=check(this.form)" value="<?php echo $lang['common_check'];?>" /></td> <td width="1%"><input name="delete_sent" type="submit" class="form_button" value="<?php echo $lang['messages_delete'];?>" /></td> </tr> </table> </form> <?php } else if ($_GET['do'] == 'notifications') { ?> <br /> <table width="100%" border="0" class="table_1_css"> <tr> <td class="text_5_css"><?php echo $lang['messages_notifications'];?></td> </tr> </table> <form method="post" action="messages.php?do=notifications"> <table width="100%" border="0" cellpadding="4" cellspacing="2" class="text_2_css"> <?php $fetch_all_notifications = sql_query("SELECT * FROM joovili_notifications WHERE notification_to = '".$_COOKIE['session_username']."'"); if (mysql_num_rows($fetch_all_notifications) == 0) { ?> <tr> <td colspan="5"><?php echo $lang['messages_notifications_empty'];?></td> </tr> <?php } $fetch_new_notifications = sql_query("SELECT * FROM joovili_notifications WHERE notification_to = '".$_COOKIE['session_username']."' AND notification_status = '0'"); while ($new_notifications = mysql_fetch_array($fetch_new_notifications)) { ?> <tr> <td width="1%"><img src="themes/<?php echo SITETHEME;?>/images/icons/019.gif" /></td> <td> <a href="messages.read.php?do=notification&id=<?php echo $new_notifications['notification_id'];?>" class="text_2_css"> <?php echo $new_notifications['notification_subject'];?></a></td> <td><?php echo $new_notifications['notification_from'];?></td> <td width="30%"><?php echo $new_notifications['notification_date'];?></td> <td width="1%"><input type="checkbox" name="del[]" value="<?php echo $new_notifications['notification_id'];?>" /></td> </tr> <?php } if (!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $results = '10'; $from = (($page * $results) - $results); $fetch_old_notifications = sql_query("SELECT * FROM joovili_notifications WHERE notification_to = '".$_COOKIE['session_username']."' AND notification_status = '1' ORDER BY notification_id DESC LIMIT $from, $results"); while ($old_notifications = mysql_fetch_array($fetch_old_notifications)) { ?> <tr> <td width="1%"><img src="themes/<?php echo SITETHEME;?>/images/icons/020.gif" /></td> <td> <a href="messages.read.php?do=notification&id=<?php echo $old_notifications['notification_id'];?>" class="text_2_css"> <?php echo $old_notifications['notification_subject'];?></a></td> <td><?php echo $old_notifications['notification_from'];?></td> <td width="30%"><?php echo $old_notifications['notification_date'];?></td> <td width="1%"><input type="checkbox" name="del[]" value="<?php echo $old_notifications['notification_id'];?>" /></td> </tr> <?php } ?> </table> <br /> <table width="100%" border="0"> <tr> <td colspan="3" class="divider"> </td> </tr> <tr> <td class="pagination_text"> <?php ## NOTIFICATIONS PAGINATION define('pagination_max_link',10); $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM joovili_notifications WHERE notification_to = '".$_COOKIE['session_username']."' AND notification_status='1'"),0); $total_pages = ceil($total_results / $results); if($page > 1) echo '<a href="'.$_SERVER['PHP_SELF'].'?do=notifications&page='.($page-1).'" class="pagination_text"> '.$lang['common_previous'].'</a> '; $start = floor($page/pagination_max_link)*pagination_max_link; $end = ($start+pagination_max_link>$total_pages) ? $total_pages : $start+ pagination_max_link; for($i = $start+1; $i <= $end; $i++) echo ($page) == $i ? '<font color="#000000">'.$i.'</font> ' : '<a href="'.$_SERVER['PHP_SELF'].'?do=notifications&page='.$i.'" class="pagination_text">'.$i.'</a> '; if($page < $total_pages) echo ' <a href="'.$_SERVER['PHP_SELF'].'?do=notifications&page='.($page+1).'" class="pagination_text">'.$lang['common_next'].'</a>'; ?></td> <td width="1%"><input type="button" class="form_button" onClick="this.value=check(this.form)" value="<?php echo $lang['common_check'];?>" /></td> <td width="1%"><input name="delete_notifications" type="submit" class="form_button" value="<?php echo $lang['messages_delete'];?>" /></td> </tr> </table> </form> <?php } else if ($_GET['do'] == 'new') { ?> <table width="100%" border="0" class="table_1_css"> <tr> <td class="text_5_css"><?php echo $lang['messages_new'];?></td> </tr> </table> <?php echo message_reach('form');?> <table width="100%" border="0" cellpadding="4" cellspacing="2" class="text_2_css"> <tr> <td width="50%"><?php echo $lang['messages_to'];?></td> <td width="50%"><?php echo $lang['messages_subject'];?></td> </tr> <tr> <td> <input name="to" type="text" class="form_field" style="width:100%;" maxlength="40" value="<?php if ($_GET['to']) { echo $_GET['to']; } else { echo $_POST['to']; } ?>" /> </td> <td> <input name="subject" type="text" class="form_field" style="width:100%;" maxlength="40" value="<?php if ($_GET['sub']) { echo $_GET['sub']; } else { echo $_POST['subject']; } ?>" /></td> </tr> <tr> <td colspan="2"><?php echo $lang['messages_message'];?></td> </tr> <tr> <td><textarea id="message" name="message" rows="10" class="form_textarea" style="width:99%;"><?php echo $_POST['message'];?></textarea></td> <td><?php echo display_smilies('message', '3');?></td> </tr> <tr> <td colspan="2"> <input name="send_message" type="submit" class="form_button" value="<?php echo $lang['messages_send'];?>" /></td> </tr> </table> <br /> <table width="100%" border="0"> <tr> <td colspan="3" class="divider"> </td> </tr> </table> </form> <?php } ?> </td> </tr> </table> <?php include_once("themes/".SITETHEME."/joovili.footer.php");?> thanks again for ur help with this, ur a star
×
×
  • 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.