Jump to content

spasme

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by spasme

  1. Hello agian guys. I have this URL: domain.ro/ceasuri.php?brand=fossil&offset=0&curea=piele&model=barbatesc I turned it into: domain.ro/ceasuri-fossil-0-piele-barbatesc Using: Options +FollowSymLinks RewriteEngine on RewriteRule ceasuri-(.*)-(.*)-(.*)-(.*) ceasuri.php?brand=$1&offset=$2&curea=$3&model=$4 The thing is that i need the mod_write to work for domain.ro/ceasuri-fossil domain.ro/ceasuri-fossil-0 domain.ro/ceasuri-fossil-0-piele domain.ro/ceasuri-fossil-piele-barbatesc-all ... also. How do i do that ?! Thanks in advance.
  2. OK, don't do that. I'm not so good with security. It was just an example. @Mchl -- an example would probably be most welcomed.
  3. Ok, if you insist on doing this yourself... This part is about designing you DataBase. You'll want to have a table for your users and the corresponding details and a table to store your file's information. Each user shlould have and unique ID field (auto increment or auto generated) or something. The file's table should have an "owner" and "approved" field so you can keep track of your stuff... So... when a user Posts/Uploads a file, it's name and details go intro the files table along with the owner ID. You will probably be using a form to let your users post the files. You can include a hidden fiend with name="approved" and value="no" and one with the name="owner" value="username" (use SESSION to get username) The idea behind this is that once the user submits the form the file will automatically be marked in your file's table as waiting to be approved . To view the pending files you would then simply (pending.php) SELECT * FROM `files` WHERE approved='no' ... (COUNT,GROUP...) whatever else you need to sort Whis will then echo out all the files pending approval. Once you have them echoed you cand simply echo a link next to each filename with actions (Edit, Delete, ..., Approve) these links might look somenthing like this: <a href="actions.php?action=approve&id=$sql[id]">Approve</a> In actions.php you simply use a CASE function based on the action variable in the URL and execute SQL stuff based on that. After approving a file you could redirect yourself back to the pending.php and so on ... Hope this helps (and makes sense). I can give you an example of an actions.php i from one of my latest projects. Cheers
  4. I use Dreamweaver for basic HTML, tables, layouts, forms and CSS. I think its great for these because of the Design/Split view mode. For PHP and others I use Zend. I only descovered Zend Studio a few months ago and i'm pleased to say that it's made the PHP coding alot easier. I've also been playing around with Zend Guard and Zend Optimizer... great products. I've recently, based on your posts, tryed Eclipse. It's also a great product. I'm amazed its free I'm can't point out why but I still prefer tu use Zend for PHP coding.
  5. You'll have alot of work cut out for you ... If you're just starting with PHP i'd sugest using a ready made CMS or something. From my experience using Joomla with certain modules (DOCman) would cover most of the features you need. Their free and easy to install and understand. From what i remenber it does have a pending queue of files waiting to be approved. Google it and see if it has all the features you'll be needing. In my oppinion it might pe easier to customize the modules you suite your needs than to start from stratch. Cheers. (hope this isn't considered advertising)
  6. sure! $message .= "Age: $age\n"; or keep the next line inticator separate to have a cleaner code: $message .= "\n"; \n is equivalent to br (just so you know) Happy Coding! LE: I'd really advise to take a look at the script i attached in the earlyer post... it will explane allot
  7. include this $message .= $age."\n"; $message .= $message."\n";
  8. In theory this is all very easy with PHP and $_GET but keep in mind that some Firewalls, Antivirusez, Internet Security software might interpret this as a sort of attack or takeover. I mean telling some setup.exe to open the browser and acces some http. If this is not a problem for you use something like: http://example.com/tracking.php?code=XXXXXXX tracking.php should look something like this: <?PHP $code = $_GET[code]; mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); $sqlquery = "INSERT INTO code_table VALUES('field1', 'field2', ... , '$code')"; echo "Some message..."; ?> Once again if you don't want so exploit the user's browser you might want to look into some PEARL or other stuff (i'm no expert) [/code]
  9. id would help to see the error and the whole code. first off, can you echo $_session['username']; ?
  10. <?php if ($_POST['submit']==true) //if "email" is filled out, send email { //send email $email = $_POST['email'] ; $subject = "Job Application" ; $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $email = $_POST['email'] ; $age = $_POST['age'] ; $reason = $_POST['reason'] ; $timezone = $_POST['timezone'] ; $times = $_POST['times'] ; $to = "boxerman@uksbestsite.com"; $subject = $subject; $message .="\n"; $message .= $firstname."\n"; $message .= $lastname."\n"; $message .= $email."\n"; $message .= $reason."\n"; $message .= $timezone."\n"; $message .= $times."\n"; $headers ='From: boxerman@uksbestsite.com' . "\r\n" . 'Reply-To: boxerman@uksbestsite.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); echo "Thank you for applying!, please allow upto 24 hours for reply!"; } else //if "email" is not filled out, display the form { echo "<form method='post' action=''djapp.php'> First Name: <input name='firstname' type='text' /><br /> Last Name: <input name='lastname' type='text' /><br /> Email: <input name='email' type='text' /><br /> Age: <input name='age' type='text' /><br /> Time Zone: <input name='timezone' type='text' /><br /> Times Can DJ: <input name='times' type='text' /><br /> Reason for applying:<br /> <textarea name='message' rows='10' cols='40' /> </textarea><br /> <input type='hidden' name='submit' value='true' /> <input type='submit' value='Submit' /> </form>"; } ?> I've tested it on my server and it works fine. HERE You needed to have a form (hidden value) that let the form know when to start sending...
  11. Maybe this will help: <? $ok = array(); array_push($ok, "value1"); foreach($ok as $value) { array_push($ok, "value2"); } print_r($ok); // this prints the whole array echo "<br>"; echo $ok[1]; // arrays start from [0] so the 2nd value si called using [1] and so on echo "<br>"; ?>
  12. ok, so you need to delete the entire row... can you echo $value and $bf_record?
  13. $headers should look somethink like this: $headers="From: ".$yourname." <".$youremail.">\n"; $headers.="Reply-To: ".$yourname." <".$youremail.">\n"; $headers.="MIME-Version: 1.0\n"; $headers.="Content-Type: multipart/mixed; boundary=\"".$boundary."\"\n"; $headers.="X-Sender: ".$_SERVER['REMOTE_ADDR']."\n"; $headers.="X-Mailer: PHP/".phpversion()."\n"; $headers.="X-Priority: ".$priority."\n"; $headers.="Return-Path: <".$youremail.">\n"; $headers.="This is a multi-part message in MIME format.\n";
  14. I'm not sure i understood exactly what you need done... If you use mysql_query("DELETE FROM ...") -- this DELETES the entire row. If you need to set certain fields in your table as blank or something use something like this: $result = mysql_query("UPDATE issues SET field_name='$variable' WHERE id='$id' ") or die ("Could not read data because ".mysql_error()); or an other idea: try usgin $value = $_GET[value] or $value = $_POST[value] dependin on how the value is read, from a post or URL same goes for $bf_record Cheers
  15. try using $_POST instead of $_REQUEST i've attached an interesting email/form script maybe it will be of some kind of help. Let me know if you have any questions about it Cheers. [attachment deleted by admin]
  16. You might want to use some script to empty the field value (name field) once the user clicks to type in his/her nickname JS <!-- Form Input Default Value --> <script type="text/javascript"> function clickclear(thisfield, defaulttext) { if (thisfield.value == defaulttext) { thisfield.value = ""; } } function clickrecall(thisfield, defaulttext) { if (thisfield.value == “”) { thisfield.value = defaulttext; } } </script> example: <input type="text" name="myfield" value="default text" onclick=”clickclear(this, ‘default text’)” onblur=”clickrecall(this,’default text’)” />
  17. From what i can see... in browse_prints.php you send via URL the 'aid' var <td align=\"left\"><a href=\"view_print.php?aid={$row['print_id']}\">{$row['print_name']}</a></td> but in view_print.php you use $_GET['pid'] Should't this be $_GET['aid'] ? Try puting $pid = $_GET['aid'] in your second file
  18. Here's what o would do: <?PHP $year = $_GET[year]; $month = $_GET[month]; ?> <a href="records.php?year=2008<?PHP if ($month) echo "&month=$month" ?> ">2008</a> | <a href="records.php?year=2009<?PHP if ($month) echo "&month=$month" ?> ">2009</a> | <a href="records.php?year=2010<?PHP if ($month) echo "&month=$month" ?> ">2010</a> | <a href="records.php?<?PHP if ($year) echo "year=$year" ?>&month=january">January</a> | <a href="records.php?<?PHP if ($year) echo "year=$year" ?>&month=february">February</a> | <a href="records.php?<?PHP if ($year) echo "year=$year" ?>&month=march">March</a> | <?PHP if ($year && $month) { mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); $result = mysql_query("SELECT * FROM $table WHERE year='$year' AND month='$month'") or die ("Could not read data because ".mysql_error()); while ($qry = mysql_fetch_array($result)) { echo $qry[record]; } } else { echo "Please select both Year and Month"; } ?> NOTE: You might want to have DB fields in you records table such as 'month' and 'year' to be able to select the ones you need... Let me know if this is of any help. Cheers!
  19. I'm not sure i understand exactly what you want done... this is what i understood: // DB Conn. mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); <?php include('inc/headinc.php'); ?> // Select Something $result = mysql_query("SELECT * FROM $table") or die ("Could not read data because ".mysql_error()); $qry = mysql_fetch_array($result) <title><? echo $qry[title]; ?></title> <?php include('inc/leftinc.php'); ?> <?php include('inc/rightinc.php'); ?> <div class="maincontent"> </div> <?php include('inc/endinc.php'); ?> Let me know if this is relevant to what you need done. Cheers
  20. HOLLY COW, you guys are fast!! it works fine! so simple *doh* :-X Thanks for the help! Happy Coding! [sOLVED]
  21. Hey guys, I'm sure this is a simple thing to do but i just can't figure it out right now ??? My DB looks something like this: ---ID--------- ---Title--------- ---POST--------- ---OWNER--------- 1 Lipsum Title01 Lipsum Post01 Owner01 2 Lipsum Title02 Lipsum Post02 Owner02 3 Lipsum Title03 Lipsum Post03 Owner03 4 Lipsum Title04 Lipsum Post04 Owner01 The thing i need to do is echo the top 10 owners from this table. To be more precise, i need to count the number of entries for each 'owner' and display the top 10 owners that have the most entries associated to their account. So it should look something like this: #1. Owner01 - 2 posts #2. Owner02 - 1 posts ---------------------- #x. UserXXX - X posts I'd really apreciate some help on this Thanks in advance!
×
×
  • 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.