Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. Looks like you used both loop options in your code. If you using the checkbox systeme use only that one <?php if ($_POST[user]){ foreach ($_POST[user] as $key => $value){ // [..] code that adds the message to the database $content = $_POST['content']; $from = $_POST['from1']; $subject = $_POST['title']; $query ="INSERT INTO messages (title, content, recipient, from1) VALUES ('$subject', '$content', '$value','$from')"; mysql_query($query) or die('Error, query failed'); } } ?>
  2. I think you forgot to change the $_POST vars in order to get it to work i used $_POST[to] but i think your using $_POST['recipient'] and i am using $_POST[user] but i think your using $_POST['from1']
  3. I think that it's a good habit to try to make as less queryes as possible because it does use server ressources ans slows down the website opening ... But ne thing you really have to avoid at all cost is having to close a MySQL connexion to open an other one to then come back to the first one. Playing like that from one DB to and Other is really the worst thing ever for a server.
  4. Ah yeah missed that part lol Line 4, 5, 6, 12, 16 used () inseatd of [] for the $_POST <?php include('connection.php'); $test1=$_POST['firstname']; $test2=$_POST['lastname']; $test3=$_POST['username']; if (!eregi("([^A-Za-z0-9])",$test1)){ if (!eregi("([^A-Za-z0-9])",$test2)){ if (!eregi("([^A-Za-z0-9])",$test3)){ $query="SELECT * FROM vendors WHERE username = '".$_POST['username']."'"; $result=mysql_query($query); $num=mysql_num_rows($result); if ($num == 0) { $query1="SELECT * FROM vendors WHERE email = '".$_POST['email']."'"; $result1=mysql_query($query2); $num1=mysql_num_rows($result1); if ($num1 == 0) { if (($_POST['password']==$_POST['password1'])&&($_POST['email']==$_POST['email1'])) { $name=strip_tags($_POST['username']); $first=strip_tags($_POST['firstname']); $last=strip_tags($_POST['lastname']); $pass=strip_tags($_POST['password']); $country=strip_tags($_POST['country']); $address=strip_tags($_POST['address']); $email=strip_tags($_POST['email']); $city=strip_tags($_POST['city']); $zip=strip_tags($_POST['zipcode']); $state=strip_tags($_POST['state']); $phone=strip_tags($_POST['phonenumber']); $aql="INSERT INTO vendors SET username='$name', firstname='$first', lastname='$last', email='$email', Country='$country', zipcode='$zip', password='$pass', city='$city', state='$state', phonenumber='$phone', address='$address'"; $result=mysql_query($sql); if ($result){ header("location:http://www.digitaldesignersmall.com/ffx.html"); } else { header("location:http://www.digitaldesignersmall.com/fff.html"); } } else{ header("location:http://www.digitaldesingersmall.com/afx.html"); } } else { header("location:http://www.digitaldesingersmall.com/afx.html"); } } else{ header("location:http://www.digitaldesignersmall.com/cxs.html"); } } else{ header("location:http://www.digitaldesignersmall.com/cxs.html"); } } else{ header("location:http://www.digitaldesignersmall.com/cxs.html"); } } ?>
  5. Umm this is kind of hard to explain ... but starting from scratch you need a member systeme id, username, password, email Once you got the users to register you create a form with a WYSIWYG for the message body. (Preferably on that works with BBCode) You can select the users by seperating the names by a coma. On the sending process you can explode them in order to add your message to the message table. The message table would look like this: id, from, to, subject, message, date, status The loop to send to each would look like this $members = explode(',', str_replace (' ', '', $_POST[to])); // Delete the white spaces and explode the , character foreach ($members as $member){ // [...] Code to insert the message in the message table } I don't think a check box is the best way of doing this but if thats really what you want then you would need to loop the members like this $select = mysql_query("SELECT * FROM member") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { echo '<input type="checkbox" name="user[]" value="'.$member[username].'">'.$member[username].'<br>'; } Then once the data is submited you loop the POST array if ($_POST[user]){ foreach ($_POST[user] as $key => $value){ // [..] code that adds the message to the database } } Then you need a page that shows the messages you got $select = mysql_query("SELECT * FROM message WHERE user_id='$_SESSION[id]' order by id desc") or die(mysql_error()); while ($messages = mysql_fetch_array($select)) { // Print out the message subject } Once opened i would segest you to use the status field as an indicator if the message is new or not and if the user already replyed 0 is new 1 is viewed 2 is replyed Anyway, i hope thats gona help your in seting up your message systeme. It's really not as complicated as it seems.
  6. It would look like this <?php // If the voting form has been submited if ($_POST){ $today = date("d-m-Y"); // Todays date //check if user already voted $count = mysql_num_rows (mysql_query("SELECT * FROM vote WHERE iser_id='$_SESSION[id]' and date = '$today'")); if ($count=="0"){ // INSERT $insert = mysql_query("INSERT INTO vote (id, date, user_id, voted) VALUES ('', '$date', '$_SESSION[id]', '1')"); }else{ // UPDATE $insert = mysql_query("UPDATE vote SET voted=voted+1 WHERE date='$date' and user_id='$_SESSION[id]'"); } } ?>
  7. wow you made so many errors ... Line 8, 10, 11 the double quote was one character off the line ... Line 12, 16, 18, 33, 34 fogot the ; Line 36, 39, 44, 49 forgot to put the data inside a " and also forgot the ; Line 43 you put a ( instead of a { Line 54, 61, 66 forgot the ; Line 68 forgot a } I think you need some sleep lol <?php include('connection.php'); $test1=$_POST('firstname'); $test2=$_POST('lastname'); $test3=$_POST('username'); if (!eregi("([^A-Za-z0-9])",$test1)){ if (!eregi("([^A-Za-z0-9])",$test2)){ if (!eregi("([^A-Za-z0-9])",$test3)){ $query="SELECT * FROM vendors WHERE username = '$_POST(username)'"; $result=mysql_query($query); $num=mysql_num_rows($result); if ($num == 0) { $query1="SELECT * FROM vendors WHERE email = '$_POST(email)'"; $result1=mysql_query($query2); $num1=mysql_num_rows($result1); if ($num1 == 0) { if (($_POST['password']==$_POST['password1'])&&($_POST['email']==$_POST['email1'])) { $name=strip_tags($_POST['username']); $first=strip_tags($_POST['firstname']); $last=strip_tags($_POST['lastname']); $pass=strip_tags($_POST['password']); $country=strip_tags($_POST['country']); $address=strip_tags($_POST['address']); $email=strip_tags($_POST['email']); $city=strip_tags($_POST['city']); $zip=strip_tags($_POST['zipcode']); $state=strip_tags($_POST['state']); $phone=strip_tags($_POST['phonenumber']); $aql="INSERT INTO vendors SET username='$name', firstname='$first', lastname='$last', email='$email', Country='$country', zipcode='$zip', password='$pass', city='$city', state='$state', phonenumber='$phone', address='$address'"; $result=mysql_query($sql); if ($result){ header("location:http://www.digitaldesignersmall.com/ffx.html"); } else { header("location:http://www.digitaldesignersmall.com/fff.html"); } } else{ header("location:http://www.digitaldesingersmall.com/afx.html"); } } else { header("location:http://www.digitaldesingersmall.com/afx.html"); } } else{ header("location:http://www.digitaldesignersmall.com/cxs.html"); } } else{ header("location:http://www.digitaldesignersmall.com/cxs.html"); } } else{ header("location:http://www.digitaldesignersmall.com/cxs.html"); } } ?>
  8. For most web purposes, you can usually design the basic background of your image using a normal image editor like Photoshop and only add any additional text or graphical elements that need to be dynamically drawn using PHP. This allows you to speed up your scripts and reduce the resource consumption on your web server. It also lets you create your picture using professional picture designing tools. imagecreatefromgif ( $filename ); // Background is a gif imagecreatefromjpeg ( $filename ); // Background is a jpg imagecreatefrompng ( $filename ); // Background is a png
  9. lol leave ini_set ("display_errors", "1"); error_reporting(E_ALL); and leave $result = mysql_query($sql) or die(mysql_error()); then check if theres an error
  10. How abbout doing what i said and use $result = mysql_query($sql) or die(mysql_error()); Everywhere your doing a mysql query ... Your problem is DB related ... if you don't output the errors your not gona see the warnings if there is any
  11. You got an SQL error but your not displaying them ... try $sql="select calID, calDate, calName, calDesc from calTbl where calDate = '" . $month . "/" . $day . "/" . $year . "'"; And to see the sql errors in the future use: $result = mysql_query($sql) or die(mysql_error());
  12. try using foreach(fgets($fp, 128) as $data) if you get the same result then the problem must come from the code calling your ircConnect()
  13. You can also do this using htaccess To do it you just use normal name var in your code like this: if ($_GET[name]){ echo "blablabla"; } but add a file name in the www folder that is named .htaccess and put it in the folowing code Options +FollowSymlinks RewriteEngine on RewriteRule ^.*my_name_id_([a-z]+)$ index.php?name=$1 [L] The htaccess is gona make the following URL format work exacly like if there was a $name directory <a href="www.storefront.com/my_name_id_$name"> You may change the "my_name_id_" part as long as you change that in the .htaccess lol I just wanted to show you how to add a prefix if you need one
  14. It's very easy actualy <input type="text" name="form[]" size="20"><br> <input type="text" name="form[]" size="20"><br> <input type="text" name="form[]" size="20"><br> <input type="text" name="form[]" size="20"><br> <input type="text" name="form[]" size="20"><br> you just add to your field name [] and repeat it the number of times you need Then to loop them you just do it like this: <?php foreach ($_POST['form'] as $key=>$value){ echo $value."<br>"; } // You can also print out a specific value by doing (knowing the array starts at 0) echo $_POST['form'][2]; // will print out the value of the form field number 3 ?>
  15. Yeah but if theres 2 numbers in the string he would end up with both together cat_sub_6_id_1 will return 61 instead of only 1 But if thats not gona happend go for that code hehe much smaller then the one i did
  16. You can also explose de _ character and check each chunk and keep the last numeric number <?php if (isset($number)){unset($number);} // Delete the var if it has been previously created $number_array = explode('_', $field_name); // Explode all the _ foreach($number_array as $value){ // Loop each values if (is_numeric($value)){ // Check if the value is numeric $number = $value; // Keep this value and overight if theres an other one in the string so we keep only the last one } } echo $number; ?> This way you will get the full number what ever the number of characters involved in your string as long as you use the same name field exemple cat_sub_id_1 will return 1 cat_sub_6_id_1 will return 1 cat_sub_id_1_pp will return 1
  17. <?php $img = imagecreatetruecolor($x, $y); $bgColor = imagecolorallocate($img, 255,255,255); imagefilledrectangle($img, 0, 0, $x-1, $y-1, $bgColor); ?> Thats how i do it
  18. You should post your question at the cpanel.net board ... they have fast support there and should be more qualified to explain ya everything you need to know on cpanel specific question rather then us that are pro in php specific question. good luck
  19. Yes but we need more of your code... Post the part where your creating the array and trying to use it
  20. LOL ... How are we supose to tell you what your doing wrong if you don't show the code lol <?php echo $var['domain']; // asdfasdf.com ?>
  21. you can also check the hole post array with this echo "<pre>"; print_r($_POST); echo "</pre>";
  22. if (!isset($_POST['id'])){ echo 'Invalid user id.'; }else{ partner_request($_POST['id']); echo "A request has been sent to the user"; }
  23. You should use file_exists() instead Why do you need to use while? Theres only one to check. if (file_exists($filename)){ $url = "domain.com" . ".mp3"; echo system('wget '.escapeshellcmd($url)); echo system('sleep 30'); } If you have more then one then you can do something like <?php // Build an array of your files $filename[] = "file1.mp3"; $filename[] = "file2.mp3"; $filename[] = "file3.mp3"; $filename[] = "file4.mp3"; $filename[] = "file5.mp3"; foreach($filename as $file => $value){ if (file_exists($value)){ //[..] continue with your code using $value for the file name } } ?>
  24. Did not read all the code but first thing i noticed is that session_start(); needs to go befor the $userback = $_SESSION['user']; line
  25. <?php function getReference($size = 4) { $size = $size > 36 ? 30 : $size; $pool = array_merge(range(0, 9), range('a', 'z')); $rand_keys = array_rand($pool, $size); $random = ''; foreach ($rand_keys as $key) { $random .= $pool[$key]; } return $random ; } echo getReference(4).'-'.getReference(4); ?> Something like this?
×
×
  • 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.