Jump to content

Darkness Soul

Members
  • Posts

    133
  • Joined

  • Last visited

    Never

Everything posted by Darkness Soul

  1. I just change little structure... but, never know.. try it.. I need to go home, so, good luck with your code =) Bye, D.Soul [code]<?php function doDB() {     global $conn;     $conn = mysql_connect("localhost", "user", "pass");     mysql_select_db("db",$conn) or die(mysql_error()); } function emailChecker($email) {     global $conn, $check_result;     $check = "select id from subscribers where email = '$email'";     $check_result = mysql_query($check,$conn) or die (mysql_error()); } if ($_POST[op] != "ds") {     $display_block = " <form method=POST action=\"$_SERVER[PHP_SELF]\">     <p>         <font color=\"#164059\">Your E-Mail Address:<br>         <input type=text name=\"email\" size=40 maxlength=150>     </p>     <p>         Action:<br>         <input type=radio name=\"action\" value=\"sub\" checked> subscribe         <input type=radio name=\"action\" value=\"unsub\"> unsubscribe         <input type=\"hidden\" name=\"op\" value=\"ds\">     </p>     <p>         <input type=submit name=\"submit\" value=\"Submit Form\">     </p> </form>     "; } else if ($_POST[action] == "sub") {     if ($_POST[email] == "")     {         header("Location: manage.php");         exit;     }     doDB();     emailChecker($_POST[email]);     if (mysql_num_rows($check_result) < 1)     {         $sql = "insert into subscribers values('', '$_POST[email]')";         $result = mysql_query($sql,$conn) or die(mysql_error());         $display_block = "<p>Thanks for signing up!</p>";     } else {         $display_block = "<p>Your're already subscribed!</p>";     } } else if ($_POST[action] == "unsub") {     if ($_POST[email] == "")     {         header("Location: manage.php");         exit;     }     doDB();     emailChecker($_POST[email]);     if (mysql_num_rows($check_result) < 1)     {         $display_block = "<p>Couldn't find your address!</p>         <P> No action was taken.</p>";     } else {         $id = mysql_result($check_result, 0, "id");         $sql = "delete from subscribers where id = '$id' limit 1";         $result = mysql_query($sql,$conn) or die(mysql_error());         $display_block = "<p>You're Unsubscribed!</p>";     } } ?>[/code]
  2. What you want to use? The two ways have the same efect, but the first, is so clean and "fast".. so I use it.. the second way.. i use to random data, db reading, errors, ... [code]# first $var = array ( $a , $b , '1' , '2' ); # second, mode one $var[] = $a; $var[] = $b; $var[] = '1'; $var[] = '2'; # second, mode two while ( !feof ($file) ) {     $var[] = fget ($file); }[/code] You may chose by your needed.. ;) D.Soul
  3. try to change these lines [code]} else { $id = mysql_result($check_result, 0, "id"); $sql = "delete from subscribers where id = '$id'";[/code] for these ones [code]} else { $arr_result = mysql_fetch_array ( $check_result ); $sql = "delete from subscribers where id = '$arr_result['id']'";[/code] I fast-read your code and can't see anything wrong.. D.Soul
  4. Try the code now.. like it: [code]$sql = "SELECT username , homepage FROM customer ORDER BY username , homepage"; $result = mysql_query($sql , $conn) or die(print "Query failed: ". mysql_error() ); $lines = mysql_num_rows ( $result ); for ( $i=0;$i<$lines;$i++ ) {     $row = mysql_fetch_array($result);     print "${row[0]} - ${row[1]} <br>"; }[/code] If wont work, let's see what we can do. D.Soul
  5. Well, my view point.. Many info droped at page is ugly.. you need to filter it and show what you want to see.. in the pagination case.. test it.. make one page with 200 lines.. try to search manualy one of these lines.. so, make 20 pages of 10 lines.. try to search again.. its help a lot, do you see? test it and look for yourself ;) if the data come from a database, its help to.. filter exactly what you want to show (i rate the Select * From usage, except if you will use all fields) and limit it. the query will be faster then before. another try.. make the same 200 news, now with a thumbnail portrait about the text.. are you with me? =) may have a lot of "why" to do it.. but the better in my case.. Layout Style! D.Soul
  6. I agree with sanfly! My style is to learn programing hardcore.. with the function list and this forum open beside and many other helpfull links at favorites.. I like to read code standart to make a clear and validate code.. like to use xhtml validation.. and other things.. What your own style? Reading books? Looking for problems? Looking for examples?? =) D.Soul
  7. i think this cold is better: [code]<HTML> <HEAD> <script LANGUAGE="JavaScript"> function stateHandler(form){ var URL = "www.page.com/page.php?state=" + form.state.value; window.location.href = URL; } </SCRIPT> </HEAD> <body bgcolor="#FFFFFF"> <form name="state"> <select name="state" size=1 onChange="javascript:stateHandler(me)"> <option value="">Filter By State <option value="AL">Alabama <option value="AK">Alaska <option value="AZ">Arizona <option value="AR">Arkansas </select> </form>[/code] And the below code: [code]$state = $_GET['state']; if($state == ''){ $queryt = "SELECT * FROM `affiliations` ORDER BY `org`"; $resultt = mysql_query($queryt,$dbh) or die(mysql_error()); } else { $queryt = "SELECT * FROM `affiliations` ORDER BY `org` WHERE `state` = $state"; $resultt = mysql_query($queryt,$dbh) or die(mysql_error()); }[/code] Bless it could help.. =) D.Soul
  8. show me your function.. post it here.. lets see if have something wrong.. =) D.Soul
  9. Is this problem at instalation page of phpbb, right? So, the user you allow access into mysql database is the same you using at the setup page? Can't help you a lot.. [i]if[/i] you have some example like depuring the problem.. ^^" D.Soul
  10. the connect code is write correctly?? have you change the config file to connect to your db, and not the default? I've used phpbb [b]long[/b] time ago, so don't remember exactly how it works to connect.. ^~ D.Soul
  11. try to pass the info you need by the function.. like... function fun_write_sock ( $resource , $x , $y .. ) { # code # } and call it like fun_write_sock ( $msgsock , .. ) May your clue the function here? D.Soul
  12. I mean the function [b]string session_name ( [string name] )[/b].. when you start your [i]session[/i], use [b]session_name( "app name" ) ;[/b] to secure the unique file.. ^~ Sorry for my mess english x) D.Soul
  13. isn't simple you set different session names for each app? so, each app will use differente files to record sessions.. Never tested your idea, so, don't know.. ^^" D.Soul
  14. Are you sure that [b]$msgsock[/b] is your [b]Resource#[/b] ??? If is it true, try to check if is not null or isn't set.. check the vars around.. just an idea.. sometimes happen to get blank vars.. echo then.. ^~ D.Soul
  15. Is it your code?? This code have some problems.. like it: [b]if (isset(<FORM onsubmit="return ShowFormWarning()" ))[/b] You open two forms, one inside other.. is it right? I'm looking at your code and fixing what I think may I.. will post it after.. but, if it is not your code, post it.. =) *editing* well.. the code.. [code]<p style="color: #006699; font-size: 13px;"><strong>Add New Records</strong></p> <p style="color: #006699;">Fill in the fields below</p> <form action="doupload.php" enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="51200" /> <table align="center" width="100%" border="0">   <tr>     <td align="right" style="color: #006699;">       <strong>Shop Name:</strong>     </td>     <td>       <input onfocus="ShowPwWarning()" maxLength="45" size="45" name="shopName" />     </td>   </tr>   <tr>     <td align="right" style="color: #006699;">       <strong>Product Name:</strong>     </td>     <td>       <input onfocus="ShowPwWarning()" maxLength="45" size="45" name="prodName" />     </td>   </tr>   <tr>     <td align="right" style="color: #006699;">       <strong>Type:</strong>     </td>     <td>       <input maxLength="45" size="45" name="type" />     </td>   </tr>   <tr>     <td align="right" style="color: #006699;">       <strong>File to Upload:</strong>     </td>     <td>       <input type="file" name="image" />       <input type="submit" value="Upload!" />     </td>   </tr>   <tr>     <td align="center" colspan="2">       <input type=submit value="Become a member" name=submit />       <input type=reset value=Reset name=reset />     </td>   </tr> </table> </form>[/code] D.Soul
  16. [!--quoteo(post=366524:date=Apr 19 2006, 03:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 03:01 PM) [snapback]366524[/snapback][/div][div class=\'quotemain\'][!--quotec--](and to retrieve all the products from all categories upon page load)[/quote] I know that's work, but, guy.. drunk me before I do that.. do you think how long it can be? I know it have no real problem.. but.. x-x" If you want to do it (click on categorie and its drop down the data), think about use iframe to suporte dinamic querys.. then, when you click the categorie, its load the right query and recover the data.. I have no code sample with me here.. but look for it, is not a rare thing.. ^~ =3 D.Soul
  17. Yo, Hmmm, make a default categorie.. maybe the first found.. and, you will need one page.. with the table, if ALL products of ALL categories are children of the products table.. if some field change.. you may have a layout problem.. ;) so.. use a [b]SELECT id, title FROM categories ORDER BY categories[/b].. The result.. create your menu! =) D.Soul
  18. I use to make some gallery many times at work, and use the same method.. save the name of the imagem at db. =) I like this, is quite simple.. About your form.. I think its better then your.. xhtml validation ;)! [code]<form action="do_upload.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="51200" /> <TD>   <p style="color: #006699;">     <strong>File to Upload:</strong>   </p> </TD> <TD>   <input type="file" name="image" />   <input type="submit" value="Upload!" /> </TD>[/code] About your code.. try it, i write but have no time to test.. so.. do it for me ok?? =) [code]// Folder $file_dir = './path/to/upload/directory/'; // Get the image.. $image = $HTTP_POST_FILES['image']; // Verify for erros if ( $image['error'] == 0 ) {     // Ok, next: is it uploaded?     if ( is_uploaded_file ( $image['tmp_name'] ))     {         // Copy it to folder and check         if ( move_uploaded_file ( $image['tmp_name'] , $file_dir . $image['name'] ))         {             // Ok, done             # do something here, use header.. java redirection.. don't know, use your imagination..             print 'Done! The file was uploaded!';         }     } }[/code] D.Soul
  19. If I understood it right, you want to allow the admin select one of the table listed on the drop, click submit and view the table data.. right? De option value is the right name of the table?? and want to show all tables in one page? I think its easyer to you make one page for each table view, and in that page, do a SELECT * FROM.. listing all data so, your form call a page lice check.php, in this one, the $_POST will redirect you to the page you want.. Any better idea? ^^ D.Soul
  20. When your user log on the system, are you saving the ID in a session? If you are saving, just put the test on select to select the correct user. =) Are you saving something or just login ? D.Soul
  21. That helps a lot.. I use isset to do it, but never seen before that @.. that's why I'm surpriesed!! About the E_Stritc.. so, this may help me to make a better code.. if someone is ugly, the php will "warning me", rigth? Hmmm, it's look cool, need to learn how to use this =D Thanks, D.Soul
  22. Hi guys, I'm not sure about the knowledge level of this topic, so, here I am.. =) another newbie question! I was studing a little more about security, scripts, code standart.. and found this one.. so I've read: [b]"Avoid warnings of E_STRICT mode"[/b] The code just test this one with [b]error_reporting(0)[/b] and.. well.. o-o" i don't understood this. What is this E_STRICT and how useful is it? --- edit: I dont want to create a topic to this question, so I will use this.. I've seen it: if ( !@$color ) !@? What its do?? --- =) Thank anyway.. D.Soul
  23. I've done it!!! =DDDDDDD At PHP, the select need to write many data, but, php will read the last one... how to solute: use [b][][/b] after the name.. why? because php will ready it like an array ;) How we read and print an array guys?? Use [b]for [/b]or [b]foreach[/b].. =D The code thats work well: [code]<?php if ( $_POST['component_select'] != '' ) {     for ( $i = 0; $i < count ( $_POST['component_select'] ); $i ++ )     {         print $_POST['component_select'][$i] .'<br>';     } } ?> <FORM action="teste.php" method="post"> <P> <SELECT multiple size="10" name="component_select[]" STYLE="width: 500px;">     <OPTGROUP label="Group 1">         <OPTION value="Component_1_a">Component_1_1</OPTION>         <OPTION value="Component_1_b">Component_1_2</OPTION>         <OPTION value="Component_1_c">Component_1_3</OPTION>     </OPTGROUP>     <OPTGROUP label="Group 2">         <OPTION value="Component_2_a">Component_2_1</OPTION>         <OPTION value="Component_2_b">Component_2_2</OPTION>         <OPTION value="Component_2_c">Component_2_3</OPTION>     </OPTGROUP>     <OPTION value="Component_3_a">Component_3</OPTION> </SELECT> <BR> <INPUT type="submit" value="Send"><INPUT type="reset"> </P> </FORM>[/code] Enjoy, D.Soul
  24. About the password check.. do it with java.. ^~ something like it: function checkpassw ( form ) { if (form.field.value != form.field.value2 ) { stop sending form focus on password field } } And call it on the form.. maybe like it: <form ... onsubmit="javascript:checkpassw(me)"> =) D.Soul
  25. What exactly you need? Work with the image or with they functions (mail, coment..) or both?? Post a coment will work like a blog.. Mailling.. its ok right? Report is like a mail, to moderator.. sendind all info needed about the picture.. I think you will realy need a database, to save the coments and the registered pics... soh, thats not so hard, but need to know about php, mysql (for example), a little about images (do you whant to make thunbs?).. ^^! D.Soul
×
×
  • 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.