Jump to content

emediastudios

Members
  • Posts

    418
  • Joined

  • Last visited

Everything posted by emediastudios

  1. tried that, didnt work, really needs the "" wrapped around the word lightbox
  2. yeah thats all there. here is all the code. <?PHP $content .= "<td valign=\"bottom\"><br><a href='admin.php?p=temp_models&id=".$info[tempmodelid]."'><strong>Delete this application</strong></a><br>".$info[name]."<br><a href='mailto:".$info[email]."?subject=Jimmys Promotions and Modelling Agency Model Application'>".$info[email]."</a><br><a href=images/applications/".$info[picname]."rel=lightbox><img src='images/applications/".$info[picname]."' alt='".$info[name]."' width='300'/><a/><br><br></td>"; ?>
  3. Hi everyone. A simple one, never the lesss doing my head in <a href=images/applications/".$info[picname]." rel=lightbox> I cant get it to work, in the source code of the site it looks as above, and lightbox dont work. It should look like this in the page source <a href=images/applications/".$info[picname]."rel="lightbox"> but i get errors when i put the "" around lightbox I tried putting slashes there and no luck
  4. Thanks red arrow for your help, your code looks good, wish i new the little thing stopping it from working.
  5. I used the last code but now the form doesnt show? Thanks for all your help guys
  6. I have a email form and want to add the record to my database. I also want to add a image upload, i have added the field but dont know how to get it working. my email form below. <?php error_reporting(E_ALL); session_start(); require_once 'includes/include.php'; switch ($_REQUEST['action']) { case 'scouting': foreach($_POST as $key=>$value){ $$key = $value; } if ((!$name) || (!$email) || (!$comments) || (!$survey)) { $error_msg = 'Fields marked * are required to submit the form'; }elseif (($_SESSION['security_code'] != $security_code) && (!empty($_SESSION['security_code']))){ $error_msg = 'Please fill in the Verification Image field'; } echo "$error_msg","<br><br>"; if ($error_msg == ''){ foreach($_POST as $key=>$value){ $$key = htmlentities(stripslashes($value)); } $companyname = 'Jimmys Promotions and Model Agency'; $companyemail = 'rorryss@estuos.com.au'; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$name." <".$email.">\r\n"; $headers .= "Reply-To: ".$name." <".$email.">\r\n"; $to = "".$companyname."<".$companyemail.">"; $subject = "Model Apllication"; $message = '<style type="text/css"> <!-- .style { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } --> </style> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="style"> <b>Details:</b><br /><br /> <b>Name:</b> '.$name.'<br /> <b>Email:</b> '.$email.'<br /> <b>Ph No:</b> '.$phone.'<br /><br /> <b>Query:</b><br /><br /> '.$comments.'<br /><br /> <b>Survey:</b><br /> '.$survey.' </td> </tr> </table>'; mail($to, $subject, $message, $headers); $images_dir = "images/applications"; echo '<table width="99%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><br />Hi '.$name.',<p />Thanks for your enquiry. One of our friendly staff will be in touch with you shortly.<p />Regards<p />The team @ '.$companyname.'</td> </tr> </table>'; }else{ foreach($_POST as $key=>$value){ $$key = htmlentities(stripslashes($value)); } $counter = 1; $number_of_fields = 1; echo '<form id="form" name="Contact Form" method="post" action="'.$_SERVER['PHP_SELF'].'?action=scouting" enctype="multipart/form-data"> <table width="550" border="0"> <tr> <td width="199" class="contacttext"><span class="star">*</span><span class="col_box_1"> Your name: </span></td> <td width="341"><input name="name" type="text" class="fields" id="name" value="'.$name.'" /></td> </tr> <tr> <td class="contacttext"><span class="star">*</span><span class="col_box_1"> E-mail address: </span></td> <td><input name="email" type="text" class="fields" id="email" value="'.$email.'" /></td> </tr> <tr> <td class="contacttext_1">Phone: </td> <td><input name="phone" type="text" class="fields" id="phone" value="'.$phone.'" /></td> </tr> <tr> <td class="contacttext"><span class="star">*</span> How did you hear about us? </td> <td><select name="survey" class="fields" id="survey"> <option value="">Please select</option> <option '. ($survey=='Magazine' ? 'selected' : '') .' value="Magazine">Magazine</option> <option '. ($survey=='Internet' ? 'selected' : '') .' value="Internet">Internet</option> <option '. ($survey=='Newspaper' ? 'selected' : '') .' value="Newspaper">Newspaper</option> <option '. ($survey=='Billboard' ? 'selected' : '') .' value="Billboard">Billboard</option> <option '. ($survey=='Yellow pages' ? 'selected' : '') .' value="Yellow pages">Yellow pages</option> <option '. ($survey=='Referal' ? 'selected' : '') .' value="Referal">Referal</option> <option '. ($survey=='Mail out' ? 'selected' : '') .' value="Mail out">Mail out</option> <option '. ($survey=='Drive by' ? 'selected' : '') .' value="Drive by">Drive by</option> <option '. ($survey=='Other' ? 'selected' : '') .' value="Other">Other</option> </select></td> </tr> <tr> <td class="contacttext"><span class="star">* </span>Comments:: </td> <td><textarea name="comments" cols="30" rows="6" class="fields" id="comments">'.$comments.'</textarea></td> </tr> <tr> <td class="contacttext"><span class="star">*</span> Recent snapshot: (max 2meg)</td> <td>'; while($counter <= $number_of_fields){ echo ' <input class="fields2" name="imagename[]" type="file"><br />'; $counter++; } echo '</tr> <tr> <td class="contacttext"><span class="star">*</span> Verification Image: </td> <td><input name="security_code" type="text" class="fields" /></td> </tr> <tr> <td> </td> <td><img src="./captcha.php?width=100&height=40&characters=5" border="1" /></td> </tr> <tr> <td><input name="Submit" type="submit" class="font_5" value="submit" /></td> <td> </td> </tr> </table> </form>'; } break; } ?> My database is as follows Database name = jimmy Fields --------------------------------------- tempmodelid name email phone comments photofilename date. Be so stoked if someone could help me out.
  7. hi every one. I am having trouble getting these two scripts to merge into one. They both exist in different files and i have edited them a bit but just cant get it right. This is my email script, it works fine. <?php error_reporting(E_ALL); session_start(); require_once 'includes/include.php'; switch ($_REQUEST['action']) { case 'scouting': foreach($_POST as $key=>$value){ $$key = $value; } if ((!$name) || (!$email) || (!$comments) || (!$survey)) { $error_msg = 'Fields marked * are required to submit the form'; }elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $error_msg = 'Invalid email address'; }elseif (($_SESSION['security_code'] != $security_code) && (!empty($_SESSION['security_code']))){ $error_msg = 'Please fill in the Verification Image field'; } echo "$error_msg","<br><br>"; if ($error_msg == ''){ foreach($_POST as $key=>$value){ $$key = htmlentities(stripslashes($value)); } $companyname = 'Jimmys Promotions and Model Agency'; $companyemail = 'ryetss@emstr.com.au'; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$name." <".$email.">\r\n"; $headers .= "Reply-To: ".$name." <".$email.">\r\n"; $to = "".$companyname."<".$companyemail.">"; $subject = "Model Apllication"; $message = '<style type="text/css"> <!-- .style { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } --> </style> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="style"> <b>Details:</b><br /><br /> <b>Name:</b> '.$name.'<br /> <b>Email:</b> '.$email.'<br /> <b>Ph No:</b> '.$phone.'<br /><br /> <b>Query:</b><br /><br /> '.$comments.'<br /><br /> <b>Survey:</b><br /> '.$survey.' </td> </tr> </table>'; mail($to, $subject, $message, $headers); echo '<table width="99%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><br />Hi '.$name.',<p />Thanks for your enquiry. One of our friendly staff will be in touch with you shortly.<p />Regards<p />The team @ '.$companyname.'</td> </tr> </table>'; }else{ foreach($_POST as $key=>$value){ $$key = htmlentities(stripslashes($value)); } $counter = 1; $number_of_fields = 1; echo '<form id="form" name="Contact Form" method="post" action="'.$_SERVER['PHP_SELF'].'?action=scouting" enctype="multipart/form-data"> <table width="550" border="0"> <tr> <td width="199" class="contacttext"><span class="star">*</span><span class="col_box_1"> Your name: </span></td> <td width="341"><input name="name" type="text" class="fields" id="name" value="'.$name.'" /></td> </tr> <tr> <td class="contacttext"><span class="star">*</span><span class="col_box_1"> E-mail address: </span></td> <td><input name="email" type="text" class="fields" id="email" value="'.$email.'" /></td> </tr> <tr> <td class="contacttext_1">Phone: </td> <td><input name="phone" type="text" class="fields" id="phone" value="'.$phone.'" /></td> </tr> <tr> <td class="contacttext"><span class="star">*</span> How did you hear about us? </td> <td><select name="survey" class="fields" id="survey"> <option value="">Please select</option> <option '. ($survey=='Magazine' ? 'selected' : '') .' value="Magazine">Magazine</option> <option '. ($survey=='Internet' ? 'selected' : '') .' value="Internet">Internet</option> <option '. ($survey=='Newspaper' ? 'selected' : '') .' value="Newspaper">Newspaper</option> <option '. ($survey=='Billboard' ? 'selected' : '') .' value="Billboard">Billboard</option> <option '. ($survey=='Yellow pages' ? 'selected' : '') .' value="Yellow pages">Yellow pages</option> <option '. ($survey=='Referal' ? 'selected' : '') .' value="Referal">Referal</option> <option '. ($survey=='Mail out' ? 'selected' : '') .' value="Mail out">Mail out</option> <option '. ($survey=='Drive by' ? 'selected' : '') .' value="Drive by">Drive by</option> <option '. ($survey=='Other' ? 'selected' : '') .' value="Other">Other</option> </select></td> </tr> <tr> <td class="contacttext"><span class="star">* </span>Comments:: </td> <td><textarea name="comments" cols="30" rows="6" class="fields" id="comments">'.$comments.'</textarea></td> </tr> <tr> <td class="contacttext"><span class="star">*</span> Recent snapshot: (max 2meg)</td> <td>'; while($counter <= $number_of_fields){ echo ' <input class="fields2" name="imagename[]" type="file"><br />'; $counter++; } echo '</tr> <tr> <td class="contacttext"><span class="star">*</span> Verification Image: </td> <td><input name="security_code" type="text" class="fields" /></td> </tr> <tr> <td> </td> <td><img src="./captcha.php?width=100&height=40&characters=5" border="1" /></td> </tr> <tr> <td><input name="Submit" type="submit" class="font_5" value="submit" /></td> <td> </td> </tr> </table> </form>'; } break; } ?> and i have edited a old script below to match the above database at stuff but i cant get them to work together. <?php // Store folder for images $images_dir = "images/applications"; // Insert the record making photofilname 0 mysql_query("INSERT INTO tempmodels (name, email, phone, comments, photofilename, dateadded) VALUES('$name', '$email','$phone','$comments,'$photofilename, '0', NOW())"); $tempmodelid = mysql_insert_id(); // Counter for multiple fileupload $counter = 0; // Limit file types allowed to be updated $known_photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg'); // Convert posted photofilename $photofilename = $_FILES['photofilename']; while($counter <= count($_FILES['photofilename']['tmp_name'])) { if($photofilename['size'][$counter] > 0) { if(!array_key_exists($photofilename['type'][$counter], $known_photo_types)) { echo 'File '.($counter+1).' is not a accepted file type!<br />'; }else{ // Rename the photo to the record id $filetype = $photofilename['type'][$counter]; $extention = $known_photo_types[$filetype]; $filename = $tempmodelid.".".$extention; // Update filename in the database $sql = mysql_query("UPDATE tempmodels SET photofilename='$filename' WHERE tempmodelid = $tempmodelid"); // Copy the file to the image store folder move_uploaded_file($photofilename['tmp_name'][$counter], $images_dir."/".$filename); } } $counter++; } ?>
  8. If i have this at the top of my login.php session_start(); $_SESSION = $password; Apache crashes what about this code in the file if($count==1){ // Register $username, $password and redirect to file session_register("username"); session_register("password"); session_register("admin_id"); header("Location: admin.php");
  9. I dont know what im doing wrong, i used your script but now it just freezes when i login. This is what i have. Login page. <?php require_once('include/include.php'); session_start(); #Form has been submitted? if((isset($_POST['login'])) AND ($_POST['login'] == 'Login')){ ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password="5050888202"; // Mysql password $db_name="jimmy"; // Database name $tbl_name="admin"; // Table name #Check for blanks and clean data $errors_login = array(); #Initiate error variable if(empty($_POST['username'])) $errors_login[] = 'You must enter a username.'; else $clean['username'] = htmlspecialchars($_POST['username']); if(empty($_POST['password'])) $errors_login[] = 'You must enter a password.'; else $clean['password'] = htmlspecialchars($_POST['password']); //verify password... $get_pass = mysql_query("SELECT * FROM `admin` WHERE password = '".$_POST['password']."'"); $q = ($get_pass); if(!$q) { $errors_login[] = 'Wrong password.'; } //verify user... $get_user = mysql_query("SELECT * FROM `admin` WHERE username = '".$_POST['username']."' "); $q = ($get_user); if(!$q) { $errors_login[] = 'Wrong username.'; } //check that username is only letters or numbers if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['username'])){ $errors_login[]= "Your username must be <i><b>ONLY</b></i> letters or numbers."; } //check that password is only letters or numbers if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['password'])){ $errors_login[]= "Your password must be <i><b>ONLY</b></i> letters or numbers."; } // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $username and $password $username=$_POST['username']; $password=$_POST['password']; // To protect MySQL injection (more detail about MySQL injection) $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT admin_id FROM $tbl_name WHERE username='$username' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ // Register $username, $password and redirect to file session_register("username"); session_register("password"); session_register("admin_id"); header("Location: admin.php"); } else { ob_end_flush(); } } ?> Admin Page. <?php include_once('include/include.php'); if(isset($_SESSION['admin_id'])) // YOU NEED THE SESSION IN ORDER TO PROCEED. { if($_GET[p] == ""){ $content .= "<a href='admin.php?p=upload_image'>Upload Photos</a><br>"; $content .= "<a href='logout.php?p=logout'>Logout</a><br>"; } else { if(file_exists($_GET[p].'.php')) { include($_GET[p].'.php'); } } } else { $content .= "You Must Be Logged In To Do That."; include('admin_layout.php'); } ?> Thanks for all your help
  10. My code is now this. <?php include_once('include/include.php'); if(!session_is_registered(admin_id)){ if($_GET[p] == ""){ $content .= "<a href='admin.php?p=upload_image'>Upload Photos</a><br>"; $content .= "<a href='logout.php?p=logout'>Logout</a><br>"; } else{ if(file_exists($_GET[p].'.php')) include($_GET[p].'.php'); } } else if(session_is_registered(admin_id)){ $content .= "You must be logged in to do that"; } include('admin_layout.php'); ?> But i can still access the file without logging in first after logging out using the above logout script. My login script is this. #Form has been submitted? if((isset($_POST['login'])) AND ($_POST['login'] == 'Login')){ ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password="*********"; // Mysql password $db_name="jimmy"; // Database name $tbl_name="admin"; // Table name #Check for blanks and clean data $errors_login = array(); #Initiate error variable if(empty($_POST['username'])) $errors_login[] = 'You must enter a username.'; else $clean['username'] = htmlspecialchars($_POST['username']); if(empty($_POST['password'])) $errors_login[] = 'You must enter a password.'; else $clean['password'] = htmlspecialchars($_POST['password']); //verify password... $get_pass = mysql_query("SELECT * FROM `admin` WHERE password = '".$_POST['password']."'"); $q = ($get_pass); if(!$q) { $errors_login[] = 'Wrong password.'; } //verify user... $get_user = mysql_query("SELECT * FROM `admin` WHERE username = '".$_POST['username']."' "); $q = ($get_user); if(!$q) { $errors_login[] = 'Wrong username.'; } //check that username is only letters or numbers if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['username'])){ $errors_login[]= "Your username must be <i><b>ONLY</b></i> letters or numbers."; } //check that password is only letters or numbers if (! preg_match('/^[a-zA-Z0-9]+$/i', $_POST['password'])){ $errors_login[]= "Your password must be <i><b>ONLY</b></i> letters or numbers."; } // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $username and $password $username=$_POST['username']; $password=$_POST['password']; // To protect MySQL injection (more detail about MySQL injection) $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT admin_id FROM $tbl_name WHERE username='$username' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ // Register $username, $password and redirect to file "templates.php" session_register("username"); session_register("password"); session_register("admin_id"); header("Location: admin.php"); } else { ob_end_flush(); } } ?>
  11. I added a logout link <? session_start(); session_destroy(); header ("Location: login.php"); ?> When i run that file shouldnt the session be destroyed?, and be unable to open the admid file? I can still access the admin without logging in
  12. I think it maybe working, i just need to make a logout file to destroy the session. Have a better idea then. I close all the windows, but when i access the file again im straight in. Im still a newbe.
  13. I wanted to have my script amended so that if session admin_id wasnt regitered it would direct them to the login.php file. Just a small "if" statement. <?php include_once('include/include.php'); if(!session_is_registered(admin_id)){ if($_GET[p] == ""){ $content .= "<a href='admin.php?p=upload_image'>Upload Photos</a><br>"; } else{ if(file_exists($_GET[p].'.php')) include($_GET[p].'.php'); } } else $content .= "You Must Be Logged In To Do That."; include('admin_layout.php'); ?>
  14. I missed the quote in the cut and paste, buts it in my file, the code didnt work.my code just showed <?php echo $history; ?> in the text box, the code you supplied me with displays and empty text box
  15. Hey everyone, still a newbe, but should of worked this out, I got this code on top of my file <?php include_once('includes/include.php'); $query = "SELECT * FROM history where id =1"; $result = mysql_query($query) or die(mysql_error()); while($news=mysql_fetch_array($result)){ $history .= "$news[history]"; } ?> and i want to add the varible to show in the text box so i can see all the text, make my changes then hit update. I tried many versions of the below code but it dont work. <?php if($secret == "89"){ $content .=' <form id="news" form action="history_edit.php" method="post"> <table width="500" border="0"> <tr> <td colspan="2" class="orangelink"><strong>Update History</strong></td> </tr> <tr> <td width="108">Text</td> <td width="182"><label> <textarea name="history" cols="60" rows="12" class="fields" id="history"><?php echo"$history"; ?></textarea> </label></td> </tr> <tr> <td colspan="2"><label> <input name="Submit" type="submit" class="fields" id="Submit" value="Submit" /> </label></td> </tr> </table> </form> '; } else $content .= "You Must Be Logged In To Do That."; ?>
  16. Hi everyone I have this code that i want to only run if the session is registered. <?php include_once('includes/include.php'); $themename=$_POST['themename']; $query = "INSERT INTO theme SET themename='$themename'"; $result = mysql_query($query) or die(mysql_error()); header("Location: admin.php"); ?> what code would i put at the top of the file to stop anyone running this script, sorry but im a newbe.
  17. <?php include_once('includes/include.php'); $password = "*******"; if($_POST[password] == "" && $_SESSION[passed] != "y"){ $content .= "<form method='post' action='admin.php'><input type='password' name='password' value='password'><input type=submit></form>"; } else if($_POST[password] != ""){ if($password == $_POST[password]){ $_SESSION[passed] = "y"; } else{ echo "<script>window.location = 'admin.php';</script>"; } } if($_SESSION[passed] == "y"){ $title=$_POST['title']; $date=$_POST['date']; $text=$_POST['text']; $query = "INSERT INTO news SET id='', title='$title', date='$date', text='$text'"; $result = mysql_query($query) or die(mysql_error()); header("Location: admin.php"); } else{ echo "You Must Be Logged In To Do That"; } ?> My form looks like this <?php $content .= '<form action="news_edit.php" method="post"><table width="500"> <tr> <td colspan="2"><span class="bolder">Manage News</span></td> </tr> <tr> <td><span class="bolder">Title</span></td> <td> <input type="text" name="title" id="title" /> </td> </tr> <tr> <td><span class="bolder">Date</span></td> <td><input type="text" name="date" id="date" /></td> </tr> <tr> <td valign="top"><span class="bolder">News</span></td> <td> <textarea name="text" id="text" cols="45" rows="5"></textarea></td> </tr> <tr> <td><input name="id" type="hidden" value="id" /></td> <td><input type="reset" name="reset" id="reset" value="Reset" /> <input type="submit" name="submit" id="submit" value="Submit" /></td> </tr> </table> </form>'; } ?> (edited by kenrbnsn to add tags)
  18. Stupid me, no $ in query But now i get this problem Out of range value adjusted for column 'id' at row 1
  19. line 24 ---------- query = "INSERT INTO news SET id='NULL', title='$title', date='$date', text='$text'";
  20. Parse error: syntax error, unexpected '=' in C:\Program Files\Apache Group\Apache2\htdocs\wg\wgp\news_edit.php on line 24 line 24 ---------- query = "INSERT INTO news SET id='NULL', title='$title', date='$date', text='$text'";
  21. Can someone pick whats wrong with my code please if($_SESSION[passed] == "y"){ $id=$_POST['id']; $title=$_POST['title']; $date=$_POST['date']; $text=$_POST['text']; $query = "INSERT INTO news id='NULL', title='$title', date='$date', text='$text'"; $result = mysql_query($query) or die(mysql_error()); header("Location: admin.php"); } else{ echo "You Must Be Logged In To Do That"; }
  22. i used snippets of your code and WOLA its running perfect. Thanks a ton!!
  23. The user has no details in the database linked to them, so i dont need to populate a file with there details. Each user has there own file which is recorded in the page field, but i added the id field anyway. i only have 5 users, my table structure is: id, username, password, page. In the page field is a record that says for example goldwell.php, each user is different. What i want is, when they login, PHP to get the page record for that user and direct them to that page (the file in the Page field) on successful login. Thanks for any help
×
×
  • 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.