
per1os
New Members-
Posts
3,095 -
Joined
-
Last visited
Everything posted by per1os
-
Hard to diagnose without code. If it is printing records, try setting set_time_limit(900) (sets php timeout limit to 900 seconds). --FrosT
-
Wow first of all it is a bad idea to not declare variable from a form, second of all it is a very bad idea. Try this. <?php if ($_SERVER["REQUEST_METHOD"]=="POST"){ mail($_POST['to'], $_POST['tit'], $_POST['msg'],"From:" . $_POST['you']); } ?> </center> </body> </html> Never refer to POST or GET variable just by their name, always define them or bad stuff can happen. That is why register_globals is turned off by default for security reasons. --FrosT
-
It is never a really good idea to use numbers in variable or column names to be honest. I would change the april15pts to aprilfiftpts or something like that, or do aprilpts15. Yes it works alot of times, but sometimes that is the cause of the errors is the incompatibility. I am just quoting this from memory, I could be wrong but yea. Try to change the column name in the DB to something different and see if it works. --FrosT
-
try this setcookie("mem", "yes", time()+7200,"/shop","/"); OR setcookie("mem", "yes", time()+7200,"/shop","allpet.co.uk"); If that does not work, read up on cookies here: http://us3.php.net/manual/en/function.setcookie.php It explains about the domains and paths etc. If this is running on Localhost, you need to set the domain part to false, remember that. --FrosT
-
I do not know why you don't just call the array by the column name, but this should help you on your way. $results = mysql_query("SELECT * FROM $cat WHERE item_id='$item_id'"); $i=0; while ($row = mysql_fetch_array($results)) { $num = count($row); while ($i < $num) { $name = mysql_field_name($results, $i); $data = $row[$name]; echo $name . " - " . $data; echo "<br>"; $i++; } } ?> --FrosT
-
Let's go over some basics here, even if you pull data from a MySQL statement you still have to loop through it to get the extra data. I do not see any looping here, unless your hidden code for select_data does that for you. Either way when you do the return portion you are only returning 1 ID, why is that if you want the top 5? You should be returning 5 ID's, am I not right? So the code itself is flawed to begin with. On that note, if you only want the top 5, why limit the SQL to 12? It should be 5 no? Anyhow here is a start of looping and storing the gender_id's into an array. I think you can go from there. function get_hot_person($gender) { global $db; $hotm_sql="select s1.scm_mem_id,s1.scm_gender,round((s2.sum_/s2.count_),2) score from sc_member s1,sc_rate_score_avg s2,sc_member_images s3 where s1.scm_gender='$gender'and s1.scm_mem_id=s2.scm_mem_id and s3.sci_rating=1 and s3.scm_mem_id= s1.scm_mem_id group by s1.scm_mem_id order by score DESC LIMIT 0,5"; $qu = mysql_query($hotm_sql); while ($row = mysql_fetch_assoc($qu)) { $gender_id[] = $row[0]; } //$rate_res1=$db->select_data($hotm_sql); //$gender_id=$rate_res1[0][0]; return $gender_id; } // should now be an array of id's etc $male_id=get_hot_person('Male'); --FrosT
-
Yep, the Timezone issue is fun. I created my own class, but I have not tested my new class out yet. If you would like a look at it let me know. --FrosT
-
Why not test if your send mail is working, create a new file with simply this: <?php mail('[email protected]', 'Subject Here', 'Message Here'); ?> See if that works, if it does try adding your headers to the mix. Remember to debug something KISS it (KEEP IT SIMPLE STUPID). Once you know the basic portion is working, add more to it slowly and keep testing. --FrosT
-
Yea dude, seriously just use the mysql_real_escape_string(), no use in trying to re-invent the wheel. --FrosT
-
The second way I posted sanitizes it with mysql_real_escape_string(); --FrosT
-
You are wrong. This is why register_globals is highly recommended to be disabled on a server running php. Reason being is that if you take straight data from a GET and put it into a database I can easily inject into your SQL. Per say this codE: url: http://www.yoururl.com/page.php?user='' OR 1 ' (don't quote me on this) <?php $sql = "SELECT * FROM users WHERE user = '".$user."'"; mysql_query($sql); ?> Now the above may also depend on a few server settings, but it is always better safe than sorry. A better approach would be this: url: http://www.yoururl.com/page.php?user='' OR 1 ' (don't quote me on this) <?php $user = mysql_real_escape_string($_GET['user']); // escape any single quotes $sql = "SELECT * FROM users WHERE user = '".$user."'"; mysql_query($sql); ?> That way you know the code going into the database will not attempt to mess anything up. --FrosT
-
The funny thing is, my buddy asked me the same question and I fixed it for phpArcade. Fun stuff, I cannot remember how I fixed it, but I know I sure did, let me look around for that fix. //EDIT: here we go: <?php // End of the index.php file $pagetitle = "Thank Your For Your Submission"; $pagekeywords = $site_keywords; $pagedescription = $site_desc; } else { $_SESSION['index'] = true; // add this line!!!! $includefile = "./includes/main.php"; $pagetitle = "Title Here"; $pagekeywords = $site_keywords; $pagedescription = $site_desc; } } ?> In the overall.html file <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <?php if ($_SESSION['index']) { $display = $pagetitle . " - " . $site_title; }else { $display = $pagetitle; } unset($_SESSION['index']); ?> <title><?=$display;?></title> If you are using the phpArcade this should work just fine. Questions let me know. --FrosT
-
changed: $this->db=new db(); my bad. Forgot about that portion. <?php class db { var $dsn="dsn"; //dsn var $uname=""; var $password=""; var $con=NULL; //db connect // constructor function db() { $this->dsn="dsn"; //dsn -- for PHP 4 as the variable declaration does not work. $this->DbConnect(); } function DbConnect() { $this->con=odbc_connect($this->dsn,$this->uname,$this->password) or die(odbc_errormsg()); return $this->con; } //function to select function Select($tableName,$condition) { $sql="SELECT * from $tableName WHERE 1=1 $condition"; $this->select=odbc_exec($this->con,$sql); return $this->select; } } class GlobalVars { // constructor function GlobalVars() { $this->db=new db(); } function UserDetails($fieldName) { $tableName="Employee"; $condition="and Windowloginname='$loginuser'"; $select=$this->db->Select($tableName,$condition); $value=$this->db->GetData($select,fieldName); return $value; } //get the values from result function Getdata($resourceid,$fieldName) { $result=odbc_result($resourceid,$fieldName); return $result; } } ?>
-
[SOLVED] Is there a way to get { to work in this email?
per1os replied to silentg0d's topic in PHP Coding Help
The reason being is that the { } in quotes like you have it just displays that string. Try this: $message, "{".$Profession."} \nSet Name=$SetName; \nHead Piece=$HeadPiece; \nChest Piece=$ChestPiece; \nArm Piece=$ArmPiece; \nLeg Piece=$LegPiece; \nFeet Piece=$FeetPiece;" ); or $message, "\{".$Profession."} \nSet Name=$SetName; \nHead Piece=$HeadPiece; \nChest Piece=$ChestPiece; \nArm Piece=$ArmPiece; \nLeg Piece=$LegPiece; \nFeet Piece=$FeetPiece;" ); I am not sure if the first bracket needs slashed out or not. --FrosT -
Use the date function http://us2.php.net/manual/en/function.date.php to format it that way: <?php $sixMonths = date('Y-m-d G:i', (time()+60*60*24*60)); // time six months from now $sql = "SELECT * FROM articles WHERE articledate > " . $sixMonths; mysql_query($sql); ?> --FrosT
-
http://www.aeonity.com/files/db.class.phps --FrosT
-
SQL is great, but why not use PHP to get your date manipulation? As such <?php $sixMonths = (time()+60*60*24*60); // time six months from now $sql = "SELECT * FROM articles WHERE articledate > " . $sixMonths; mysql_query($sql); ?> --FrosT
-
Constructors are key here. They are what get called when the class is instantiated. Although this is a poorly designed class here is what it should be. <?php class db { var $dsn="dsn"; //dsn var $uname=""; var $password=""; var $con=NULL; //db connect // constructor function db() { $this->dsn="dsn"; //dsn -- for PHP 4 as the variable declaration does not work. $this->DbConnect(); } function DbConnect() { $this->con=odbc_connect($this->dsn,$this->uname,$this->password) or die(odbc_errormsg()); return $this->con; } //function to select function Select($tableName,$condition) { $sql="SELECT * from $tableName WHERE 1=1 $condition"; $this->select=odbc_exec($this->con,$sql); return $this->select; } } class GlobalVars { // constructor function GlobalVars() { $db=new db(); } function UserDetails($fieldName) { $tableName="Employee"; $condition="and Windowloginname='$loginuser'"; $select=$this->db->Select($tableName,$condition); $value=$this->db->GetData($select,fieldName); return $value; } //get the values from result function Getdata($resourceid,$fieldName) { $result=odbc_result($resourceid,$fieldName); return $result; } } ?> If you would like to take a look at my db class just let me know I will be more than happy to show it off. --FrosT
-
Why are you using $_GET for $your_email??? Maybe this should be inplace of that code <?php if (isset($_GET['mailto'])) { $your_email = $_GET['mailto']; } ?> If the mailto is in the GET data and not the POST data... --FrosT
-
Ah try this: <?php $code=$_POST['code']; $code2 = str_replace('<','<',$code); $code2 = addslashes($code2); ?> <form id="form1" name="form1" method="post" action="convcod.php"> <table width="737" height="566" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="737" align="left" valign="top"> <textarea name="code" cols="120" rows="35" wrap="VIRTUAL"></textarea> </td> </tr> <tr> <td><?php echo "$code2"; ?></td> </tr> <tr align="right"> <td><br /><input type="submit" value="Convert" /></td> </tr> </table> </form> can be viewed here: http://www.aeonity.com/tstJs.php --FrosT
-
Im not rocket scientist but shouldin't it be setup like this? function user_numberonline() { $timestamp = date(YmdGi); $old_timestamp = $timestamp - 5; $query = "SELECT * FROM user_ids WHERE timestamp > '$old_timestamp'"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $count = mysql_num_rows($result); echo "<p>Users online: $count</p>"; } --FrosT
-
http://www.aeonity.com/tstJs.php Worked out great for me? Am I missing something? --FrosT
-
Your going about that the wrong way. You need to change < to be < Try this: <?php $code=$_POST['code']; $code2 = str_replace('<','<',$code); ?> <form id="form1" name="form1" method="post" action="convcod.php"> <table width="737" height="566" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="737" align="left" valign="top"> <textarea name="code" cols="120" rows="35" wrap="VIRTUAL"></textarea> </td> </tr> <tr> <td><?php echo "$code2"; ?></td> </tr> <tr align="right"> <td><br /><input type="submit" value="Convert" /></td> </tr> </table> </form> Hopefully that is what you want. --FrosT
-
try this: echo "Total Donations: $".$data_donations['SUM(donations)'].""; Or this: $result = dbquery("SELECT SUM(donations) Donations FROM fusion_users WHERE donations>0"); $data_donations = dbarray($result); echo "Total Donations: $".$data_donations['Donations'].""; --FrosT
-
<?php $file = file('50states.txt'); // make sure your words are on seperate lines this returns an array $scrambled = file('scrambled.txt'); // same deal as above ...... ?> After that I am not sure what you are asking, do you want to match the scrambled words to the one of the 50 state words? --FrosT