Jump to content

ThomasBalaban

Members
  • Posts

    7
  • Joined

  • Last visited

ThomasBalaban's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I made the above changes and I am still getting the same error. I am quiet perplexed by this. Thanks for the help by the way!
  2. Normally I avoid asking for help but I am really confused. This is working on another site of mine. Pretty much a user enters their information and it auto generates using this code onto a image and then saves it. I am getting a different result then on the other and I am not sure why. working: http://www.drwayneandersen.com/display-cert/?cert_name=test Non: http://stopchallengechoose.com/testing-cert-display/?cert_name=testing Working: <?php require_once("http://www.drwayneandersen.com/wp-load.php"); require('./wp-blog-header.php'); //get_header(); $current_user = wp_get_current_user(); $email=$current_user->user_email; //echo "CURRENT TOP".$current_user->user_email; //ini_set('display_errors', 1); // you can set to 0 for production version //error_reporting(E_ALL); //echo "In the file"; function LoadJpeg() { //create the background image //if (file_exists($filename)) { // echo "The file $filename exists"; //} else { // echo "The file $filename does not exist"; //} $cert_id=30; if(isset($_REQUEST['cert_name'])){ $certname = $_REQUEST['cert_name']; } if(isset($_REQUEST['cert_id'])){ $cert_id = $_REQUEST['cert_id']; } if ($cert_id == 90) { $im = imagecreatefromjpeg('http://www.drwayneandersen.com/wp-content/uploads/2013/03/DrACertificate90Day.jpg'); $filename ="http://www.drwayneandersen.com/wp-content/uploads/2013/03/DrACertificate90Day.jpg"; } else if ($cert_id == 60) { $im = imagecreatefromjpeg('http://www.drwayneandersen.com/wp-content/uploads/2013/03/DrACertificate60Day.jpg'); $filename ="http://www.drwayneandersen.com/wp-content/uploads/2013/03/DrACertificate60Day.jpg"; } else { $im = imagecreatefromjpeg('http://www.drwayneandersen.com/wp-content/uploads/2013/02/cert.jpg'); $filename ="http://www.drwayneandersen.com/wp-content/uploads/2013/02/cert.jpg"; } /* See if it failed */ if(!$im) { /* Create a black image */ $im = imagecreatetruecolor(150, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an error message */ imagestring($im, 1, 5, 5, 'Error loading FILE ' . $filename, $tc); } $textcolor = imagecolorallocate($im, 89, 88, 93); $font = '/home1/drwaynea/public_html/arial.ttf'; imagettftext($im, 55, 0, 370, 1050, $textcolor, $font, $certname); // createCert($clientGoalImage[0], $im, $textColor, $fontfile, $clientGoalStatement[0], $galleryArray, $galleryCtr, $source); return $im; } header('Content-Type: image/jpeg'); $img = LoadJpeg(); $filePath='certs/'.$email.'/cert'.$cert_id.'.jpg'; $ckdirname = ("certs/" . "$email" . "/"); if (!(file_exists($ckdirname))) { mkdir("certs/" . "$email", 0777); } imagejpeg($img, $filePath); imagejpeg($img); imagedestroy($img); //get_footer(); ?> Not working <?php require_once("http://www.stopchallengechoose.com//wp-load.php"); require('./wp-blog-header.php'); //get_header(); $current_user = wp_get_current_user(); $email=$current_user->user_email; //echo "CURRENT TOP".$current_user->user_email; //ini_set('display_errors', 1); // you can set to 0 for production version //error_reporting(E_ALL); //echo "In the file"; function LoadJpeg() { //create the background image //if (file_exists($filename)) { // echo "The file $filename exists"; //} else { // echo "The file $filename does not exist"; //} $cert_id=30; if(isset($_REQUEST['cert_name'])){ $certname = $_REQUEST['cert_name']; } if(isset($_REQUEST['cert_id'])){ $cert_id = $_REQUEST['cert_id']; } if ($cert_id == 90) { $im = imagecreatefromjpeg('http://stopchallengechoose.com/wp-content/uploads/2014/03/certtesting.jpeg'); $filename ="http://stopchallengechoose.com/wp-content/uploads/2014/03/certtesting.jpeg"; } else if ($cert_id == 60) { $im = imagecreatefromjpeg('http://stopchallengechoose.com/wp-content/uploads/2014/03/certtesting.jpeg'); $filename ="http://stopchallengechoose.com/wp-content/uploads/2014/03/certtesting.jpeg"; } else { $im = imagecreatefromjpeg('http://stopchallengechoose.com/wp-content/uploads/2014/03/certtesting.jpeg'); $filename ="http://stopchallengechoose.com/wp-content/uploads/2014/03/certtesting.jpeg"; } /* See if it failed */ if(!$im) { /* Create a black image */ $im = imagecreatetruecolor(150, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an error message */ imagestring($im, 1, 5, 5, 'Error loading FILE ' . $filename, $tc); } $textcolor = imagecolorallocate($im, 89, 88, 93); $font = '/tank/www/users/medideascc/medideascc.pairserver.com/arial.ttf'; imagettftext($im, 55, 0, 370, 1050, $textcolor, $font, $certname); // createCert($clientGoalImage[0], $im, $textColor, $fontfile, $clientGoalStatement[0], $galleryArray, $galleryCtr, $source); return $im; } header('Content-Type: image/jpeg'); echo "<p>".$img."</p>"; $img = LoadJpeg(); $filePath='certs/'.$email.'/cert'.$cert_id.'.jpg'; $ckdirname = ("certs/" . "$email" . "/"); if (!(file_exists($ckdirname))) { mkdir("certs/" . "$email", 0777); } imagejpeg($img, $filePath); imagejpeg($img); imagedestroy($img); //get_footer(); ?>
  3. <section id="content"> <article> <div id="leftForm"> <h5>Login <span class="small">(case sensitive)</span></h5> <form action="processes/processLogin.php" method="post"> <span class="break"><label for="userName">Username:</label><input type="text" name="userName" ></span> <span class="break"><label for="userPass">Password:</label><input type="password" name="userPass" ></span> <span class="break"><input type="submit" value="login"></span> </form> </div> <!-- start PHP code --> <?php if(isset($_POST['createUser']) && !empty($_POST['createUser']) AND isset($_POST['email']) && !empty($_POST['email'])){ $createUser = mysql_escape_string($_POST['createUser']); // Turn our post into a local variable $email = mysql_escape_string($_POST['email']); // Turn our post into a local variable $result4 = run_my_query3("select * from users WHERE userName = '$createUser' limit 1"); while($row = mysql_fetch_array($result4)){ $userId = $row["userId"]; $userName = $row["userName"]; } $result = run_my_query("select * from users WHERE userName = '$createUser' "); if($row = mysql_fetch_array($result)){ $badUser = true; } else { $badUser = false; } if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ // Return Error - Invalid Email $msg = 'The email you have entered is invalid, please try again.'; }else if($badUser == true){ $msg = 'Username already in use'; }else{ // Return Success - Valid Email $msg = 'Your account has been made, <br /> please verify it by clicking the activation link that has been send to your email.'; $hash = md5( rand(0,1000) ); // Generate random 32 character hash and assign it to a local variable. // Example output: f4552671f8909587cf485ea990207f3b $createPassword = rand(1000,5000); // Generate random number between 1000 and 5000 and assign it to a local variable. // Example output: 4568 run_my_query3(" INSERT INTO users VALUES (null, '".mysql_escape_string($createUser)."', '".mysql_escape_string($createPassword)."', 'user', null, 'Fill this out~', null, null, '". mysql_escape_string($email) ."', 0, '". mysql_escape_string($hash) ."') "); /*VERIFICATION EMAIL */ $to = $email; // Send email to our user $subject = 'Afterlyfe Gaming | Verification'; // Give the email a subject $message = ' Thanks for signing up! Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. ------------------------ Username: '.$createUser.' Password: '.$createPassword.' ------------------------ Please click this link to activate your account: http://thomasbalaban.com/pieces/afterlyfeGaming/verification.php?email='.$email.'&hash='.$hash.' '; // Our message above including the link $headers = 'From:noreply@thomasbalaban.com' . "\r\n"; // Set from headers mail($to, $subject, $message, $headers); // Send our email } } ?> <!-- stop PHP Code --> <div id="rightForm"> <h5>Not Registered? Register here!</h5> <form action="" method="post" > <span class="break"><label for="createUser">Your username: <span id="userError"></span></label><input type="text" name="createUser" id="createUser" value=""></span> <span class="break"><label for="email">Email:</label><input type="text" name="email" value=""></span> <br /> <span class="break"><input type="submit" value="Sign up" /></span> </form> <?php if(isset($msg)){ // Check if $msg is not empty echo '<div class="statusmsg">'.$msg.'</div>'; // Display our message and wrap it with a div with the class "statusmsg". } ?> </div> </article> </section> That is the relevant code. The issue I get is when I attempt to do a email the following error appears How would I fix my code up to fix this error? I am new to the mail function so I apologize if my question is really basic.
  4. Hello, I am somewhat new to php and I am trying to figure something out. Here is my relevant code.... function run_my_query3($query){ //$serverHandle = mysql_connect('localhost', 'root'); $serverHandle = mysql_connect('localhost:8888', 'root', 'root', 'user_table'); //$serverHandle = mysql_connect('localhost', 'afterlyf','ev730l500c','user_table'); if($serverHandle == false){ die("bad server connection".mysql_error()); } $myDb = mysql_select_db('user_table') or die ('DB Problem - '.mysql_error()); $result4 = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); mysql_close($serverHandle); return $result4; } $result1 = run_my_query3("SELECT decklists.userName, decklists.userPicture, decklists.decklistName, decklists.decklistSideExtra, decklists.decklistDate FROM decklists, watchers WHERE '$_SESSION[userName]' = watchers.watcherName AND '$_SESSION[userName]' <> watchers.userName ORDER BY decklistDate DESC"); <?php while($row = mysql_fetch_array($result1)){ $userName = $row['userName']; $userPictureDeck = $row['userPicture']; $decklistsId = $row['decklistsId']; $decklistName = $row['decklistName']; $decklistMain = $row['decklistMain']; $decklistSideExtra = $row['decklistSideExtra']; $decklistDate = $row['decklistDate']; ?> <p>Deck Uploaded by <?php echo $userName; ?>: <?php echo $decklistName; ?><span> <?php echo $decklistDate; ?> </span></p> <?php } ?> Table watchId userName watcherName watcherPicture 110 CrunchTheWicked Cloud adamVajoka.jpg 112 Afterlyfe Cloud adamVajoka.jpg 108 chewieAFG Cloud adamVajoka.jpg I understand why it is repeating three times, which is because Cloud is the current user and his name is used three times within the table. What is the best way to get past this?
  5. I completely over looked that. Thank you so much!
  6. Hello, I am currently working on my first passion project which I am trying to create a account based system where users can register / log in / log out. I am having one small issue I can't seem to figure it out. The old version of the site can be found here http://thomasbalaban.com/pieces/afterlyfegaming/login.php (I have done many updates but this problem is happening on this one so why update it for this). The problem is when someone makes a account for some reason my code is making three accounts. Here is my code. //bring in the code to run a query: include("../includes/checkDb.php"); session_start(); //make vars to store what the user typed $userId = 0; $userUsername = $_POST['createUser']; $userPassword = $_POST['createPassword']; //add one to the highest id being used $result = run_my_query("select * from users order by userId desc limit 1"); while($row = mysql_fetch_array($result)){ $userId = $row["userId"]; } $userId++; echo "Account creation succesful, redirecting"; run_my_query(" INSERT INTO users VALUES (null, '$userUsername', '$userPassword', 'user', null, null, null, null) "); header("refresh:3;url=../index.php"); and this is the include /* Connects to local host and gets the sql file open */ function run_my_query($query){ $serverHandle = mysql_connect('localhost', 'root'); if($serverHandle == false){ die("bad server connection".mysql_error()); } $myDb = mysql_select_db('user_table') or die ('DB Problem - '.mysql_error()); $result = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); $result2 = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); $result3 = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); mysql_close($serverHandle); return $result; } function run_my_query2($query){ $serverHandle = mysql_connect('localhost', 'root'); if($serverHandle == false){ die("bad server connection".mysql_error()); } $myDb = mysql_select_db('user_table') or die ('DB Problem - '.mysql_error()); $result = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); $result2 = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); $result3 = mysql_query($query) or die ('Query Problem - '.$query.mysql_error()); mysql_close($serverHandle); return $result; } Can you guys see my problem? I have been trying to figure it out all day. Thank you very much!
×
×
  • 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.