d_barszczak
Members-
Posts
188 -
Joined
-
Last visited
Everything posted by d_barszczak
-
Dont know how to call this But need help in it .
d_barszczak replied to Monshery's topic in PHP Coding Help
Hi, This script would not work as the GTP variable is not declared at any point. You would need to change your action to something like submit.php then in this file you can decide where you want your browser to be redirected to. Something along the following lines: [code] // submit.php [\code] -
[!--quoteo(post=388009:date=Jun 26 2006, 11:28 AM:name=Jus)--][div class=\'quotetop\']QUOTE(Jus @ Jun 26 2006, 11:28 AM) [snapback]388009[/snapback][/div][div class=\'quotemain\'][!--quotec--] I can't even get a "From" to show up at all. I wish I had that problem. No matter what I do to $From or where I put it, the email shows up as unknown sender with the from field blank. Any ideas? [/quote] Just had a quick look at your code and it would seem your trying to put your From header in from a variable. I would do a quick check to make sure that the variable has data in it at this point. And maybe as a test manually enter the from header just to see if it is your variable or your coding thats causing the problem. Below is a simple code i got off php.net [code] <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' mail($to, $subject, $message, $headers); ?> [/code]
-
[!--quoteo(post=388000:date=Jun 26 2006, 11:12 AM:name=Jus)--][div class=\'quotetop\']QUOTE(Jus @ Jun 26 2006, 11:12 AM) [snapback]388000[/snapback][/div][div class=\'quotemain\'][!--quotec--] Interesting. Were you able to find a way around it? [/quote] Well!! At this time i was not as experianced with php as i am now and all of the submissions were going to one address so either i would allow an exception on the anit-spammer or i would not place a from address in the from header which would automatically give you an address of eg. username@server1.webhost.com which was fine as like i said only one address recieved the email. Now i would prob have used a IMAP command and used that address purly for sending out as this type of email thatway everything would resolve back to the mailserver.
-
I have used the mail() function in a few of my scripts but the main falw is that anti-spammers tend to catch the emails as the webservers ip address tends not to resove back to the From: headers mailserver. ie. www.scripts2go.co.uk 10.0.0.1 - is the webserver. sales@scripts2go.co.uk 10.0.0.2 - is the mailserver. and when the senders ip address is resolved to an IP which is differant from the senders From Header the spammer eats it.
-
On Second thoughts i prob would have used a switch statement instead. [code] switch ($_POST['Age']) { case "1": $Age = "Younger than 13"; break; case "2": $Age = "13 - 18"; break; case "3": $Age = "19 - 25"; break; case "4": $Age = "26 - 35"; break; case "5": $Age = "36 - 50"; break; default: break; } [/code]
-
[!--quoteo(post=387973:date=Jun 26 2006, 09:57 AM:name=PC NErd)--][div class=\'quotetop\']QUOTE(PC NErd @ Jun 26 2006, 09:57 AM) [snapback]387973[/snapback][/div][div class=\'quotemain\'][!--quotec--] if($_POST['Age'] == "1"){$Age = "Younger than 13";} elseif ($_POST[Age] == "3"){$Age = "13 - 18";} else if ($_POST[Age] == "4"){$Age = "19 - 25";} else if ($_POST[Age] == "5"){$Age = "26 - 35";} else if ($_POST[Age] == "6"){$Age = "36 - 50";} else{pass} $mailaddress = "EMAIL EXCLUDED" $Subject = "Form Input Email" $message = "$_POST[First_Name] $_POST[Last_Name]" $message = $message.$newLine $message = $message.$_POST[Email] $message = $message.$newLine $message = $message.$newLine $message = $message.$_POST[Age] $message = $message.$newLine $message = $message.$_POST[reason] $header = " Form Input Email" mail($mailaddress,$subject,$message,$header); ?> [/quote] Think your problem might be that your first statment is a correct elseif and the rest are incorrect else if. The space makes it a different statement.
-
Hi, I would have the delete image link to a script that deletes the record but requires confirmation first. ie: delete.php?id=10 asks for confirmation which then submits to it self. delete.php?id=10&confirm=true would the delete the record. You could use a IF statement to make sure confirmation = true. Either that or you could prob create a JavaScript Yes / No popup.
-
I designed an app for my workplace that showed a thumbnail of an image on the home page and a full size image with a description once it was clicked on and i just inserted the filenames into the database with the relevent information and stored my images in a folder.
-
[!--quoteo(post=387956:date=Jun 26 2006, 08:34 AM:name=miligraf)--][div class=\'quotetop\']QUOTE(miligraf @ Jun 26 2006, 08:34 AM) [snapback]387956[/snapback][/div][div class=\'quotemain\'][!--quotec--] firs of all, whats the best way to protect a folder? only PHP or PHP and MySQL or is there a better way? (ive tried htaccess but it doesnt protect the entire folder, just a file). now, with the problem...ive been trying to make this code to work, its from [a href=\"http://zulumonkey.org/?id=tutorials&page=comment&oid=228\" target=\"_blank\"]http://zulumonkey.org/?id=tutorials&page=comment&oid=228[/a] : i get these warnings: Warning: session_start(): Cannot send session cookie - headers already sent by...Warning: session_start(): Cannot send session cache limiter - headers already sent... also, if you know the URL of the file i want to protect...you can access it. login.php [code]<table width="315" height="199" border="0"> <tr> <td><form name="form1" method="post" action="check.php"> <table width="407" border="0"> <tr> <td width="105">Username:</td> <td width="194"><input name="username" type="text" id="username"></td> </tr> <tr> <td>Password:</td> <td><input name="password" type="text" id="password"></td> </tr> </table> <br> <input type="submit" name="Submit" value="Login"> </form> </td> </tr> </table>[/code] check.php [code]<?php $a_username = ""; // Admin username $a_password = ""; //Admin password if($username == $a_username && $password == $a_password){ session_start(); echo "Congratulations " . $_POST['username'] . "<br>You may now proceed to the <a href="admin.php">admin area</a>!"; } else { echo "Username " . $_POST['username'] . " or password " . $_POST['password'] . " is incorrect, please try again"; } ?>[/code] admin.php [code]<?php if(session_start()){ ?> This is the admin area Add content in this section <?php } elseif(!session_start()){ echo "Not logged in, please log in"; } ?>[/code] thx!!! [/quote] Hi, Your session_start() must be the first thing sent in you php code otherwise you get the error that you stated. This has to appear at the top of every php page wanting to use one of your session vars. [code] <?php session_start(); // Rest of your code. ?> [/code]
-
[!--quoteo(post=385453:date=Jun 19 2006, 12:09 AM:name=Thrice01)--][div class=\'quotetop\']QUOTE(Thrice01 @ Jun 19 2006, 12:09 AM) [snapback]385453[/snapback][/div][div class=\'quotemain\'][!--quotec--] new here, hoping to use this forum more often though. ok so my website worked on localhost fine, v4.something. I transferred to my server which is running v5.1.3 and i noticed something. I have a bunch of if statements that determine what table gets displayed. Something like.. <?php if ($pagename == 'login.php') { ?> <table border="0" align="center"> <tr> <td>This gets displayer</td> </tr> </table> <? } else { [i]do somethign else[/i] } ?> Ok, that does not work at all. The only way i can get it to work is by echoing the table and placing slashes (\) infront of the quote marks. e.g. <?php if ($pagename == 'login.php') { echo " <table border=\"0\" align=\"center\"> <tr> <td>This gets displayer</td> </tr> </table> "; } else { [i]do somethign else[/i] } ?> Any explaintation why it won't let me code it the first way? im really not keen on echoing all my html data [/quote] You cant use " when you user echo you must replace them with ' . ie. [code] <?php if ($pagename == 'login.php') { echo (" <table border='0' align='center'> <tr> <td>This gets displayer</td> </tr> </table> "); } else { [i]do somethign else[/i] } ?> [/code]
-
[!--quoteo(post=384489:date=Jun 16 2006, 09:08 AM:name=KDragon)--][div class=\'quotetop\']QUOTE(KDragon @ Jun 16 2006, 09:08 AM) [snapback]384489[/snapback][/div][div class=\'quotemain\'][!--quotec--] I don't really need it. I just wondered if it could be done. I don't need it to check every moment. Just every time I have to write something to a particular database. [/quote] You can use a query like this i think!! CREATE DATABASE MyNewDatabase [IF NOT EXISTS];
-
[!--quoteo(post=384474:date=Jun 16 2006, 08:32 AM:name=Midnite)--][div class=\'quotetop\']QUOTE(Midnite @ Jun 16 2006, 08:32 AM) [snapback]384474[/snapback][/div][div class=\'quotemain\'][!--quotec--] If there a way to chage the time from one timezone to another ??? could someone please post a script that would do this ... I can get a variable for the time but do not understand how to convert it to eastern time ... ??? I think my server is in Europe so the time is WAY OFF !!! any help PLEASE Thanks; Midnite [/quote] Just had a look on php.net and it seems it was only introduced in php 5 which is fine if this is what your running. date_default_timezone_set ( string timezone_identifier ) A list of TimeZones can be found here: [a href=\"http://uk2.php.net/manual/en/timezones.php\" target=\"_blank\"]http://uk2.php.net/manual/en/timezones.php[/a]
-
mysql question, collecting data from multiple rows
d_barszczak replied to thehigherentity's topic in PHP Coding Help
[!--quoteo(post=384359:date=Jun 15 2006, 09:42 PM:name=thehigherentity)--][div class=\'quotetop\']QUOTE(thehigherentity @ Jun 15 2006, 09:42 PM) [snapback]384359[/snapback][/div][div class=\'quotemain\'][!--quotec--] is there a way to retreave all the data from a set user in a table? Im querying select username from users_table were userid = '$userid' then im using mysql_fetch_row($results); I believe this only brings the one row though and i want to bring more then one row back from the db I have managed to do it, I called all the data from the table then looped through taking out what i wanted but I just wonderd if there was a better way? I have only been playing with mysql for a couple of days and realy have no idea what can and cant be done [/quote] This code will cycle through all of the results returned from the query then you do whatever you like with the results for example put them in an array or draw a HTML table. [code] while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) { extract($row); // Insert your code here } [/code] -
PHP file dosen't show anything inbrowser
d_barszczak replied to bxmachines77's topic in PHP Coding Help
Its hard to say just from looking at this script but as you say you have little knowledge ill go over the most common faults. [list][*] Have you named your file with the .php extention?[*] Why have you got <?php?> at the top of the page?[*] Where did you declare the variables $domain, $folder?[/list] -
[!--quoteo(post=384044:date=Jun 15 2006, 01:38 AM:name=lpxxfaintxx)--][div class=\'quotetop\']QUOTE(lpxxfaintxx @ Jun 15 2006, 01:38 AM) [snapback]384044[/snapback][/div][div class=\'quotemain\'][!--quotec--] Yes, I've been thinking about AJAX. I am far from being good at AJAX... anyone care to help me out? [/quote] I have dont an expanderble menu before using JavaScript and i have a script you can download on my website. Ill try help you with it if you think it could be of any use. If not have a look at the code see if you can create something from it or get any ideas.
-
[!--quoteo(post=384171:date=Jun 15 2006, 02:45 PM:name=black jack)--][div class=\'quotetop\']QUOTE(black jack @ Jun 15 2006, 02:45 PM) [snapback]384171[/snapback][/div][div class=\'quotemain\'][!--quotec--] Can you share the free scripts with me or I am not opposed to paying for something that works. [/quote] There are plenty of tutorials out there anr scripts to help you on your way but for a begginer the best resourse out there for me was PHP & MySQL for Dummies. Get's you off to a good start then the php.net website don't seem so daunting.
-
Are you trying to design this or wanting someone else to.
-
avoid having your email flagged as spam using mail()
d_barszczak replied to aberns's topic in PHP Coding Help
[!--quoteo(post=384010:date=Jun 14 2006, 11:49 PM:name=aberns)--][div class=\'quotetop\']QUOTE(aberns @ Jun 14 2006, 11:49 PM) [snapback]384010[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello, I am using the PHP mail() function for a legitimate purpose (when people apply to our college we send them confirmation emails, etc) and was wondering how to keep the emails that we generate from being flagged as spam by other mail servers. I know it has to do with how you set your headers, but I don't know any specifics, other than this suggestion on php.net Does anyone have any suggestions? Thanks, Audrey [/quote] Hi, We have a spamer at my work place and it uses some of the methods below. One on the tricky one is when the computer recieves the email it will lookup the senders address and then lookup the from domain name. eg Computer recieves email from email server mail.scripts2go.co.uk from address sales@scripts2go.co.uk so firstly it matches the 2 domain names and gets a match. Then it looks up the ip address from both which in this case would be the same and wouild allow the email. Now computer recieves email from webservers mail command again from sales@scripts2go.co.uk but this time from www.scripts2go.co.uk and again it checks the domain names and gets a match. BUT when it looks up the ip address it gets the webservers IP and the Mailservers IP which do not match and will class it as SPAM. Another thing it does is check the incomming emails for strings like "Autorespond" "Do Not Reply" "Click to unsubscribe" also classing it all as SPAM. -
[!--quoteo(post=383815:date=Jun 14 2006, 03:27 PM:name=dharm11)--][div class=\'quotetop\']QUOTE(dharm11 @ Jun 14 2006, 03:27 PM) [snapback]383815[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks for your help everyone.. autoincrementing is an option I considered but wouldn’t it be less efficient as I wouldn’t be able to replace expired members? By using a checked random number it should save disk space and ID numbers. [/quote] I did a Call Logging script once and i had the same problem as i had to reserve a job number before i submitted the job which ment i had loads of job ids that had no job attached. I just created a script to clear all these out which run once a night but like you say the i could have a job with id230 and only have 12 jobs. Could have done something similar to what you have done but that would mean that anyone looking through the past jobs may find job id 20 dated 2006 and job id 1 dated 2001 which is a confused mess waiting to happen. It just depens what your wanting to attach to your id's.
-
[code] function GenCode() { $num = rand(0, 9); for ($i = 1; $i <= 6; $i++) { $actnum = $actnum . $num; return $actnum; } //make a loop so we can check the database if ID has already been taken. if it has we will genarate another ID. function ChkCode() { $actnum = GenCode(); $query = "Select * from ".$DBprefix."client_info where id='$actnum'"; $result = mysql_query($query); if (mysql_num_rows($result) <> 0) { return $actnum; } else { // The number already exists in the database try again. ChkCode(); } $newCode = ChkCode; // This will return the new code already checked. [/code] You could also mod the script to add the new code into your database.
-
Passing variables to more than one php page
d_barszczak replied to nikhilthecool's topic in PHP Coding Help
[!--quoteo(post=383712:date=Jun 14 2006, 12:13 PM:name=nikhilthecool)--][div class=\'quotetop\']QUOTE(nikhilthecool @ Jun 14 2006, 12:13 PM) [snapback]383712[/snapback][/div][div class=\'quotemain\'][!--quotec--] somebody please... atleast give me some alternate solution...plsss... [/quote] Once your users have logged in you can store the variables in a cookie or using php sessions. Once you do this all your other php pages can that access these variables. Sessions are better as they run from the server side but webhosts sometimes dont allow them and cookies can be stopped by a user that turns off cookies. -
[!--quoteo(post=383161:date=Jun 13 2006, 10:08 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 13 2006, 10:08 AM) [snapback]383161[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] foreach ($unallowed as $badword) { preg_replace ("/$badword/", "", $text); } [/code] [/quote] Thankyou i have searched for ages to find somthing to do that but i hate using forums when i have the manual sat on my desktop. Cheers joquius. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
-
I am currently designing a Flash PHP MYSQL Chatroom which will allow users to have a chatroom on their website but hosted from mine. The early beta version is availerble on my website for viewing. I would like to add a content filter option to the client that stops users from submitting certain words so i need a way of removing or detecting certain words from a variable. Once i do this i will be able to cycle through an array of words which are stored in a mysql database. All this is done but just can't seem to find the command to find the words withing the variable.
-
It may be your installation that is set up slightly wrong but it could be either mysql, apache or php so to eliminate php have you tried a simple echo "Hello World"; script. Do your html files display ok. Or is it just when you attempt to use mysql.
-
*solved* variable comparison/logical operator problem
d_barszczak replied to Switch0r's topic in PHP Coding Help
This should grab the posted variable and place it in a local variable. to make sure the information has been passed you can delete the comment tags and the variable will be printed to the screen. [code] // setup $var1 = $_POST['var1']; // echo "$var1"; $count = 0; if($var1 == 1){$count++;} if($var1 == 2){$count++;} if($var1 == 3){$count++;} if($var1 == 4){$count++;} if($var1 == 5){$count++;} if($var1 == 6){$count++;} if($var1 == 7){$count++;} if($var1 == 8){$count++;} if($var1 == 9){$count++;} // check if($count == 0){Give error} [/code]